Exemple #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     Model.Department depID = new Model.Department();
     deleteDep.DepartmentName = deptName;
     depID.DepartmentName = deptName;
     Employee numEmp = new Employee();
     numEmp.DepartmentId = dtc.GetDepartmentID(depID);
     if (dtc.GetEmpNumInDep(numEmp) > 0)
     {
         Employee removeEmp = new Employee();
         Employee intoEmp = new Employee();
         
         
         removeEmp.DepartmentId = dtc.GetDepartmentID(depID);
         depID.DepartmentName = cbDepartment.Text;
         intoEmp.DepartmentId = dtc.GetDepartmentID(depID);
         dtc.RemoveEmp(removeEmp, intoEmp);
     }
     dtc.DeleteDep(deleteDep);
     Model.SystemEvent addEvent = new SystemEvent();
     addEvent.EventDate = DateTime.Now.ToShortDateString();
     addEvent.EventDescription = "删除成功";
     dtc.AddEvent(addEvent);
     MessageBox.Show("删除成功!");
     Close();
 }
Exemple #2
0
 public List<SystemEvent> SearchEvent(SystemEvent searchEvent)
 {
     var sea = (from s in hrContext.SystemEvent
                where s.EventDate == searchEvent.EventDate
                select s).ToList();
     return sea;
 }
Exemple #3
0
 private void BtnOK_Click(object sender, EventArgs e)
 {
     SystemEvent searchEvent = new SystemEvent();
     if (DtpEnd.Value.Subtract(DtpStart.Value).Days>=0)//如果开始时间小于等于结束时间
     {
         //通过for循环获取连续时间段内每一天发生的事情并添加到数组中
         for (DateTime dtStart = DtpStart.Value; dtStart <= DtpEnd.Value; dtStart = dtStart.AddDays(1))
         {
             searchEvent.EventDate = dtStart.ToShortDateString();
             item.AddRange(dtc.SearchEvent(searchEvent));
         }
     }
     Close();//关闭
 }
Exemple #4
0
 private void btnOK_Click(object sender, EventArgs e)
 {
     Model.Department addDep = new Model.Department();
     Model.SystemEvent addEvent = new SystemEvent();
     dtc.name = txtDepartmentName.Text.Trim();
     dtc.description = txtDepartmentDescription.Text.Trim();
     dtc.Add(addDep);
     addEvent.EventDescription = "添加部门成功!";
     addEvent.EventDate = DateTime.Now.ToShortDateString();
     dtc.AddEvent(addEvent);
     MessageBox.Show("添加部门成功!", "消息:",MessageBoxButtons.OK );
     txtDepartmentName.Clear();
     txtDepartmentName.Focus();
 }
