Ejemplo n.º 1
0
        public PageList <Sys_EmpRightResult> GetPageList(Sys_EmpRightParam param)
        {
            ExeResult rst = new ExeResult();

            rst = this.Execute("ZNLCRM.BLL.Sys.Sys_EmpRightBLL", "GetPageList", param);
            PageList <Sys_EmpRightResult> pageList = (rst == null ? new PageList <Sys_EmpRightResult>() : (PageList <Sys_EmpRightResult>)rst.Result);

            return(pageList);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 获取员工的操作权限
        /// </summary>
        /// <param name="param"></param>
        /// <returns></returns>
        public PageList <Sys_EmpRightResult> GetPageList(Sys_EmpRightParam param)
        {
            this.CheckSession();
            PageList <Sys_EmpRightResult> pagelist = new PageList <Sys_EmpRightResult>();

            try
            {
                WhereClip whereClip = WhereClip.All;//
                if (param.IsNoAction)
                {
                    whereClip = whereClip && Sys_EmpRight._.ActionCode.IsNull();
                }
                else
                {
                    whereClip = GetWhereClip(param);
                }
                if (param.MenuID > 0)
                {
                    whereClip = whereClip && Sys_Module._.MenuID.At("b") == param.MenuID;
                }
                if (!string.IsNullOrEmpty(param.ModuleName))
                {
                    whereClip = whereClip && Sys_Module._.ModuleName.At("b").Like("%" + param.ModuleName + "%");
                }

                List <Field> fiels = new List <Field>()
                {
                    Sys_EmpRight._.EmpRightID,
                    Sys_EmpRight._.EmpID,
                    Sys_Module._.ModuleID.At("b"),
                    Sys_EmpRight._.ActionCode,
                    Sys_Module._.ModuleName.At("b"),
                    Sys_Module._.ModuleCode.At("b"),
                    Sys_Module._.MenuID.At("b"),
                    Sys_Module._.ActionCode.At("b").As("BaseActionCode")
                };
                WhereClip onWhereClip = Sys_EmpRight._.ModuleID == Sys_Module._.ModuleID.At("b");
                pagelist = this.SelectList <Sys_EmpRightResult, Sys_Module>(JoinType.RightJoin, onWhereClip, param.PageIndex.GetValueOrDefault(1), param.PageSize.GetValueOrDefault(50), fiels, whereClip, Sys_Module._.ModuleCode.At("b").Asc, null, null);
                pagelist.ResultJoinList.Columns.Add("RightName");
            }
            catch (WarnException exp)
            {
                throw exp;
            }
            catch (System.Exception exp)
            {
                LogInfoBLL.WriteLog(this.SessionInfo, exp);
                throw exp;
            }
            return(pagelist);
        }
Ejemplo n.º 3
0
 WhereClip GetWhereClip(Sys_EmpRightParam param)
 {
     this.CheckSession();
     WhereClip where = Sys_EmpRight._.IsDeleted == false;
     if (param.EmpRightID > 0)
     {
         where = where && Sys_EmpRight._.EmpRightID == param.EmpRightID;
     }
     if (param.EmpID > 0)
     {
         where = where && Sys_EmpRight._.EmpID == param.EmpID;
     }
     if (param.ModuleID > 0)
     {
         where = where && Sys_EmpRight._.ModuleID == param.ModuleID;
     }
     return(where);
 }
Ejemplo n.º 4
0
        public int SaveEmpRight(Sys_EmpRightParam param)
        {
            this.CheckSession();
            int ret = 0;

            if (param.EmpID.ToInt32() <= 0)
            {
                throw new WarnException("请指定员工!");
            }
            List <Sys_EmpRightResult> lstEmpRight = new List <Sys_EmpRightResult>();

            lstEmpRight = this.SelectList <Sys_EmpRightResult>(Sys_EmpRight._.EmpID == param.EmpID && Sys_EmpRight._.IsDeleted == false);
            List <Sys_EmpRightResult> lstEditEmpRight = param.EmpRightList;

            if (lstEditEmpRight == null)
            {
                lstEditEmpRight = new List <Sys_EmpRightResult>();
            }

            List <Sys_EmpRightResult> lstNewEmpRight    = lstEditEmpRight.Where(a => !lstEmpRight.Exists(b => b.ModuleID == a.ModuleID)).Distinct().ToList();
            List <Sys_EmpRightResult> lstModifyEmpRight = lstEditEmpRight.Where(a => lstEmpRight.Exists(b => b.ModuleID == a.ModuleID)).Distinct().ToList();
            List <Sys_EmpRightResult> lstDelEmpRight    = lstEmpRight.Where(a => !lstEditEmpRight.Exists(b => b.ModuleID == a.ModuleID)).Distinct().ToList();

            if (lstNewEmpRight.Count > 0)
            {
                this.BatchInsertOrUpdate <Sys_EmpRightResult>(lstNewEmpRight);
            }
            if (lstModifyEmpRight.Count > 0)
            {
                this.BatchInsertOrUpdate <Sys_EmpRightResult>(lstModifyEmpRight);
            }
            if (lstDelEmpRight.Count > 0)
            {
                this.BatchDelete <Sys_EmpRightResult>(lstDelEmpRight);
            }
            ret = this.BatchExecute();

            return(ret);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnSaveEditModule_Click(object sender, EventArgs e)
        {
            Sys_EmpRightParam param = new Sys_EmpRightParam();

            param.ModuleID = Convert.ToInt32(ModuleID);
            param.EmpID    = Convert.ToInt32(EmpID);
            //param.GCompanyID = Guid.NewGuid();  //当前公司的Guid
            param.ActionCode = GetEmpModuleOperation();
            //ExeResult res = new Sys_EmpRightLogic().UpdataModuleOperation(param);
            //if (res.Complete == ExeComplete.Succeed)
            //{
            //    //ShowMessage("保存数据成功!");
            //    if (refreshPeantHandler != null)
            //    {
            //        refreshPeantHandler();
            //        this.Close();
            //    }
            //}
            //else
            //{
            //    ShowMessage(res.DebugMsg);
            //}
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 绑定数据源
        /// </summary>
        /// <param name="dgv"></param>
        /// <param name="tr"></param>
        /// <param name="page"></param>
        private void BindDataGridView(int pageIndex)
        {
            panelShowRight.Hide();
            if (adtMenu.SelectedNode == null)
            {
                return;
            }


            List <Sys_MenuResult> lstRst = new List <Sys_MenuResult>();
            Sys_EmpRightParam     param  = new Sys_EmpRightParam();

            param.EmpID      = _empID;
            param.PageIndex  = pageIndex;
            param.PageSize   = 50;
            param.MenuID     = adtMenu.SelectedNode.Name.Substring(3).ToInt32();
            param.ModuleName = txtModuleName.Text.Trim();
            param.IsNoAction = cboIsNoSet.Checked;
            PageList <Sys_EmpRightResult> pgList = rightLogic.GetPageList(param);

            if (pgList.ResultJoinList != null && pgList.ResultJoinList.Rows.Count > 0)
            {
                foreach (DataRow row in pgList.ResultJoinList.Rows)
                {
                    string actionCode = row["ActionCode"].ToStringHasNull();
                    if (string.IsNullOrEmpty(actionCode))
                    {
                        continue;
                    }
                    row["RightName"] = GetRightName(actionCode);
                }
                dgvModule.DataSource   = pgList.ResultJoinList;
                pgEmpRight.RecordCount = pgList.TotalCount;
                pgEmpRight.Refresh();
            }
        }