Esempio n. 1
0
 public Sys_EmpDataRightResult GetEmpDataRight(Sys_EmpDataRightParam param)
 {
     this.CheckSession();
     try
     {
         if (_empDataRight != null)
         {
             return(_empDataRight);
         }
         WhereClip where = Sys_EmpDataRight._.EmpID == this.SessionInfo.UserID.ToInt32() &&
                           Sys_EmpDataRight._.IsDeleted == false &&
                           Sys_EmpDataRight._.GCompanyID == this.SessionInfo.CompanyID;
         _empDataRight = this.Select <Sys_EmpDataRightResult>(where);
     }
     catch (WarnException exp)
     {
         throw exp;
     }
     catch (Exception exp)
     {
         LogInfoBLL.WriteLog(SessionInfo, exp);
         throw exp;
     }
     return(_empDataRight);
 }
Esempio n. 2
0
        private void frmSysEmpDataRight_Load(object sender, EventArgs e)
        {
            Sys_EmpDataRightParam param = new Sys_EmpDataRightParam();

            param.EmpID = txtEmpID.Text.ToInt32();
            rst         = empDataRightLogic.GetEmpDataRight(param);
            BindDataGridView();
        }
Esempio n. 3
0
        public WCFAddUpdateResult DelRoleEmpIDs(Sys_EmpDataRightParam param)
        {
            WCFAddUpdateResult ret = new WCFAddUpdateResult();
            ExeResult          rst = new ExeResult();

            rst = this.Execute("ZNLCRM.BLL.Sys.Sys_EmpDataRightBLL", "DelRoleEmpIDs", param);
            ret = (rst == null ? new WCFAddUpdateResult() : rst.Result as WCFAddUpdateResult);
            return(ret);
        }
Esempio n. 4
0
        public List <HR_EmployeeResult> GetRoleEmpList(Sys_EmpDataRightParam param)
        {
            List <HR_EmployeeResult> ret = new List <HR_EmployeeResult>();
            ExeResult rst = new ExeResult();

            rst = this.Execute("ZNLCRM.BLL.Sys.Sys_EmpDataRightBLL", "GetRoleEmpList", param);
            ret = (rst == null ? new List <HR_EmployeeResult>() : rst.Result as List <HR_EmployeeResult>);
            return(ret);
        }
Esempio n. 5
0
        public Sys_EmpDataRightResult GetEmpDataRight(Sys_EmpDataRightParam param)
        {
            Sys_EmpDataRightResult ret = new Sys_EmpDataRightResult();
            ExeResult rst = new ExeResult();

            rst = this.Execute("ZNLCRM.BLL.Sys.Sys_EmpDataRightBLL", "GetEmpDataRight", param);
            ret = rst == null ? new Sys_EmpDataRightResult() : rst.Result as Sys_EmpDataRightResult;
            return(ret);
        }
Esempio n. 6
0
 Sys_EmpDataRightResult GetEmpDataRight(Sys_EmpDataRightParam param)
 {
     if (_empDataRight != null)
     {
         return(_empDataRight);
     }
     WhereClip where = Sys_EmpDataRight._.EmpID == this.SessionInfo.UserID.ToInt32();
     _empDataRight   = this.Select <Sys_EmpDataRightResult>(where);
     return(_empDataRight);
 }
Esempio n. 7
0
        /// <summary>
        /// 删除某员工所拥有的角色
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public WCFAddUpdateResult DelRoleEmpIDs(Sys_EmpDataRightParam param)
        {
            WCFAddUpdateResult ret = new WCFAddUpdateResult();

            if (param.EmpIDs == null || param.EmpIDs.Length <= 0)
            {
                throw new WarnException("请指定员工记录!");
            }
            if (param.RoleID.ToInt32() <= 0)
            {
                throw new WarnException("请指定角色!");
            }
            ZNLCRM.BLL.Sys.Sys_RolesBLL   roleBll          = new Sys_RolesBLL();
            Sys_EmpDataRightResult        rst              = new Sys_EmpDataRightResult();
            List <Sys_EmpDataRightResult> empDataRightList = new List <Sys_EmpDataRightResult>();

            WhereClip where = Sys_EmpDataRight._.EmpID.In(param.EmpIDs) &&
                              Sys_EmpDataRight._.IsDeleted == false &&
                              Sys_EmpDataRight._.GCompanyID == this.SessionInfo.CompanyID;
            roleBll.SessionInfo = this.SessionInfo;
            empDataRightList    = this.SelectList <Sys_EmpDataRightResult>(where);
            List <Sys_EmpDataRightResult> editList = new List <Sys_EmpDataRightResult>();

            string[] arrRoleIDs;
            foreach (Sys_EmpDataRightResult info in empDataRightList)
            {
                if (info.RoleIDs.ToStringHasNull().IndexOf("," + param.RoleID + ",") >= 0)
                {
                    arrRoleIDs = info.RoleIDs.Replace("," + param.RoleID + ",", ",").Split(',').Where(a => a.ToStringHasNull().Trim() != "").ToArray();
                    if (arrRoleIDs.Length > 0)
                    {
                        info.RoleNames = roleBll.GetRoleNames(arrRoleIDs.Select(a => (int?)a.ToInt32()).ToArray());
                        info.RoleIDs   = "," + string.Join(",", arrRoleIDs) + ",";
                    }
                    else
                    {
                        info.RoleNames = "";
                        info.RoleIDs   = "";
                    }
                    editList.Add(info);
                }
            }
            if (editList.Count > 0)
            {
                this.BatchInsertOrUpdate(editList);
                this.BatchExecute();
            }
            ret.Key = 1;
            return(ret);
        }
