示例#1
0
        protected void RowSelect(object sender, DirectEventArgs e)
        {
            Employee model      = new Employee();
            string   employeeID = e.ExtraParams["EmployeeID"];
            //string dbName="PT_clientleo";
            string    sql = "SELECT 人员编号 as EmployeeNumber, EmployeeList.人员名称 as FullName, 性别 as Gender,学历 as degree, 移动电话 as MobilePhone,归属部门 as DepartmentNumber, 归属角色 as Position, 出生年月 as BirthDate, 通讯地址 as Address, Email, 培训情况 as BriefIntroduction, 进厂日期 as HireDate FROM EmployeeList WHERE 人员编号='" + employeeID + "'";
            DataTable dt  = DbHelperSQL.FindTable(dbName, sql);

            //Model.Employee empl = Model.Employee.GetEmployee(int.Parse(employeeID));
            Model.Employee empl = Common <Employee> .Dt2Model(model, dt);

            DateTime BirthDate = Convert.ToDateTime(empl.BirthDate);
            DateTime HireDate  = Convert.ToDateTime(empl.HireDate);

            this.FormPanel1.SetValues(new
            {
                empl.EmployeeNumber,
                empl.FullName,
                empl.Position,
                empl.degree,
                HireDate,
                empl.DepartmentNumber,
                empl.Address,
                empl.Email,
                empl.MobilePhone,
                empl.Gender,
                BirthDate,
                empl.BriefIntroduction
            });
        }
示例#2
0
 public int GetEmpNumInDep(Employee numEmp)
 {
     var get = (from g in hrContext.Employee
                where g.DepartmentId == numEmp.DepartmentId
                select g).Count();
     return get;
 }
示例#3
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();
 }
示例#4
0
 private void dgvDepartment_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (dgvDepartment.CurrentRow.Selected == true)
     {
         btnSetManger.Enabled = true;
         Employee picEmp = new Employee();
         Employee getEmp = new Employee();
         getEmp.EmployeeId = picEmp.EmployeeId = Convert.ToInt32(dgvDepartment.CurrentRow.Cells[0].Value);
         if (dtc.GetPic(picEmp) == null) { picEmployee.Image = null; }
         else {
             Stream stream = new MemoryStream(dtc.GetPic(picEmp).ToArray());
             Bitmap img = (Bitmap)Image.FromStream(stream, false);
             picEmployee.Image = img;
         }
         foreach (var g in dtc.GetEmp(getEmp))
         {
             txtEmail.Text = g.EmployeeEmail;
             txtLoginName.Text = g.EmployeeLoginName;
             txtName.Text = g.EmployeeName;
         }
     }
     else {
         btnSetManger.Enabled = false;
         picEmployee.Image = null;
         txtEmail.Text = "";
         txtLoginName.Text = "";
         txtName.Text = "";
     }
 }
示例#5
0
 public IQueryable<Employee> GetDepEmp(Employee depEmp)
 {
     var get = from g in hrContext.Employee
               where g.DepartmentId == depEmp.DepartmentId
               select g;
     return get;
 }
示例#6
0
 public List<Employee> GetEmp(Employee getEmp)
 {
     List<Employee>  get = (from g in hrContext.Employee
                where g.EmployeeId == getEmp.EmployeeId
                select g).ToList();
     return get;
 }
        public static bool Login(Model.Employee employee)
        {
            SqlConnection connection = new SqlConnection(Connection_String);
            SqlCommand    command    = new SqlCommand();

            try
            {
                connection.Open();
                command.Connection  = connection;
                command.CommandType = CommandType.Text;
                command.CommandText =
                    string.Format("select * from Personel where ID = {0} and Password = '******' and Task = N'{2}'",
                                  employee.ID, employee.PassWord, employee.Task);
                command.Connection = connection;

                object x;
                x = command.ExecuteScalar();
                connection.Close();
                if (x != null)
                {
                    return(true);
                }
                return(false);
            }
            catch (SqlException e)
            {
                connection.Close();
                return(false);
            }
        }
示例#8
0
 private void BtnOK_Click(object sender, EventArgs e)//“修改”按钮
 {
     Model.Employee modifyPsd = new Model.Employee();
     modifyPsd.EmployeeLoginName = empName.Trim();//获取登录名
     dtc.psd = txtNewPassword2.Text.Trim();//获取新密码
     dtc.ModifyPsd(modifyPsd);//更新数据
     Close();//关闭本窗体
 }