Exemple #5
0
 private void btnNewEmployee_Click(object sender, EventArgs e)
 {
     Model.Employee addEmp = new Model.Employee();
     Model.Employee modifyEmp = new Model.Employee();
     SystemEvent addEvent = new SystemEvent();
     SystemEvent modifyEvent = new SystemEvent();
     if (isAddEmployee == true)
     {
         addEmp.EmployeeLoginName = txtLoginName.Text.Trim();//登录名
         addEmp.EmployeeName = txtName.Text.Trim();//姓名
         addEmp.EmployeePassword = txtPassword.Text.Trim();//登陆密码
         addEmp.EmployeeEmail = txtEmail.Text.Trim();//邮箱
         depID.DepartmentName = cbDepartment.Text.Trim();//部门名
         addEmp.DepartmentId =dtc.GetDepartmentID(depID);//部门编号
         if (txtBaseSalary.Text.Trim() != "") { dtc.baseSalary = Convert.ToInt32(txtBaseSalary.Text.Trim()); }//基本工资
         addEmp.EmployeePostName = txtPosition.Text.Trim();//职位名
         if (txtPhone.Text.Trim() != "")//手机号码
         {
             addEmp.EmployeePhone =txtPhone.Text.Trim();
         }
         if (numLevel.Text.Trim() != "")//级别
         {
             addEmp.Employee_Level_ = Convert.ToInt32(numLevel.Text.Trim());
         }
         addEmp.EmployeeRegisterDate = DateTime.Now.ToShortDateString();//注册时间
         addEmp.EmployeePhoto = imageByte;//图片
         dtc.AddEmp(addEmp);
         addEvent.EventDescription = "新增员工:" + txtLoginName.Text.Trim();
         addEvent.EventDate = DateTime.Now.ToShortDateString();
         dtc.AddEvent(addEvent);
         MessageBox.Show("添加成功!", "消息:", MessageBoxButtons.OK);
         txtBaseSalary.Clear();
         txtBirth.Clear();
         txtEmail.Clear();
         txtLoginName.Clear();
         txtName.Clear();
         txtPassword.Clear();
         txtPhone.Clear();
         txtPosition.Clear();
         txtName.Focus();
     }
     else
     {
         modifyEmp.EmployeeId = employeeID;
         modifyEmp.EmployeeLoginName = txtLoginName.Text.Trim();//登录名
         modifyEmp.EmployeeName = txtName.Text.Trim();//姓名
         modifyEmp.EmployeePassword = txtPassword.Text.Trim();//登陆密码
         modifyEmp.EmployeeEmail = txtEmail.Text.Trim();//邮箱
         depID.DepartmentName = cbDepartment.Text.Trim();//部门名
         modifyEmp.DepartmentId = dtc.GetDepartmentID(depID);//部门编号
         if (txtBaseSalary.Text.Trim() != "") { dtc.baseSalary = Convert.ToInt32(txtBaseSalary.Text.Trim()); }//基本工资
         modifyEmp.EmployeePostName = txtPosition.Text.Trim();//职位名
         if (txtPhone.Text.Trim() != "")//手机号码
         {
             modifyEmp.EmployeePhone = txtPhone.Text.Trim();
         }
         if (numLevel.Text.Trim() != "")//级别
         {
             modifyEmp.Employee_Level_ = Convert.ToInt32(numLevel.Text.Trim());
         }
         modifyEmp.EmployeePhoto = imageByte;//图片
         dtc.ModifyEmp(modifyEmp);
         modifyEvent.EventDescription = "原员工:" +name+"已改名为:"+ txtLoginName.Text.Trim();
         modifyEvent.EventDate = DateTime.Now.ToShortDateString();
         dtc.ModifyEvent(modifyEvent);
         MessageBox.Show("修改成功!", "消息:", MessageBoxButtons.OK);
     }
 }
Exemple #6
0
 public void LoginEvent(SystemEvent loginEvent)
 {
     dc.LoginEvent(loginEvent);
 }
Exemple #7
0
 public List<SystemEvent> SearchEvent(SystemEvent searchEvent)
 {
     return dc.SearchEvent(searchEvent);
 }
Exemple #8
0
 public void AddEvent(SystemEvent addEvent) { dc.AddEvent(addEvent); }
Exemple #9
0
 public void ModifyEvent(SystemEvent modifyEvent)
 {
     dc.ModifyEvent(modifyEvent);
 }
 partial void DeleteSystemEvent(SystemEvent instance);
 partial void UpdateSystemEvent(SystemEvent instance);
 partial void InsertSystemEvent(SystemEvent instance);
 private void btnSetManger_Click(object sender, EventArgs e)
 {
     Employee levelUp = new Employee();
     levelUp.EmployeeId = Convert.ToInt32(dgvDepartment.CurrentRow.Cells[0].Value);
     levelUp.EmployeePostName = "经理";
     levelUp.Employee_Level_ = 2;
     SystemEvent addEvent = new SystemEvent();
     addEvent.EventDescription = "任命"+ dgvDepartment.CurrentRow.Cells[1].Value + "为" + departName + "经理";
     dtc.LevelUp(levelUp);
 }
Exemple #14
0
 public void LoginEvent(SystemEvent loginEvent)//登录事件
 {
     try
     {
         hrContext.SubmitChanges();
     }
     catch(Exception ee) { throw ee; }
 }
Exemple #15
0
 public void ModifyEvent(SystemEvent modifyEvent)
 {
    
     hrContext.SystemEvent.InsertOnSubmit(modifyEvent);
     hrContext.SubmitChanges();
 }
Exemple #16
0
 public void AddEvent(SystemEvent addEvent) { try {
         hrContext.SystemEvent.InsertOnSubmit(addEvent);
         hrContext.SubmitChanges(); }
     catch (Exception ee) { throw ee; } }