예제 #1
0
        /// <summary>
        /// 获取员工信息列表(返回员工主要字段名称)
        /// </summary>
        /// <param name="param">条件参数</param>
        /// <returns></returns>
        public List <HR_EmployeeResult> GetEmpMainInfoList(HR_EmployeeParam param)
        {
            this.CheckSession();
            List <HR_EmployeeResult> ret = new List <HR_EmployeeResult>();

            try
            {
                WhereClip    whereClip = GetWhereClip(param);
                List <Field> lstField  = new List <Field>()
                {
                    HR_Employee._.EmpID, HR_Employee._.EmpCode, HR_Employee._.EmpName, HR_Employee._.PositionID
                };
                ret = this.SelectList <HR_EmployeeResult>(whereClip, HR_EmployeeResult._.EmpName.Asc);
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }
            return(ret);
        }
예제 #2
0
        public WCFAddUpdateResult DelInfo(HR_EmployeeParam param)
        {
            WCFAddUpdateResult ret = new WCFAddUpdateResult();
            ExeResult          rst = new ExeResult();

            rst = this.Execute("ZNLCRM.BLL.HR.HR_EmployeeBLL", "DelInfo", param);
            ret = (rst == null ? new WCFAddUpdateResult() : rst.Result as WCFAddUpdateResult);
            return(ret);
        }
예제 #3
0
        public PageList <HR_EmployeeResult> GetPageList(HR_EmployeeParam param)
        {
            ExeResult rst = new ExeResult();

            rst = this.Execute("ZNLCRM.BLL.HR.HR_EmployeeBLL", "GetPageList", param);
            PageList <HR_EmployeeResult> pageList = (rst == null ? new  PageList <HR_EmployeeResult>(): (PageList <HR_EmployeeResult>)rst.Result);

            return(pageList);
        }
예제 #4
0
        public HR_EmployeeResult GetInfo(HR_EmployeeParam param)
        {
            HR_EmployeeResult ret = new HR_EmployeeResult();
            ExeResult         rst = new ExeResult();

            rst = this.Execute("ZNLCRM.BLL.HR.HR_EmployeeBLL", "GetInfo", param);
            ret = rst == null ? new HR_EmployeeResult() : rst.Result as HR_EmployeeResult;
            return(ret);
        }
예제 #5
0
        public List <HR_EmployeeResult> GetEmpList(HR_EmployeeParam param)
        {
            ExeResult rst = new ExeResult();

            rst = this.Execute("ZNLCRM.BLL.HR.HR_EmployeeBLL", "GetEmpList", param);
            List <HR_EmployeeResult> pageList = new List <HR_EmployeeResult>();

            pageList = (rst == null ? new List <HR_EmployeeResult>() : rst.Result as List <HR_EmployeeResult>);
            return(pageList);
        }
예제 #6
0
        /// <summary>
        /// 删除实体
        /// </summary>
        /// <param name="param">删除条件实体</param>
        /// <returns></returns>
        public WCFAddUpdateResult DelInfo(HR_EmployeeParam param)
        {
            this.CheckSession();
            WCFAddUpdateResult ret = new WCFAddUpdateResult();
            int affect             = 0;

            try
            {
                #region 判断
                if (param.EmpGuid == null)
                {
                    throw new WarnException("请指定要删除的记录!");
                }
                #endregion
                HR_EmployeeResult info = new HR_EmployeeResult();
                info = this.Select <HR_EmployeeResult>(new List <Field>()
                {
                    HR_Employee._.EmpID
                }, HR_Employee._.IsDeleted == false && HR_Employee._.EmpGuid == param.EmpGuid);
                if (info == null)
                {
                    throw new WarnException("未找到员工信息");
                }
                if (this.Count <ORD_SalesOrder>((ORD_SalesOrder._.SalerID == info.EmpID || ORD_SalesOrder._.CreatedEmpID == info.EmpID) && ORD_SalesOrder._.IsDeleted == false) > 0 ||
                    this.Count <ORD_PurchaseOrder>((ORD_PurchaseOrder._.BuyerID == info.EmpID || ORD_PurchaseOrder._.CreatedEmpID == info.EmpID) && ORD_PurchaseOrder._.IsDeleted == false) > 0)
                {
                    throw new WarnException("存在业务引用,不允许删除!");
                }
                WhereClip where = GetWhereClip(param);
                info            = new HR_EmployeeResult();
                info.IsDeleted  = true;
                affect          = this.Update <HR_EmployeeResult>(info, where);
                this.Update <SYS_UserAccount>(new SYS_UserAccount()
                {
                    IsDeleted = true
                }, SYS_UserAccount._.EmpID == info.EmpID && SYS_UserAccount._.GCompanyID == this.SessionInfo.CompanyID && SYS_UserAccount._.IsDeleted == false);
                #region 设置返回值
                ret.Key = affect;
                #endregion
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }
            return(ret);
        }