Esempio n. 8
0
        /// <summary>
        /// 获取角色对应员工列表
        /// </summary>
        /// <param name="param">条件参数</param>
        /// <returns></returns>
        public List <HR_EmployeeResult> GetRoleEmpList(Sys_EmpDataRightParam param)
        {
            List <HR_EmployeeResult> ret    = new List <HR_EmployeeResult>();
            HR_EmployeeBLL           empBll = new HR_EmployeeBLL();

            empBll.SessionInfo = this.SessionInfo;
            List <Sys_EmpDataRightResult> empDataRightList = new List <Sys_EmpDataRightResult>();

            WhereClip where = Sys_EmpDataRight._.RoleIDs.Like("%," + param.RoleID + ",%") &&
                              Sys_EmpDataRight._.IsDeleted == false &&
                              Sys_EmpDataRight._.GCompanyID == this.SessionInfo.CompanyID;
            empDataRightList = this.SelectList <Sys_EmpDataRightResult>(where);
            int?[] arrEmpIDs = empDataRightList.Select(a => a.EmpID).ToArray();
            if (arrEmpIDs.Length > 0)
            {
                ret = empBll.GetEmpMainInfoList(new HR_EmployeeParam()
                {
                    EmpIDs = arrEmpIDs
                });
            }
            return(ret);
        }
Esempio n. 9
0
        public WCFAddUpdateResult AddRoleEmpIDs(Sys_EmpDataRightParam param)
        {
            WCFAddUpdateResult ret = new WCFAddUpdateResult();

            if (param.EmpIDs == null || param.EmpIDs.Length <= 0)
            {
                throw new WarnException("请指定员工记录!");
            }
            if (param.RoleID.ToInt32() <= 0)
            {
                throw new WarnException("请指定角色!");
            }
            Sys_EmpDataRightResult        rst = new Sys_EmpDataRightResult();
            List <Sys_EmpDataRightResult> empDataRightList = new List <Sys_EmpDataRightResult>();

            WhereClip where = Sys_EmpDataRight._.EmpID.In(param.EmpIDs) &&
                              Sys_EmpDataRight._.IsDeleted == false &&
                              Sys_EmpDataRight._.GCompanyID == this.SessionInfo.CompanyID;
            empDataRightList = this.SelectList <Sys_EmpDataRightResult>(where);
            List <Sys_EmpDataRightResult> editList = new List <Sys_EmpDataRightResult>();

            foreach (Sys_EmpDataRightResult info in empDataRightList)
            {
                if (info.RoleIDs.ToStringHasNull().IndexOf("," + param.RoleID + ",") >= 0)
                {
                    continue;
                }
                else
                {
                    if (info.RoleIDs.ToStringHasNull().Trim() != "")
                    {
                        info.RoleIDs += param.RoleID + ",";
                        if (!string.IsNullOrEmpty(info.RoleNames))
                        {
                            info.RoleNames += ",";
                        }
                        info.RoleNames += param.RoleName;
                    }
                    else
                    {
                        info.RoleIDs   += "," + param.RoleID + ",";
                        info.RoleNames += param.RoleName;
                    }
                    editList.Add(info);
                }
            }
            if (editList.Count > 0)
            {
                this.BatchInsertOrUpdate(editList); this.BatchExecute();
            }
            int?[] empIDs    = empDataRightList.Select(a => a.EmpID).ToArray();
            int?[] newEmpIDs = param.EmpIDs.Where(a => !empIDs.Contains(a)).ToArray();
            Sys_EmpDataRightResult        newEmpDataRightRst = new Sys_EmpDataRightResult();
            List <Sys_EmpDataRightResult> newList            = new List <Sys_EmpDataRightResult>();

            foreach (int?id in newEmpIDs)
            {
                newEmpDataRightRst            = new Sys_EmpDataRightResult();
                newEmpDataRightRst.GCompanyID = this.SessionInfo.CompanyID;
                newEmpDataRightRst.IsDeleted  = false;
                newEmpDataRightRst.EmpID      = id;
                newEmpDataRightRst.RoleIDs    = "," + param.RoleID.ToStringHasNull() + ",";
                newEmpDataRightRst.RoleNames  = param.RoleName.ToStringHasNull();
                newList.Add(newEmpDataRightRst);
            }
            if (newList.Count > 0)
            {
                this.BatchInsert(newList);
                this.BatchExecute();
            }
            ret.Key = 1;
            return(ret);
        }