Пример #1
0
        /// <summary>
        /// Checks mandatory fields
        /// </summary>
        /// <returns></returns>
        private bool CheckMandatory()
        {
            if (LocalSupplierCode_txt.Text == string.Empty)
            {
                messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, LocalSupplierCode_lbl.Text);
                popUpMessage.Warning(messageData, Text);

                LocalSupplierCode_txt.Focus();

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

                LocalSupplierName_txt.Focus();

                return(false);
            }

            return(true);
        }
Пример #2
0
        /// <summary>
        /// inserts/updates process on ok click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Ok_btn_Click(object sender, EventArgs e)
        {
            if (CheckMandatory())
            {
                var sch = StringCheckHelper.GetInstance();

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

                    if (string.IsNullOrEmpty(LocalSupplierCode_txt.Text))
                    {
                        LocalSupplierCode_txt.Focus();
                    }
                    else
                    {
                        LocalSupplierName_txt.Focus();
                    }

                    return;
                }

                LocalSupplierVo inVo = new LocalSupplierVo
                {
                    LocalSupplierCode = LocalSupplierCode_txt.Text.Trim(),
                    LocalSupplierName = LocalSupplierName_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))
                {
                    LocalSupplierVo checkVo = DuplicateCheck(inVo);

                    if (checkVo != null && checkVo.AffectedCount > 0)
                    {
                        messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, LocalSupplierCode_lbl.Text + " : " + LocalSupplierCode_txt.Text);
                        logger.Info(messageData);
                        popUpMessage.ApplicationError(messageData, Text);

                        return;
                    }
                }

                try
                {
                    if (string.Equals(mode, CommonConstants.MODE_ADD))
                    {
                        LocalSupplierVo outVo = (LocalSupplierVo)base.InvokeCbm(new AddLocalSupplierMasterMntCbm(), inVo, false);

                        IntSuccess = outVo.AffectedCount;
                    }
                    else if (mode.Equals(CommonConstants.MODE_UPDATE))
                    {
                        inVo.LocalSupplierId = updateData.LocalSupplierId;

                        LocalSupplierVo outVo = (LocalSupplierVo)base.InvokeCbm(new UpdateLocalSupplierMasterMntCbm(), 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();
                }
            }
        }