Пример #1
0
        private void checkPerm()
        {
            //agent readonly
            UserPropertiesEntity entity         = UsersBS.LogginedUserProperties;
            UserpropertiesBL     userProperties = new UserpropertiesBL();
            String v = userProperties.getValue(entity, UserpropertiesBL.MENU_AGENT_READ_ONLY_PERMISSION);

            if (v != null && bool.Parse(v))
            {
                _readOnly = true;
            }
        }
Пример #2
0
        private void setPermision()
        {
            if (UsersBS.loginedUser != null && UsersBS.ADMIN.ToString().Equals(UsersBS.loginedUser.get(UsersEntity.FIELD_USER_TYPE).ToString()))
            {
                mnuResivedLetter.Enabled        = true;
                mnuSendLetter.Enabled           = true;
                mnuChequeInfo.Enabled           = true;
                mnuUsers.Enabled                = true;
                mnuBasicInfo.Enabled            = true;
                mnuColorSetting.Enabled         = true;
                mnuCompanies.Enabled            = true;
                mnuServerSetting.Enabled        = true;
                mnuLetterPatternDefine.Enabled  = true;
                MnuUserTree.Enabled             = true;
                mnuAgent.Enabled                = true;
                pnlWorkingStatistic.Visible     = true;
                mnuReferCycleList.Visible       = true;
                LetterListByAnswerCount.Visible = true;
                return;
            }

            UserPropertiesEntity entity         = UsersBS.LogginedUserProperties;
            UserpropertiesBL     userProperties = new UserpropertiesBL();
            bool recievedLetterPerm             = false;
            bool sendLetterPerm          = false;
            bool chequeInfo              = false;
            bool usersPerm               = false;
            bool basicInfoPerm           = false;
            bool companyPerm             = false;
            bool colorPerm               = false;
            bool agentPerm               = false;
            bool workingStatisticPerm    = false;
            bool referenceCycle          = false;
            bool letterListByAnswerCount = false;

            //recieved letters
            string v = userProperties.getValue(entity, UserpropertiesBL.MENU_RECIEVED_PERMISSION);

            if (v != null)
            {
                recievedLetterPerm = bool.Parse(v);
            }
            //send letters
            v = userProperties.getValue(entity, UserpropertiesBL.MENU_SEND_PERMISSION);
            if (v != null)
            {
                sendLetterPerm = bool.Parse(v);
            }
            //Cheque info
            v = userProperties.getValue(entity, UserpropertiesBL.MENU_CHEQUE_INFO);
            if (v != null)
            {
                chequeInfo = bool.Parse(v);
            }
            //users
            v = userProperties.getValue(entity, UserpropertiesBL.MENU_USERS_PERMISSION);
            if (v != null)
            {
                usersPerm = bool.Parse(v);
            }
            //basicInfo
            v = userProperties.getValue(entity, UserpropertiesBL.MENU_BASIC_INFO_PERMISSION);
            if (v != null)
            {
                basicInfoPerm = bool.Parse(v);
            }
            //company
            v = userProperties.getValue(entity, UserpropertiesBL.MENU_COMPANY_PERMISSION);
            if (v != null)
            {
                companyPerm = bool.Parse(v);
            }
            //color
            v = userProperties.getValue(entity, UserpropertiesBL.MENU_COLOR_PERMISSION);
            if (v != null)
            {
                colorPerm = bool.Parse(userProperties.getValue(entity, UserpropertiesBL.MENU_COLOR_PERMISSION));
            }
            //agent
            v = userProperties.getValue(entity, UserpropertiesBL.MENU_AGENT_PERMISSION);
            if (v != null)
            {
                agentPerm = bool.Parse(v);
            }
            //working statistis
            v = userProperties.getValue(entity, UserpropertiesBL.MENU_WORKING_STATISTIC);
            if (v != null)
            {
                workingStatisticPerm = bool.Parse(v);
            }
            //working statistis
            v = userProperties.getValue(entity, UserpropertiesBL.MENU_REFERENCE_CYCLE);
            if (v != null)
            {
                referenceCycle = bool.Parse(v);
            }
            else
            {
                referenceCycle = false;
            }
            //answer count  list
            v = userProperties.getValue(entity, UserpropertiesBL.MENU_LETTER_ANSWER_COUNTLIST);
            if (v != null)
            {
                letterListByAnswerCount = bool.Parse(v);
            }
            else
            {
                letterListByAnswerCount = false;
            }

            mnuResivedLetter.Enabled        = recievedLetterPerm;
            mnuSendLetter.Enabled           = sendLetterPerm;
            mnuChequeInfo.Enabled           = chequeInfo;
            mnuUsers.Enabled                = usersPerm;
            mnuBasicInfo.Enabled            = basicInfoPerm;
            mnuColorSetting.Enabled         = colorPerm;
            mnuCompanies.Enabled            = companyPerm;
            mnuAgent.Enabled                = agentPerm;
            pnlWorkingStatistic.Visible     = workingStatisticPerm;
            mnuReferCycleList.Visible       = referenceCycle;
            LetterListByAnswerCount.Visible = letterListByAnswerCount;

            //disable for all but they are enabled only for admins
            mnuServerSetting.Enabled       = false;
            mnuLetterPatternDefine.Enabled = false;
            MnuUserTree.Enabled            = false;

            /*     if (UsersBS.loginedUser != null && UsersBS.USER.ToString().Equals(UsersBS.loginedUser.get(UsersEntity.FIELD_USER_TYPE).ToString()))
             *   { // کاربر معمولی
             *       mnuResivedLetter.Enabled = false;
             *       mnuSendLetter.Enabled = false;
             *       mnuUsers.Enabled = false;
             *       mnuBasicInfo.Enabled = false;
             *       mnuServerSetting.Enabled = false;
             *       mnuLetterPatternDefine.Enabled = false;
             *       mnuColorSetting.Enabled = false;
             *       mnuCompanies.Enabled = false;
             *   }
             *   else if (UsersBS.loginedUser != null && UsersBS.MASTER_USER.ToString().Equals(UsersBS.loginedUser.get(UsersEntity.FIELD_USER_TYPE).ToString()))
             *   {
             *       mnuUsers.Enabled = false;
             *       mnuBasicInfo.Enabled = false;
             *       mnuServerSetting.Enabled = false;
             *       mnuLetterPatternDefine.Enabled = false;
             *       mnuColorSetting.Enabled = false;
             *       mnuCompanies.Enabled = true;
             *   }
             *   else
             *   {
             *       mnuResivedLetter.Enabled = true;
             *       mnuSendLetter.Enabled = true;
             *       mnuUsers.Enabled = true;
             *       mnuBasicInfo.Enabled = true;
             *       mnuServerSetting.Enabled = true;
             *       mnuLetterPatternDefine.Enabled = true;
             *       mnuColorSetting.Enabled = true;
             *       mnuCompanies.Enabled = true;
             *
             *   }*/
        }
