Beispiel #1
0
        /// <summary>
        /// Checks mandatory fields
        /// </summary>
        /// <returns></returns>
        private bool CheckMandatory()
        {
            if (AuthorityControlCode_txt.Text == string.Empty)
            {
                messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, AuthorityControlCode_lbl.Text);
                popUpMessage.Warning(messageData, Text);

                AuthorityControlCode_txt.Focus();

                return(false);
            }

            if (AuthorityControlName_txt.Text == string.Empty)
            {
                messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, AuthorityControlName_lbl.Text);
                popUpMessage.Warning(messageData, Text);

                AuthorityControlName_txt.Focus();

                return(false);
            }

            //if (AssemblyName_txt.Text == string.Empty)
            //{
            //    MessageData messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, "Assembly Name");
            //    _popUpMessage.ConfirmationOkCancel(messageData, Text);

            //    AssemblyName_txt.Focus();

            //    return false;
            //}

            return(true);
        }
Beispiel #2
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();

            AuthorityControlVo inVo = new AuthorityControlVo();

            if (CheckMandatory())
            {
                if (!sch.IsSmallAlphabetOrNumeric(AuthorityControlCode_txt.Text))
                {
                    messageData = new MessageData("mmce00006", Properties.Resources.mmce00006, AuthorityControlCode_lbl.Text);
                    logger.Info(messageData);
                    popUpMessage.ConfirmationOkCancel(messageData, Text);
                    AuthorityControlCode_txt.Focus();
                    return;
                }
                if (string.IsNullOrEmpty(AuthorityControlName_txt.Text))
                {
                    messageData = new MessageData("mmce00003", Properties.Resources.mmce00003);
                    logger.Info(messageData);
                    popUpMessage.ConfirmationOkCancel(messageData, Text);
                    AuthorityControlName_txt.Focus();
                    return;
                }
                inVo.AuthorityControlCode = AuthorityControlCode_txt.Text.Trim();

                inVo.AuthorityControlName = AuthorityControlName_txt.Text.Trim();

                if (ParentControl_cmb.SelectedIndex > -1)
                {
                    inVo.ParentControlCode = ParentControl_cmb.SelectedValue.ToString();
                }
                //inVo.AssemblyName = AssemblyName_txt.Text;

                //inVo.FormName = FormName_txt.Text;

                //inVo.RegistrationDateTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");

                inVo.RegistrationUserCode = UserData.GetUserData().UserCode;

                //inVo.FactoryCode = UserData.GetUserData().FactoryCode;

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

                    if (checkVo != null && checkVo.AffectedCount > 0)
                    {
                        messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, AuthorityControlCode_lbl.Text + " : " + AuthorityControlCode_txt.Text);
                        popUpMessage.ConfirmationOkCancel(messageData, Text);

                        return;
                    }
                }

                try
                {
                    if (string.Equals(mode, CommonConstants.MODE_ADD))
                    {
                        AuthorityControlVo outVo = (AuthorityControlVo)base.InvokeCbm(new AddAuthorityControlMasterMntCbm(), inVo, false);
                        IntSuccess = outVo.AffectedCount;
                    }
                    else if (string.Equals(mode, CommonConstants.MODE_UPDATE))
                    {
                        AuthorityControlVo outVo = (AuthorityControlVo)base.InvokeCbm(new UpdateAuthorityControlMasterMntCbm(), 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();
                }
            }
        }