示例#9
0
 public void RemoveEmp(Employee removeEmp, Employee intoEmp)
 {
     var remove = from r in hrContext.Employee
                  where r.DepartmentId == removeEmp.DepartmentId
                  select r;
     foreach(var r in remove) { r.DepartmentId = intoEmp.DepartmentId; }
     hrContext.SubmitChanges();
 }
示例#10
0
 public int SearchEmp(Employee searchEmp)
 {
     var search = (from s in hrContext.Employee
                   where (s.EmployeeName == searchEmp.EmployeeName &&
                   s.DepartmentId == searchEmp.DepartmentId) || s.EmployeeEmail == searchEmp.EmployeeEmail
                   select s.EmployeeId).First();
     return search;
 }
示例#11
0
 public void DelEmp(Employee delEmp)
 {
     var del = (from d in hrContext.Employee
                where d.EmployeeId == delEmp.EmployeeId
                select d).First();
     //hrContext.Employee.Attach(delEmp);
     hrContext.Employee.DeleteOnSubmit(del);
     hrContext.SubmitChanges();
 }
示例#12
0
 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);
 }
示例#13
0
        public bool Login(Model.Employee employee)
        {
            bool Res = DAL.DALClass.Login(employee);

            if (Res)
            {
                return(true);
            }

            return(false);
        }
示例#14
0
 public void LOAD()
 {
     btnSetManger.Enabled = false;
     Model.Department depID = new Model.Department();
     Employee getDepEmp = new Employee();
     depID.DepartmentName = departName;
     getDepEmp.DepartmentId= dtc.GetDepartmentID(depID);
     dgvDepartment.DataSource = dtc.GetDepEmp(getDepEmp);
     lblEmployeeNumber.Text = dtc.GetDepEmp(getDepEmp).Count().ToString();
     lblDepartmentName.Text = departName;
 }
示例#15
0
        public async Task <IActionResult> AddEmployee(Model.Employee employee)
        {
            var result = await this.manager.AddEmployee(employee);

            if (result == 1)
            {
                return(this.Ok(employee));
            }
            else
            {
                return(this.BadRequest());
            }
        }
 public Employee login(Employee e)
 {
     BusinessLogic.EmployeeController BL = new BusinessLogic.EmployeeController();
     Employee re = BL.login(e);
     if (re != null)
     {
         return re;
     }
     else
     {
         OutgoingWebResponseContext response = WebOperationContext.Current.OutgoingResponse;
         response.StatusCode = HttpStatusCode.NotFound;
         return null;
     }
 }
