/// <summary> /// Class Constructor /// </summary> public DevAuthDetailDialog(OutEmployeeInfo emp) { InitializeComponent(); CurOrgEmp = null; CurOutEmp = emp; CurDevices = new List <DeviceInfo>(); }
/// <summary> /// Class Constructor /// </summary> public SaveOrgEmployeeForm(EnmSaveBehavior Behavior, OrgEmployeeInfo Employee) { InitializeComponent(); CurBehavior = Behavior; EmpEntity = new Employee(); CurEmployee = new OrgEmployeeInfo(); OriEmployee = Employee; Common.CopyObjectValues(OriEmployee, CurEmployee); Text = Behavior == EnmSaveBehavior.Add ? "新增员工信息" : "编辑员工信息"; }
/// <summary> /// Add employee. /// </summary> private void AddBtn_Click(object sender, EventArgs e) { try { DepartmentInfo dept = null; if (DeptTreeView.SelectedNode != null) { var dId = (String)DeptTreeView.SelectedNode.Tag; dept = Departments.Find(d => d.DepId.Equals(dId, StringComparison.CurrentCultureIgnoreCase)); } var maxId = EmpEntity.GetMaxOrgEmployeeID() + 1; var obj = new OrgEmployeeInfo() { ID = maxId, EmpId = String.Format("{0:D8}", maxId), EmpType = EnmWorkerType.ZSYG, EmpName = String.Empty, EnglishName = String.Empty, Sex = "M", CardId = String.Empty, Hometown = String.Empty, BirthDay = new DateTime(1985, 1, 1), Marriage = EnmMarriageType.SG, HomeAddress = String.Empty, HomePhone = String.Empty, EntryDay = DateTime.Today, PositiveDay = DateTime.Today.AddMonths(3), DepId = dept != null ? dept.DepId : String.Empty, DepName = dept != null ? dept.DepName : String.Empty, DutyName = String.Empty, OfficePhone = String.Empty, MobilePhone = String.Empty, Email = String.Empty, Comment = String.Empty, Photo = null, PhotoLayout = (int)ImageLayout.Zoom, Enabled = true, ResignationDate = ComUtility.DefaultDateTime, ResignationRemark = ComUtility.DefaultString }; if (new SaveOrgEmployeeForm(EnmSaveBehavior.Add, obj).ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { Employees.Add(obj); BindEmployeesToGridView(); } } catch (Exception err) { Common.WriteLog(DateTime.Now, EnmMsgType.Error, "System", "Delta.MPS.AccessSystem.OrgEmployeeManagerForm.AddBtn.Click", err.Message, err.StackTrace); MessageBox.Show(err.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Add Out Employee. /// </summary> private void AddBtn_Click(object sender, EventArgs e) { try { var maxId = EmpEntity.GetMaxOutEmployeeID() + 1; OrgEmployeeInfo Employee = null; if (EmpTreeView.SelectedNode != null) { var tag = (IDValuePair <Int32, String>)EmpTreeView.SelectedNode.Tag; if (tag != null && tag.ID == 1) { Employee = OrgEmployees.Find(oe => oe.EmpId.Equals(tag.Value, StringComparison.CurrentCultureIgnoreCase)); } } var obj = new OutEmployeeInfo() { ID = maxId, EmpId = String.Format("{0:D8}", maxId), EmpName = String.Empty, Sex = "M", CardId = String.Empty, CardAddress = String.Empty, CardIssue = String.Empty, Hometown = String.Empty, CompanyName = String.Empty, ProjectName = String.Empty, OfficePhone = String.Empty, MobilePhone = String.Empty, Email = String.Empty, Comment = String.Empty, DepId = Employee != null ? Employee.DepId : String.Empty, DepName = Employee != null ? Employee.DepName : String.Empty, ParentEmpId = Employee != null ? Employee.EmpId : String.Empty, ParentEmpName = Employee != null ? Employee.EmpName : String.Empty, Photo = null, PhotoLayout = (int)ImageLayout.Zoom, Enabled = true }; if (new SaveOutEmployeeForm(EnmSaveBehavior.Add, obj).ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { OutEmployees.Add(obj); BindOutEmployeesToGridView(); } } catch (Exception err) { Common.WriteLog(DateTime.Now, EnmMsgType.Error, "System", "Delta.MPS.AccessSystem.OutEmployeeManagerForm.AddBtn.Click", err.Message, err.StackTrace); MessageBox.Show(err.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Get Organization Employees By Role Id. /// </summary> /// <param name="roleId">role id</param> /// <returns>Role Organization Employees</returns> public List <OrgEmployeeInfo> GetOrgEmployees(Guid roleId) { SqlParameter[] parms = { new SqlParameter("@RoleId", SqlDbType.UniqueIdentifier) }; parms[0].Value = ComUtility.DBNullSuperChecker(roleId); var employees = new List <OrgEmployeeInfo>(); using (var rdr = SQLHelper.ExecuteReader(SQLHelper.ConnectionStringLocalTransaction, CommandType.Text, SQLText.SQL_EE_GetOrgEmployees, parms)) { while (rdr.Read()) { var employee = new OrgEmployeeInfo(); employee.ID = ComUtility.DBNullInt64Handler(rdr["ID"]); employee.EmpId = ComUtility.DBNullStringHandler(rdr["EmpId"]); employee.EmpType = ComUtility.DBNullWorkerTypeHandler(rdr["EmpType"]); employee.EmpName = ComUtility.DBNullStringHandler(rdr["EmpName"]); employee.EnglishName = ComUtility.DBNullStringHandler(rdr["EnglishName"]); employee.Sex = ComUtility.DBNullStringHandler(rdr["Sex"]); employee.CardId = ComUtility.DBNullStringHandler(rdr["CardID"]); employee.Hometown = ComUtility.DBNullStringHandler(rdr["Hometown"]); employee.BirthDay = ComUtility.DBNullDateTimeHandler(rdr["BirthDay"]); employee.Marriage = ComUtility.DBNullMarriageTypeHandler(rdr["Marriage"]); employee.HomeAddress = ComUtility.DBNullStringHandler(rdr["HomeAddress"]); employee.HomePhone = ComUtility.DBNullStringHandler(rdr["HomePhone"]); employee.EntryDay = ComUtility.DBNullDateTimeHandler(rdr["EntryDay"]); employee.PositiveDay = ComUtility.DBNullDateTimeHandler(rdr["PositiveDay"]); employee.DepId = ComUtility.DBNullStringHandler(rdr["DepId"]); employee.DepName = ComUtility.DBNullStringHandler(rdr["DepName"]); employee.DutyName = ComUtility.DBNullStringHandler(rdr["DutyName"]); employee.OfficePhone = ComUtility.DBNullStringHandler(rdr["OfficePhone"]); employee.MobilePhone = ComUtility.DBNullStringHandler(rdr["MobilePhone"]); employee.Email = ComUtility.DBNullStringHandler(rdr["Email"]); employee.Comment = ComUtility.DBNullStringHandler(rdr["Comment"]); employee.Photo = ComUtility.DBNullBytesHandler(rdr["Photo"]); employee.PhotoLayout = ComUtility.DBNullInt32Handler(rdr["PhotoLayout"]); employee.ResignationDate = ComUtility.DBNullDateTimeHandler(rdr["ResignationDate"]); employee.ResignationRemark = ComUtility.DBNullStringHandler(rdr["ResignationRemark"]); employee.Enabled = ComUtility.DBNullBooleanHandler(rdr["Enabled"]); employees.Add(employee); } } return(employees); }
/// <summary> /// Add Card Button Click Event. /// </summary> private void AddBtn_Click(object sender, EventArgs e) { try { OrgEmployeeInfo Employee = null; if (EmpTreeView.SelectedNode != null) { var tag = (IDValuePair <Int32, String>)EmpTreeView.SelectedNode.Tag; if (tag != null && tag.ID == 1) { Employee = OrgEmployees.Find(oe => oe.EmpId.Equals(tag.Value, StringComparison.CurrentCultureIgnoreCase)); } } var obj = new CardInfo() { WorkerId = Employee != null ? Employee.EmpId : String.Empty, WorkerType = Employee != null ? Employee.EmpType : EnmWorkerType.ZSYG, WorkerName = Employee != null ? Employee.EmpName : String.Empty, DepId = Employee != null ? Employee.DepId : String.Empty, DepName = Employee != null ? Employee.DepName : String.Empty, CardSn = String.Empty, CardType = EnmCardType.ZSK, UID = String.Empty, Pwd = String.Empty, BeginTime = DateTime.Now, BeginReason = "员工入职", Comment = String.Empty, Enabled = true }; if (new SaveCardForm(EnmSaveBehavior.Add, obj).ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { Cards.Add(obj); BindCardsToGridView(); } } catch (Exception err) { Common.WriteLog(DateTime.Now, EnmMsgType.Error, "System", "Delta.MPS.AccessSystem.OrgCardManagerForm.AddBtn.Click", err.Message, err.StackTrace); MessageBox.Show(err.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }