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

                LocalSupplierCavityCode_txt.Focus();

                return(false);
            }

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

                LocalSupplierCavityName_txt.Focus();

                return(false);
            }

            if (LocalSupplier_cmb.Text == string.Empty || LocalSupplier_cmb.SelectedIndex < 0)
            {
                messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, LocalSupplier_lbl.Text);
                popUpMessage.Warning(messageData, Text);

                LocalSupplier_cmb.Focus();

                return(false);
            }

            return(true);
        }
示例#2
0
        /// <summary>
        /// Loads Mold form
        /// Fill item combobox
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void LocalSupplierCavityForm_Load(object sender, EventArgs e)
        {
            FormDatatableFromVo();

            ComboBind(LocalSupplier_cmb, localSupplierDatatable, "code", "id");

            LocalSupplierCavityCode_txt.Select();

            Update_btn.Enabled = Delete_btn.Enabled = false;
        }
示例#3
0
        /// <summary>
        /// event to clear the controls of search criteria
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Clear_btn_Click(object sender, EventArgs e)
        {
            LocalSupplierCavityCode_txt.Text = string.Empty;

            LocalSupplierCavityName_txt.Text = string.Empty;

            LocalSupplier_cmb.SelectedIndex = -1;

            LocalSupplierCavity_dgv.DataSource = null;

            LocalSupplierCavityCode_txt.Select();

            Delete_btn.Enabled = Update_btn.Enabled = false;
        }
示例#4
0
        /// <summary>
        /// Handles Load event for mold data Insert/Update operations
        /// Loading mold data for update mold data and binding controls with selected mold record
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void AddLocalSupplierCavityForm_Load(object sender, EventArgs e)
        {
            FormDatatableFromVo();

            ComboBind(LocalSupplier_cmb, localSupplierDatatable, "code", "id");

            LocalSupplierCavityCode_txt.Select();

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

                LocalSupplierCavityCode_txt.Enabled = false;

                LocalSupplierCavityName_txt.Select();
            }
        }
示例#5
0
        /// <summary>
        /// update data to db
        /// </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(LocalSupplierCavityCode_txt.Text) || string.IsNullOrEmpty(LocalSupplierCavityName_txt.Text))
                {
                    messageData = new MessageData("mmce00003", Properties.Resources.mmce00003);
                    logger.Info(messageData);
                    popUpMessage.ConfirmationOkCancel(messageData, Text);

                    if (string.IsNullOrEmpty(LocalSupplierCavityCode_txt.Text))
                    {
                        LocalSupplierCavityCode_txt.Focus();
                    }
                    else
                    {
                        LocalSupplierCavityName_txt.Focus();
                    }

                    return;
                }

                LocalSupplierCavityVo inVo = new LocalSupplierCavityVo
                {
                    LocalSupplierCavityCode = LocalSupplierCavityCode_txt.Text.Trim(),
                    LocalSupplierCavityName = LocalSupplierCavityName_txt.Text.Trim(),
                    LocalSupplierId         = Convert.ToInt32(LocalSupplier_cmb.SelectedValue),
                    //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))
                {
                    LocalSupplierCavityVo checkVo = DuplicateCheck(inVo);

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

                        return;
                    }
                }

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

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

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