Exemple #1
0
        /// <summary>
        /// load the screen with data
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RoleAuthorityControlForm_Load(object sender, EventArgs e)
        {
            Cursor.Current = Cursors.WaitCursor;
            BindTreeView();
            Cursor.Current = Cursors.Default;
            RoleName_txt.Select();

            //if (IsAdminUser())
            //{
            //foreach (TreeNode tn in RoleAuthorityDetails_tv.Nodes)
            //{
            //    if (tn.Level == 0 && tn.Tag.Equals(ADMIN))
            //    {
            //        tn.HideCheckBox();

            //        foreach (TreeNode sub1 in tn.Nodes)
            //        {
            //            sub1.HideCheckBox();

            //            foreach (TreeNode sub2 in sub1.Nodes)
            //            {
            //                sub2.HideCheckBox();

            //                foreach (TreeNode sub3 in sub2.Nodes)
            //                {
            //                    sub3.HideCheckBox();
            //                }
            //            }
            //        }
            //    }
            //}
            //}
        }
Exemple #2
0
        /// <summary>
        /// form load event , loads role data
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddRoleForm_Load(object sender, EventArgs e)
        {
            RoleCode_txt.Select();

            if (string.Equals(mode, CommonConstants.MODE_UPDATE))
            {
                LoadUserData(updateData);

                RoleCode_txt.Enabled = false;
                RoleName_txt.Select();
            }
        }
Exemple #3
0
        /// <summary>
        /// Checks mandatory fields
        /// </summary>
        /// <returns></returns>
        private bool CheckMandatory()
        {
            if (RoleCode_txt.Text == string.Empty)
            {
                messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, RoleCode_lbl.Text);
                popUpMessage.Warning(messageData, Text);

                RoleCode_txt.Focus();

                return(false);
            }
            if (RoleName_txt.Text == string.Empty)
            {
                messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, RoleName_lbl.Text);
                popUpMessage.Warning(messageData, Text);

                RoleName_txt.Focus();

                return(false);
            }
            return(true);
        }
Exemple #4
0
        /// <summary>
        /// update data to db
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Ok_btn_Click(object sender, EventArgs e)
        {
            var sch = StringCheckHelper.GetInstance();

            if (CheckMandatory())
            {
                if (string.IsNullOrEmpty(RoleCode_txt.Text) || string.IsNullOrEmpty(RoleName_txt.Text))
                {
                    messageData = new MessageData("mmce00003", Properties.Resources.mmce00003);
                    logger.Info(messageData);
                    popUpMessage.ConfirmationOkCancel(messageData, Text);

                    if (string.IsNullOrEmpty(RoleCode_txt.Text))
                    {
                        RoleCode_txt.Focus();
                    }
                    else
                    {
                        RoleName_txt.Focus();
                    }
                    return;
                }
                RoleVo inVo = new RoleVo
                {
                    RoleCode = RoleCode_txt.Text.Trim(),
                    RoleName = RoleName_txt.Text.Trim(),
                    //RegistrationDateTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"),
                    RegistrationUserCode = UserData.GetUserData().UserCode,
                    FactoryCode          = UserData.GetUserData().FactoryCode
                };

                if (string.Equals(mode, CommonConstants.MODE_ADD))
                {
                    RoleVo checkVo = DuplicateCheck(inVo);

                    if (checkVo != null && checkVo.AffectedCount > 0)
                    {
                        messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, RoleCode_lbl.Text + " : " + RoleCode_txt.Text);
                        popUpMessage.Information(messageData, Text);
                        return;
                    }
                }

                try
                {
                    if (string.Equals(mode, CommonConstants.MODE_ADD))
                    {
                        RoleVo outVo = (RoleVo)base.InvokeCbm(new AddRoleMasterMntCbm(), inVo, false);
                        IntSuccess = outVo.AffectedCount;
                    }
                    else if (string.Equals(mode, CommonConstants.MODE_UPDATE))
                    {
                        RoleVo outVo = (RoleVo)base.InvokeCbm(new UpdateRoleMasterMntCbm(), inVo, false);
                        IntSuccess = outVo.AffectedCount;
                    }
                }
                catch (Framework.ApplicationException exception)
                {
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    logger.Error(exception.GetMessageData());
                    return;
                }

                if ((IntSuccess > 0) || (IntSuccess == 0))
                {
                    this.Close();
                }
            }
        }