Пример #3
0
        private void load()
        {
            UserPropertiesEntity entity = _userProperties.get(_userid);
            bool recievedLetterPerm     = false;
            bool sendLetterPerm         = false;
            bool chequeInfo             = false;
            bool usersPerm             = false;
            bool basicInfoPerm         = false;
            bool companyPerm           = false;
            bool companyPermReadOnly   = false;
            bool colorPerm             = false;
            bool agentPerm             = false;
            bool agentPermReadOnly     = false;
            bool workingStatistic      = false;
            bool referenceCycle        = false;
            bool letterAnswerCountList = false;

            //recieved letters
            string v = _userProperties.getValue(entity, UserpropertiesBL.MENU_RECIEVED_PERMISSION);

            if (v != null)
            {
                recievedLetterPerm = bool.Parse(v);
            }
            //send letters
            v = _userProperties.getValue(entity, UserpropertiesBL.MENU_SEND_PERMISSION);
            if (v != null)
            {
                sendLetterPerm = bool.Parse(v);
            }
            //cheque info
            v = _userProperties.getValue(entity, UserpropertiesBL.MENU_CHEQUE_INFO);
            if (v != null)
            {
                chequeInfo = bool.Parse(v);
            }
            //users
            v = _userProperties.getValue(entity, UserpropertiesBL.MENU_USERS_PERMISSION);
            if (v != null)
            {
                usersPerm = bool.Parse(v);
            }
            //basicInfo
            v = _userProperties.getValue(entity, UserpropertiesBL.MENU_BASIC_INFO_PERMISSION);
            if (v != null)
            {
                basicInfoPerm = bool.Parse(v);
            }
            //company
            v = _userProperties.getValue(entity, UserpropertiesBL.MENU_COMPANY_PERMISSION);
            if (v != null)
            {
                companyPerm = bool.Parse(v);
            }
            //company readOnly
            v = _userProperties.getValue(entity, UserpropertiesBL.MENU_COMPANY_READ_ONLY_PERMISSION);
            if (v != null)
            {
                companyPermReadOnly = bool.Parse(v);
            }
            //color
            v = _userProperties.getValue(entity, UserpropertiesBL.MENU_COLOR_PERMISSION);
            if (v != null)
            {
                colorPerm = bool.Parse(_userProperties.getValue(entity, UserpropertiesBL.MENU_COLOR_PERMISSION));
            }
            //agent
            v = _userProperties.getValue(entity, UserpropertiesBL.MENU_AGENT_PERMISSION);
            if (v != null)
            {
                agentPerm = bool.Parse(v);
            }
            //agent read Only
            v = _userProperties.getValue(entity, UserpropertiesBL.MENU_AGENT_READ_ONLY_PERMISSION);
            if (v != null)
            {
                agentPermReadOnly = bool.Parse(v);
            }
            //workingStatistic
            v = _userProperties.getValue(entity, UserpropertiesBL.MENU_WORKING_STATISTIC);
            if (v != null)
            {
                workingStatistic = bool.Parse(v);
            }

            //ReferenceCycle
            v = _userProperties.getValue(entity, UserpropertiesBL.MENU_REFERENCE_CYCLE);
            if (v != null)
            {
                referenceCycle = bool.Parse(v);
            }

            //Letter Answer Count List
            v = _userProperties.getValue(entity, UserpropertiesBL.MENU_LETTER_ANSWER_COUNTLIST);
            if (v != null)
            {
                letterAnswerCountList = bool.Parse(v);
            }

            cbRecievedLetter.Checked        = recievedLetterPerm;
            cbSendLetter.Checked            = sendLetterPerm;
            cbCheckInfo.Checked             = chequeInfo;
            cbUsers.Checked                 = usersPerm;
            cbBasicInfo.Checked             = basicInfoPerm;
            cbCompanies.Checked             = companyPerm;
            cbCompaniesReadOnly.Checked     = companyPermReadOnly;
            cbColors.Checked                = colorPerm;
            cbAgent.Checked                 = agentPerm;
            cbAgentsReadOnly.Checked        = agentPermReadOnly;
            cbWorkingStatistic.Checked      = workingStatistic;
            cbReferenceCycle.Checked        = referenceCycle;
            cbLetterAnswerCountList.Checked = letterAnswerCountList;
        }