示例#17
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Employee model)
        {
            SqlParameter[] parameters = {
                    new SqlParameter("@OrganID", model.OrganID),
                    new SqlParameter("@Name", model.Name),
                    new SqlParameter("@JoinDate", model.JoinDate==null?DBNull.Value:(object)model.JoinDate),
                    new SqlParameter("@LeaveDate", model.LeaveDate==null?DBNull.Value:(object)model.LeaveDate),
                    new SqlParameter("@InputBy", model.InputBy),
                    new SqlParameter("@IsPrivate", model.IsPrivate)
                    //new SqlParameter("@Sex", model.Sex),
                    //new SqlParameter("@Nation", model.Nation),
                    //new SqlParameter("@Native", model.Native==null?"":model.Native),
                    //new SqlParameter("@Education", model.Education),
                    //new SqlParameter("@PersonID", model.PersonID),
                    //new SqlParameter("@BirthDate", model.LeaveDate),
                    //new SqlParameter("@Address", model.Address==null?"":model.Address),
                    //new SqlParameter("@Telephone", model.Telephone==null?"":model.Telephone),
                    //new SqlParameter("@Mobile", model.Mobile==null?"":model.Mobile),
                    //new SqlParameter("@position", model.position==null?"":model.position),
                    //new SqlParameter("@JoinDate", model.JoinDate),
                    //new SqlParameter("@Photo", model.Photo==null?"":model.Photo),
                    //new SqlParameter("@DriveLicenseNO", model.DriveLicenseNO==null?"":model.DriveLicenseNO),

                    //new SqlParameter("@InputBy", model.InputBy)
                                        };
            int re = 0;
            DbHelperSQL.RunProcedure("Proc_AddEmployee", parameters, out re);
            if (re > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
示例#18
0
 public void ModifyEmp(Employee modifyEmp)
 {
     dc.ModifyEmp(modifyEmp);
 }
示例#19
0
 public Array LoadEmp(Employee loadEmp)
 {
     return dc.LoadEmp(loadEmp);
 }
示例#20
0
 public  int SearchEmp(Employee searchEmp)
 {
     return dc.SearchEmp(searchEmp);
 }
示例#21
0
 public List<Employee> GetEmp(Employee getEmp)
 {
    return dc.GetEmp(getEmp);
 }
示例#22
0
 public IQueryable<Employee> GetDepEmp(Employee depEmp)
 {
     return dc.GetDepEmp(depEmp);
 }
示例#23
0
 public void RemoveEmp(Employee removeEmp, Employee intoEmp)
 {
     dc.RemoveEmp(removeEmp,intoEmp);
 }
示例#24
0
 public void ModifyPsd(Employee modifyPsd)
 {
     dc.psd = psd.Trim();
     dc.ModifyPsd(modifyPsd);
 }
示例#25
0
 public int Login(Employee loginEmp)
 {
     return dc.Login(loginEmp);
 }
示例#26
0
 public int GetEmpNumInDep(Employee numEmp)
 {
     return dc.GetEmpNumInDep(numEmp);
 }
示例#27
0
 public int Check(Employee checkEmp) { return dc.Check(checkEmp); }
示例#28
0
 public Binary GetPic(Employee picEmp) { return dc.GetPic(picEmp); }
示例#29
0
 public void LevelUp(Employee levelUp)
 {
     dc.LevelUp(levelUp);
 }
示例#30
0
 private void txtLoginName_TextChanged(object sender, EventArgs e)//验证登录名
 {
     Model.Employee checkEmp = new Model.Employee();
     checkEmp.EmployeeLoginName = txtLoginName.Text.Trim();//获取登录名
     /**/
     if (txtLoginName.Text.Trim() == txtName.Text.Trim())
     {
         lblWarningSame.Visible = true;
         txtPassword.Enabled = false;
         txtEmail.Enabled = false;
     }else { lblWarningSame.Visible = false;
         txtPassword.Enabled = true ;
         txtEmail.Enabled = true ;
     }
     if (dtc.Check(checkEmp) <= 0)
     {
         lblWarning.Visible = false;
     }
     else
     {
         lblWarning.Visible = true;
     }
     if (txtName.Text.Trim() == "" || txtPassword.Text.Trim() == "" || txtEmail.Text.Trim() == ""|| cbDepartment.Text.Trim() == "")
     {
         btnNewEmployee.Enabled = false;
     }
 }
示例#31
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);
     }
 }
示例#32
0
 public void DelEmp(Employee delEmp) { dc.DelEmp(delEmp); }
示例#33
0
        private Ride BuildRide(Ride ride, string driverName, Vehicle vehicle, Employee employee)
        {
            var created = new Ride
            {
                CarrierId = ride.CarrierId,
                Id = ride.Id,
                Comments = ride.Comments,
                Cost = ride.Cost,
                Distance = ride.Distance,
                Duration = ride.Duration,
                EndAddress = ride.EndAddress,
                StartAddress = ride.StartAddress,
                EndDateTime = ride.EndDateTime,
                StartDateTime = ride.StartDateTime,
                StartLatitude = 10,
                EndLatitude = 10,
                StartLongitude = 10,
                EndLongitude = 10,
                Rating = ride.Rating,
                RideId = ride.RideId,
                VehicleId = ride.VehicleId,
                Vehicle = vehicle == null ? null : new Vehicle()
                {
                    LicensePlate = vehicle.LicensePlate,
                    Model = vehicle.Model,
                    Picture = vehicle.Picture,
                    Make = vehicle.Make,
                    Rate = vehicle.Rate
                },
                DriverId = ride.DriverId,
                Driver = new Driver()
                {
                    DriverId = ride.DriverId,
                    Name = driverName
                },
                EmployeeId = ride.EmployeeId,
                Employee = employee == null ? null : new Employee()
                {
                    EmployeeId = employee.EmployeeId,
                    Picture = employee.Picture,
                    Name = employee.Name
                }
            };

            return created;
        }
示例#34
0
 public void AddEmp(Employee addEmp) {
     
     dc.AddEmp(addEmp); }