| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |  | 
					
						
							|  |  |  |  | /// <summary> | 
					
						
							|  |  |  |  | ///INTERFACE CLASS FOR TABLE t_Employee | 
					
						
							|  |  |  |  | ///By wm with codesmith.  | 
					
						
							|  |  |  |  | ///on 04/18/2017 | 
					
						
							|  |  |  |  | /// </summary> | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | using System; | 
					
						
							|  |  |  |  | using System.Collections.Generic; | 
					
						
							|  |  |  |  | using System.Linq; | 
					
						
							|  |  |  |  | using System.Text; | 
					
						
							|  |  |  |  | using System.Data; | 
					
						
							|  |  |  |  | using System.Collections; | 
					
						
							|  |  |  |  | using DeiNiu.Utils; | 
					
						
							|  |  |  |  | namespace DeiNiu.wms.Data.Model | 
					
						
							|  |  |  |  | { | 
					
						
							|  |  |  |  |     [Serializable] | 
					
						
							|  |  |  |  |     public class Employee : Employee_base | 
					
						
							|  |  |  |  |     { | 
					
						
							|  |  |  |  |         public Employee() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         public Employee(int id): base(id) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         protected override void getImp() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             model_imp = new Employee_Imp(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         //begin cust db operation, query, excute sql etc. | 
					
						
							| 
									
										
										
										
											2024-02-06 19:36:47 +08:00
										 |  |  |  |         public DataSet QueryByName(string name) | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |         { | 
					
						
							| 
									
										
										
										
											2024-02-06 19:36:47 +08:00
										 |  |  |  |             cmdParameters[0] = name; | 
					
						
							|  |  |  |  |             return  CustQuery(600); | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |         } | 
					
						
							|  |  |  |  |         private ArrayList _departments; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         public ArrayList Departments | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             get | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return _departments; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             set | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 _departments = value; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         private List<Authority> _authForms =new List<Authority>(); | 
					
						
							|  |  |  |  |         private List<Authority> _authSpecials = new List<Authority>(); | 
					
						
							| 
									
										
										
										
											2023-11-21 19:18:23 +08:00
										 |  |  |  |         private Dictionary<string,List<Authority>> _authMap  ;  | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |         public List<Authority> AuthForms | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             get | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return _authForms; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             set | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 _authForms = value; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         public List<Authority> AuthSpecials | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             get | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return _authSpecials; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             set | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 _authSpecials = value; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |         } | 
					
						
							| 
									
										
										
										
											2023-11-21 19:18:23 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |         public Dictionary<string, List<Authority>> AuthMap { get | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 if( _authMap == null) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     _authMap = new Dictionary<string, List<Authority>>(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                     string key200 = WmsConstants.PDA_MENU_UTILS; | 
					
						
							|  |  |  |  |                     string key300 = WmsConstants.PDA_MENU_STK_IN; | 
					
						
							|  |  |  |  |                     string key400 = WmsConstants.PDA_MENU_STK_OUT; | 
					
						
							|  |  |  |  |                     string key500 = WmsConstants.PDA_MENU_PLATE; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                   | 
					
						
							|  |  |  |  |                         if (!_authMap.ContainsKey(key200)) | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                              _authMap.Add(key200, new List<Authority>()); | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                         if (!_authMap.ContainsKey(key300)) | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             _authMap.Add(key300, new List<Authority>()); | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                         if (!_authMap.ContainsKey(key400)) | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             _authMap.Add(key400, new List<Authority>()); | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                         if (!_authMap.ContainsKey(key500)) | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             _authMap.Add(key500, new List<Authority>()); | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                    | 
					
						
							|  |  |  |  |                       foreach (Authority au in AuthForms) | 
					
						
							|  |  |  |  |                         { | 
					
						
							|  |  |  |  |                             if (au.auth_order <= 200) | 
					
						
							|  |  |  |  |                             { | 
					
						
							|  |  |  |  |                                 _authMap[key200].Add(au); | 
					
						
							|  |  |  |  |                             } | 
					
						
							|  |  |  |  |                             else if (au.auth_order < 400) | 
					
						
							|  |  |  |  |                             {   | 
					
						
							|  |  |  |  |                                   _authMap[key300].Add(au); | 
					
						
							|  |  |  |  |                              } | 
					
						
							|  |  |  |  |                             else if (au.auth_order < 500) | 
					
						
							|  |  |  |  |                             { | 
					
						
							|  |  |  |  |                             _authMap[key400].Add(au); | 
					
						
							|  |  |  |  |                           | 
					
						
							|  |  |  |  |                             } | 
					
						
							|  |  |  |  |                             else | 
					
						
							|  |  |  |  |                             { | 
					
						
							|  |  |  |  |                             _authMap[key500].Add(au); | 
					
						
							|  |  |  |  |                           | 
					
						
							|  |  |  |  |                             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                         } | 
					
						
							|  |  |  |  |                     } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   | 
					
						
							|  |  |  |  |                 return _authMap; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  |             set => _authMap = value; } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |         public DataTable GetActivedEmplyeesByDept(int deptId) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             cmdParameters[0] = deptId; | 
					
						
							|  |  |  |  |             return CustQuery(100).Tables[0]; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 验证用户,成功则初始化该用户 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="userName"></param> | 
					
						
							|  |  |  |  |         /// <param name="passwd"></param> | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							|  |  |  |  |         public int ValidUser(string userName, string passwd) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             cmdParameters[0] = userName; | 
					
						
							|  |  |  |  |             cmdParameters[1] = passwd; | 
					
						
							|  |  |  |  |             DataTable dt = CustQuery(200).Tables[0]; | 
					
						
							|  |  |  |  |             if (dt.Rows.Count == 1) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 return Convert.ToInt32(dt.Rows[0]["id"].ToString()); | 
					
						
							|  |  |  |  |   | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             return -1; | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  |             | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 登录 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="userName"></param> | 
					
						
							|  |  |  |  |         /// <param name="passwd">md5加密的密码 </param> | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							|  |  |  |  |         public bool login(string userName, string passwd) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             cmdParameters[0] = userName; | 
					
						
							|  |  |  |  |             cmdParameters[1] = passwd ;   | 
					
						
							|  |  |  |  |             DataTable dt = CustQuery(200).Tables[0]; | 
					
						
							|  |  |  |  |             if (dt.Rows.Count == 1) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |               //  _id = Convert.ToInt32(dt.Rows[0]["id"].ToString()); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 getModel(dt.Rows[0]); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 this.token = Util.Encrypt((_em_account + DateTime.Now)); | 
					
						
							|  |  |  |  |                 this.Update(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 return true; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             return false; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 根据token 登录 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="token"></param> | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							|  |  |  |  |         public bool login(string token) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             cmdParameters[0] = token; | 
					
						
							|  |  |  |  |              | 
					
						
							|  |  |  |  |             DataTable dt = CustQuery(210).Tables[0]; | 
					
						
							|  |  |  |  |             if (dt.Rows.Count == 1) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                // _id = Convert.ToInt32(dt.Rows[0]["id"].ToString()); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                 getModel(dt.Rows[0]); | 
					
						
							|  |  |  |  |   | 
					
						
							|  |  |  |  |                 return true; | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             return false; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 验证用户,成功则初始化该用户 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="userName"></param> | 
					
						
							|  |  |  |  |         ///   | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							|  |  |  |  |         public bool ValidUser(string userName) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             cmdParameters[0] = userName; | 
					
						
							|  |  |  |  |             DataTable dt = CustQuery(201).Tables[0]; | 
					
						
							|  |  |  |  |             return dt.Rows.Count > 0; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 取 用户的lesson | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="empId"></param> | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							|  |  |  |  |         public DataTable GetLessons(int empId) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             cmdParameters[0] = empId; | 
					
						
							|  |  |  |  |             return CustQuery(300).Tables[0]; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 取用户所在部门的列表 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="empId"></param> | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							|  |  |  |  |         public DataTable GetDepartments(int empId) | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             _departments = new ArrayList(); | 
					
						
							|  |  |  |  |             cmdParameters[0] = empId; | 
					
						
							|  |  |  |  |             return CustQuery(400).Tables[0]; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 取用户所在部门的列表 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <param name="empId"></param> | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							|  |  |  |  |         public DataTable GetDepartments() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             if (_id != 0) | 
					
						
							|  |  |  |  |                 return GetDepartments(_id); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             return null; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 新增用户,并保存默认部门,职务信息 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         public new void Add() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             //         using (TransactionScope trans = new TransactionScope()) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 try | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |                     base.Add(); | 
					
						
							|  |  |  |  |                     DeptEmp deptemObj = new DeptEmp(); | 
					
						
							|  |  |  |  |                     deptemObj.de_dept = Convert.ToInt32(_em_dept); | 
					
						
							|  |  |  |  |                     deptemObj.de_employee = _id; | 
					
						
							|  |  |  |  |                     deptemObj.de_title = _em_jobcode; | 
					
						
							|  |  |  |  |                     deptemObj.Add(); | 
					
						
							|  |  |  |  |                     //                   trans.Complete(); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 catch (MyException) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     throw; | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  |                 catch (Exception er) | 
					
						
							|  |  |  |  |                 { | 
					
						
							|  |  |  |  |                     throw er; | 
					
						
							|  |  |  |  |                     // throw new Exception("出现异常,保存失败。"); | 
					
						
							|  |  |  |  |                 } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         public new void Update() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             base.Update(); | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         public new void Delete() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             base.Delete(); | 
					
						
							|  |  |  |  |             DeptEmp de = new DeptEmp(); | 
					
						
							|  |  |  |  |             de.Delete(Convert.ToInt32(_id)); | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  |         /// <summary> | 
					
						
							|  |  |  |  |         /// 在线统计 | 
					
						
							|  |  |  |  |         /// </summary> | 
					
						
							|  |  |  |  |         /// <returns></returns> | 
					
						
							|  |  |  |  |         public ArrayList GetUsersOnLine() | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             ArrayList al = new ArrayList(); | 
					
						
							|  |  |  |  |             DataTable dt = CustQuery(500).Tables[0]; | 
					
						
							|  |  |  |  |             foreach (DataRow drow in dt.Rows) | 
					
						
							|  |  |  |  |             { | 
					
						
							|  |  |  |  |                 al.Add(drow[0].ToString()); | 
					
						
							|  |  |  |  |             } | 
					
						
							|  |  |  |  |             return al; | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-05-21 17:28:35 +08:00
										 |  |  |  | 
 | 
					
						
							|  |  |  |  |         private string _extrMsg = ""; | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |         public string extrMsg | 
					
						
							|  |  |  |  |         { | 
					
						
							|  |  |  |  |             get { return _extrMsg; } | 
					
						
							|  |  |  |  |             set { _extrMsg = value; } | 
					
						
							|  |  |  |  |         } | 
					
						
							|  |  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-05-23 16:13:17 +08:00
										 |  |  |  |     } | 
					
						
							|  |  |  |  | } | 
					
						
							|  |  |  |  | 
 | 
					
						
							|  |  |  |  |   |