Ejemplo n.º 1
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);
        }
Ejemplo n.º 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();

            if (CheckMandatory())
            {
                if (!sch.IsASCII(RoleCode_txt.Text))
                {
                    messageData = new MessageData("mmce00003", Properties.Resources.mmce00003);
                    logger.Info(messageData);
                    popUpMessage.ConfirmationOkCancel(messageData, Text);
                    RoleCode_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();
                }
            }
        }