예제 #1
0
        /// <summary>
        /// 设置保存操作按钮enable属性
        /// </summary>
        /// <param name="form_name"></param>
        protected void SetModulePurview(string form_name)
        {
            try
            {
                //去掉Frm
                string module_code = form_name.Substring(3, form_name.Length - 3);
                if (module_code.ToLower().IndexOf("edit") > -1)
                {
                    module_code = module_code.Substring(0, module_code.Length - 4);
                }

                char[] mychar = MenuClass.GetPurviewCharArray(AppSetting.SysOption.Purview, module_code);
                if (mychar.Length <= 2)
                {
                    this.btnAddAndSave.Enabled = false;
                    this.btnSave.Enabled       = false;
                    return;
                }
                this.btnAddAndSave.Enabled = (mychar[0] == 'Y' ? true : false);
                this.btnSave.Enabled       = (mychar[1] == 'Y' ? true : false);
                this.btnPrint.Enabled      = (mychar[3] == 'Y' ? true : false);
            }
            catch (Exception ex)
            {
                Error.ErrorMsg(ex);
            }
        }
예제 #2
0
        /// <summary>
        /// 显示一个用户所有权限
        /// </summary>
        /// <param name="strPurview"></param>
        private void SetPurview(string strPurview)
        {
            for (int i = 0; i < this.ucdgv.Rows.Count; i++)
            {
                for (int ii = 0; ii < 5; ii++)
                {
                    this.ucdgv.Rows[i].Cells[ii + 2].Value = false;
                }
            }

            if (string.IsNullOrEmpty(strPurview))
            {
                return;
            }

            string module_code;

            for (int i = 0; i < this.ucdgv.Rows.Count; i++)
            {
                module_code = Convert.ToString(this.ucdgv.Rows[i].Cells[0].EditedFormattedValue.ToString());
                char[] tmpChar = MenuClass.GetPurviewCharArray(strPurview, module_code);

                for (int ii = 0; ii < tmpChar.Length; ii++)
                {
                    this.ucdgv.Rows[i].Cells[ii + 2].Value = tmpChar[ii] == 'Y'?true:false;
                }
            }
        }
예제 #3
0
 /// <summary>
 /// 根据用户权限设置各按钮Enabled
 /// </summary>
 /// <param name="form_name"></param>
 protected void SetModulePurview(string form_name)
 {
     try
     {
         string module_code = form_name.Substring(3, form_name.Length - 3);
         char[] mychar      = MenuClass.GetPurviewCharArray(AppSetting.SysOption.Purview, module_code);
         if (mychar.Length == 0)
         {
             this.pageDataGridViewEx1.SetNavButtonEnabled(false, false, false, false, false);
             return;
         }
         this.pageDataGridViewEx1.ucAdd.Enabled    = (mychar[0] == 'Y' ? true : false);
         this.pageDataGridViewEx1.ucEdit.Enabled   = (mychar[1] == 'Y' ? true : false);
         this.pageDataGridViewEx1.ucDelete.Enabled = (mychar[2] == 'Y' ? true : false);
         this.pageDataGridViewEx1.ucPrint.Enabled  = (mychar[3] == 'Y' ? true : false);
         this.pageDataGridViewEx1.ucExport.Enabled = (mychar[4] == 'Y' ? true : false);
     }
     catch (Exception ex)
     {
         Error.ErrorMsg(ex);
     }
 }