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

                FactoryCode_txt.Focus();

                return(false);
            }

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

                FactoryName_txt.Focus();

                return(false);
            }

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

            FactoryVo inVo = new FactoryVo();

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

                    if (string.IsNullOrEmpty(FactoryCode_txt.Text))
                    {
                        FactoryCode_txt.Focus();
                    }
                    else
                    {
                        FactoryName_txt.Focus();
                    }
                    return;
                }

                inVo.FactoryCode = FactoryCode_txt.Text.Trim();
                inVo.FactoryName = FactoryName_txt.Text.Trim();
                //inVo.RegistrationDateTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss");
                inVo.RegistrationUserCode = UserData.GetUserData().UserCode;

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

                    if (checkVo != null && checkVo.AffectedCount > 0)
                    {
                        messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, FactoryCode_lbl.Text + " : " + FactoryCode_txt.Text);
                        logger.Info(messageData);
                        popUpMessage.ConfirmationOkCancel(messageData, Text);
                        return;
                    }
                }

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