Example #1
0
        public static EmployeePO DOToPO(EmployeeDO from)
        {
            EmployeePO to = new EmployeePO();

            to.EmployeeId      = from.EmployeeId;
            to.LastName        = from.LastName;
            to.FirstName       = from.FirstName;
            to.Title           = from.Title;
            to.TitleOfCourtesy = from.TitleOfCourtesy;

            to.BirthDate = from.BirthDate;
            to.HireDate  = from.HireDate;

            to.Address    = from.Address;
            to.City       = from.City;
            to.Region     = from.Region;
            to.PostalCode = from.PostalCode;
            to.Country    = from.Country;
            to.HomePhone  = from.HomePhone;
            to.Extension  = from.Extension;
            //Removed photo
            to.Notes     = from.Notes;
            to.ReportsTo = from.ReportsTo;
            to.PhotoPath = from.PhotoPath;
            to.Username  = from.Username;
            to.Password  = from.Password;
            to.Role      = from.Role;

            return(to);
        }
Example #2
0
        public JsonResult LoginSub(EmployeePO emp)
        {
            IEmployeeMgm empMgm = new EmployeeMgm();

            ReturnedData data  = new ReturnedData();
            EmployeePO   empdb = new EmployeePO();

            try
            {
                string spwd;
                var    result = empMgm.Login(emp, out empdb);
                if (result == null)
                {
                    data.Success = true;
                    if (empdb != null)
                    {
                        SetLoginUser(empdb);
                    }
                }
                else
                {
                    data.Success = false;
                }
                data.Message = result;
            }
            catch (Exception ex)
            {
                data.Success = false;
                data.Message = "出现错误,请联系维护人员";
                data.Error   = ex.ToString();
            }
            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Example #3
0
        public string ChangePassword(EmployeePO emp, string oldpwd, string password, out bool boolresult, out string spwd)
        {
            string result = "";

            boolresult = false;
            spwd       = null;
            var empdat = new EmployeeData();

            if (emp.Reserved1 == StringHelper.MD5Encrypt(oldpwd))
            {
                var recount = empdat.ChangePassword(emp.EmployeeNo, StringHelper.MD5Encrypt(password));
                if (recount > 0)
                {
                    boolresult = true;
                    spwd       = StringHelper.MD5Encrypt(password);
                    result     = "密码修改成功";
                }
                else
                {
                    result = "密码修改失败";
                }
            }
            else
            {
                result = "原始密码不正确";
            }
            return(result);
        }
Example #4
0
        public EmployeeVO GetEmployeeByID(int employeeID)
        {
            EmployeeData employeeData = new EmployeeData();
            EmployeeVO   employeeVO   = new EmployeeVO();
            EmployeePO   employeePO   = employeeData.GetEmployeeByID(employeeID);

            employeeVO = Mapper.Map <EmployeePO, EmployeeVO>(employeePO);

            return(employeeVO);
        }
Example #5
0
        public void SetLoginUser(EmployeePO empo)
        {
            emp = new EmployeeViewModel();
            StoreMgm storeMgm = new StoreMgm();

            emp.UserId       = empo.EmployeeID;
            emp.UserName     = empo.EmployeeNo;
            emp.Name         = empo.Name;
            emp.StoreId      = empo.StoreID;
            emp.StroeName    = storeMgm.GetStoreByID(empo.StoreID).StoreName;
            emp.UserPassword = empo.Reserved1;

            Session.Add("loginUser", emp);
        }
Example #6
0
        public string Login(EmployeePO emp, out EmployeePO empdb)
        {
            var empdat = new EmployeeData();

            string spwd = StringHelper.MD5Encrypt(emp.Reserved1);

            empdb = empdat.Login(emp);
            string result = null;

            if (empdb == null)
            {
                return(result = "用户名不存在");
            }
            if (empdb.Reserved1 != spwd)
            {
                return(result = "密码错误");
            }

            return(result);
        }
Example #7
0
        public JsonResult ResetPwdsub(string oldpwd, string password)
        {
            IEmployeeMgm empMgm = new EmployeeMgm();

            ReturnedData data = new ReturnedData();

            try
            {
                var    emp = Session["loginUser"] as EmployeeViewModel;
                bool   boolresult;
                string spwd;
                var    emppo = new EmployeePO()
                {
                    EmployeeID = emp.UserId,
                    EmployeeNo = emp.UserName,
                    Reserved1  = emp.UserPassword,
                    StoreID    = emp.StoreId,
                    Name       = emp.Name
                };
                var result = empMgm.ChangePassword(emppo, oldpwd, password, out boolresult, out spwd);
                data.Success = boolresult;
                data.Message = result;
                if (boolresult)
                {
                    emppo.Reserved1 = spwd;
                    SetLoginUser(emppo);
                }
            }
            catch (Exception ex)
            {
                data.Success = false;
                data.Message = "出现错误,请联系维护人员";
                data.Error   = ex.ToString();
            }
            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Example #8
0
 public void EditEmployee(EmployeePO employee)
 {
     _daoEmployee.Update(employee);
 }
Example #9
0
 public void AddEmployee(EmployeePO employee)
 {
     _daoEmployee.Add(employee);
 }
Example #10
0
 public EmployeePO Login(EmployeePO emp)
 {
     return(_daoEmployee.GetModelByEmployeeNo(emp.EmployeeNo));
 }