예제 #7
0
파일: frmEditEmp.cs 프로젝트: windygu/CRM
 public void GetEmpInfo()
 {
     if (empID > 0 && orgID > 0 && deptID > 0)
     {
         HR_EmployeeParam param = new HR_EmployeeParam();
         param.EmpID  = empID;
         param.DeptID = deptID;
         param.OrgID  = orgID;
         HR_EmployeeResult info = empLogic.GetInfo(param);
         if (info != null)
         {
             this.ConvertEntityToControl <HR_EmployeeResult>(this.grpCo1.Controls, info, null);
             this.ConvertEntityToControl <HR_EmployeeResult>(this.grpCo2.Controls, info, null);
             this.ConvertEntityToControl <HR_EmployeeResult>(this.grpCo3.Controls, info, null);
             this.ConvertEntityToControl <HR_EmployeeResult>(this.tpSysInfo.Controls, info, null);
         }
     }
 }
예제 #8
0
        /// <summary>
        /// 获取人员,部门,机构信息
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public PageList <HR_EmployeeResult> GetPageList(HR_EmployeeParam param)
        {
            this.CheckSession();
            PageList <HR_EmployeeResult> pagelist = new PageList <HR_EmployeeResult>();

            try
            {
                WhereClip whereClip = GetWhereClip(param);
                if (!string.IsNullOrEmpty(param.DeptName))
                {
                    whereClip = whereClip && HR_Department._.DeptName.At("b") == param.DeptName;
                }
                if (!string.IsNullOrEmpty(param.OrgName))
                {
                    whereClip = whereClip && HR_Org._.OrgName.At("c") == param.OrgName;
                }

                List <Field> fiels = new List <Field>()
                {
                    HR_Employee._.EmpID,
                    HR_Employee._.EmpName,
                    HR_Employee._.EmpCode,
                    HR_Department._.DeptID.At("b"),
                    HR_Department._.DeptName.At("b"),
                    HR_Department._.DeptNo.At("b"),
                    HR_Org._.OrgID.At("c"),
                    HR_Org._.OrgNo.At("c"),
                    HR_Org._.OrgName.At("c")
                };
                WhereClip onWhereClip1 = HR_Employee._.DeptID == HR_Department._.DeptID.At("b");
                WhereClip onWhereClip2 = HR_Org._.OrgID.At("b") == HR_Department._.OrgID.At("c");
                pagelist = this.SelectList <HR_EmployeeResult, HR_Department, HR_Org>(JoinType.InnerJoin, onWhereClip1, JoinType.InnerJoin, onWhereClip2, param.PageIndex.GetValueOrDefault(1), param.PageSize.GetValueOrDefault(100), fiels, whereClip, HR_Employee._.EmpName.Asc, null, null);
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }
            return(pagelist);
        }
예제 #9
0
 void BindDgvEmp(int pageIndex)
 {
     if (trOrg.SelectedNode != null)
     {
         HR_EmployeeParam param = new HR_EmployeeParam();
         if (trOrg.SelectedNode.Name.Contains("trnOrg"))
         {
             param.OrgID = int.Parse(trOrg.SelectedNode.Name.Substring(6));
         }
         if (trOrg.SelectedNode.Name.Contains("trnDept"))
         {
             param.DeptID = int.Parse(trOrg.SelectedNode.Name.Substring(7));
         }
         if (!string.IsNullOrEmpty(txtEmpName.Text))
         {
             param.EmpName = txtEmpName.Text.Trim();
         }
         param.NoEmpIDs  = empIds;
         param.PageIndex = pageIndex;
         param.PageSize  = 100;
         PageList <HR_EmployeeResult> lstRst = empLogic.GetPageList(param);
         dgvEmp.DataSource = lstRst.ResultJoinList;
         pgEmp.RecordCount = lstRst.TotalCount;
         List <HR_EmployeeResult> empList = new List <HR_EmployeeResult>();
         foreach (DataRow row in lstRst.ResultJoinList.Rows)
         {
             empList.Add(new HR_EmployeeResult
             {
                 EmpID   = row["EmpID"].ToInt32(),
                 EmpCode = row["EmpCode"].ToStringHasNull(),
                 EmpName = row["EmpName"].ToStringHasNull()
             });
         }
         this.SetDataSource <HR_EmployeeResult>(empList);
         SetGridCheck(this.dgvEmp, _idColName, _chkColName);
     }
     else
     {
         this.ShowMessage("请选择要搜索的机构或者部门!");
     }
 }
