示例#1
0
        public List <tbm_Employee> GetEmployeeList()
        {
            try
            {
                List <tbm_Employee> empLst = new List <tbm_Employee>();
                if (EmployeeList != null)
                {
                    foreach (EmployeeExistData empData in EmployeeList)
                    {
                        tbm_Employee emp = null;
                        foreach (tbm_Employee ee in empLst)
                        {
                            if (ee.EmpNo == empData.EmployeeNo)
                            {
                                emp = ee;
                            }
                        }
                        if (emp == null)
                        {
                            emp = new tbm_Employee()
                            {
                                EmpNo = empData.EmployeeNo
                            };
                            empLst.Add(emp);
                        }
                    }
                }

                return(empLst);
            }
            catch (Exception)
            {
                throw;
            }
        }
        /// <summary>
        /// Update employee data
        /// </summary>
        /// <param name="employee"></param>
        /// <returns></returns>
        public List <tbm_Employee> UpdateEmployee(tbm_Employee employee)
        {
            List <DateTime?> updateDateList = base.GetEmployeeUpdateDate(employee.EmpNo);

            //if (updateDateList == null || updateDateList.Count == 0 || updateDateList[0] == null
            //    || employee.UpdateDate == null || !employee.UpdateDate.HasValue)
            //{
            //    throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0007, new string[] { "UpdateDate" });
            //}

            if (CommonUtil.IsNullOrEmpty(employee.UpdateDate) && updateDateList[0].Value.CompareTo(employee.UpdateDate.Value) != 0)
            {
                throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0019, new string[] { employee.EmpNo });
            }

            employee.UpdateBy   = CommonUtil.dsTransData.dtUserData.EmpNo;
            employee.UpdateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime;

            List <tbm_Employee> updateList = new List <tbm_Employee>();

            updateList.Add(employee);
            string xml = CommonUtil.ConvertToXml_Store(updateList);

            return(base.UpdateEmployee(xml));
        }
示例#3
0
        public bool IsValidLogin(string employeeNo, string password)
        {
            try
            {
                List <tbm_Employee> user = base.GetEmployeeByEmpNo(employeeNo);
                if (user.Count < 1)
                {
                    return(false);
                }

                tbm_Employee    loginUser = user.First();
                PasswordHandler handle    = new PasswordHandler();
                if (loginUser.Status == PasswordHandler.STATUS_ACCOUNT_LOCK)
                {
                    return(false);
                }

                if (loginUser.Password == handle.GeneratePasswordHash(password))
                {
                    handle.PasswordWrongCountReset(loginUser.EmpNo);
                    return(true);
                }
                else
                {
                    handle.PasswordWrongCountUp(loginUser.EmpNo);
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#4
0
            public void SetEmployeeData(tbm_Employee emp)
            {
                if (emp == null ||
                    EmployeeNameProperty == null ||
                    EmployeeObject == null)
                {
                    return;
                }

                EmployeeNameProperty.SetValue(EmployeeObject, emp.EmpFullName, null);
            }
        /// <summary>
        /// Delete employee data
        /// </summary>
        /// <param name="employee"></param>
        /// <returns></returns>
        public List <tbm_Employee> DeleteEmployee(tbm_Employee employee)
        {
            List <DateTime?> updateDateList = base.GetEmployeeUpdateDate(employee.EmpNo);

            if (updateDateList == null || updateDateList.Count == 0 || updateDateList[0] == null ||
                employee.UpdateDate == null || !employee.UpdateDate.HasValue)
            {
                throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0007, new string[] { "UpdateDate" });
            }

            if (updateDateList[0].Value.CompareTo(employee.UpdateDate.Value) != 0)
            {
                throw ApplicationErrorException.ThrowErrorException(MessageUtil.MODULE_COMMON, MessageUtil.MessageList.MSG0019, new string[] { employee.EmpNo });
            }

            employee.UpdateBy   = CommonUtil.dsTransData.dtUserData.EmpNo;
            employee.UpdateDate = CommonUtil.dsTransData.dtOperationData.ProcessDateTime;
            return(base.DeleteEmployee(employee.EmpNo, employee.DeleteFlag, employee.UpdateBy, employee.UpdateDate));
        }