예제 #10
0
 /// <summary>
 /// 获取条件的公共方法
 /// </summary>
 /// <param name="param">条件实体</param>
 /// <returns></returns>
 WhereClip GetWhereClip(HR_EmployeeParam param)
 {
     this.CheckSession();
     WhereClip where = HR_Employee._.IsDeleted == 0;
     if (param.EmpID != null)
     {
         where = where && HR_Employee._.EmpID == param.EmpID;
     }
     if (param.EmpIDs != null)
     {
         where = where && HR_Employee._.EmpID.In(param.EmpIDs);
     }
     if (param.EmpCode != null)
     {
         where = where && HR_Employee._.EmpCode == param.EmpCode;
     }
     if (param.EmpGuid != null)
     {
         where = where && HR_Employee._.EmpGuid == param.EmpGuid;
     }
     if (param.OrgID != null)
     {
         where = where && HR_Employee._.OrgID == param.OrgID;
     }
     if (param.DeptID != null)
     {
         where = where && HR_Employee._.DeptID == param.DeptID;
     }
     if (param.EmpName != null)
     {
         where = where && HR_Employee._.EmpName.Like("%" + param.EmpName + "%");
     }
     if (param.NoEmpIDs != null && param.NoEmpIDs.Length > 0)
     {
         where = where && !HR_Employee._.EmpID.In(param.NoEmpIDs);
     }
     return(where);
 }
예제 #11
0
 void  SearchEmp()
 {
     if (trOrg.SelectedNode != null)
     {
         HR_EmployeeParam param = new HR_EmployeeParam();
         if (trOrg.SelectedNode.Name.Contains("trnOrg"))
         {
             param.OrgID = int.Parse(trOrg.SelectedNode.Name.Substring(6));
         }
         if (trOrg.SelectedNode.Name.Contains("trnDept"))
         {
             param.DeptID = int.Parse(trOrg.SelectedNode.Name.Substring(7));
         }
         if (!string.IsNullOrEmpty(txtEmpName.Text))
         {
             param.EmpName = txtEmpName.Text.Trim();
         }
         List <HR_EmployeeResult> rst = this.AsyncExecute <List <HR_EmployeeResult>, HR_EmployeeParam>(param, empLogic.GetEmpList, BindDataGrid);
     }
     else
     {
         this.ShowMessage("请选择要搜索的机构或者部门!");
     }
 }
예제 #12
0
        /// <summary>
        /// 获取一条信息记录
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public HR_EmployeeResult GetInfo(HR_EmployeeParam param)
        {
            this.CheckSession();
            HR_EmployeeResult rst = new HR_EmployeeResult();

            #region 判断
            if (param.EmpID == null)
            {
                throw new WarnException("请指定关键字EmpID!");
            }
            #endregion
            #region 获取实体
            rst = this.Select <HR_EmployeeResult>(GetWhereClip(param));
            //rst.Password = EncrypHandler.Decrypto(rst.Password);
            #endregion
            #region 获取登录的信息
            SYS_UserAccountResult userAccount = new SYS_UserAccountResult();
            if (rst != null && rst.EmpID > 0)
            {
                userAccount = this.Select <SYS_UserAccountResult>(SYS_UserAccount._.EmpID == rst.EmpID && SYS_UserAccount._.GCompanyID == this.SessionInfo.CompanyID && SYS_UserAccount._.IsDeleted == false);
                if (userAccount != null)
                {
                    rst.NeedValidate     = userAccount.NeedValidate;
                    rst.UseTimeBegin     = userAccount.UseTimeBegin;
                    rst.UseTimeOver      = userAccount.UseTimeOver;
                    rst.MacAddress       = userAccount.MacAddress;
                    rst.HardDiskSN       = userAccount.HardDiskSN;
                    rst.SignInTimes      = userAccount.SignInTimes;
                    rst.LastSignTime     = userAccount.LastSignTime;
                    rst.LastSignIP       = userAccount.LastSignIP;
                    rst.AfterTimeForBill = userAccount.AfterTimeForBill;
                }
            }
            #endregion
            return(rst);
        }