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

                CavityCode_txt.Focus();

                return(false);
            }

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

                CavityName_txt.Focus();

                return(false);
            }
            if (Mold_cmb.Text == string.Empty || Mold_cmb.SelectedIndex < 0)
            {
                messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, Mold_lbl.Text);
                popUpMessage.Warning(messageData, Text);

                Mold_cmb.Focus();

                return(false);
            }

            return(true);
        }
Esempio n. 2
0
        /// <summary>
        /// Loads Mold form
        /// Fill item combobox
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CavityForm_Load(object sender, EventArgs e)
        {
            FormDatatableFromVo();

            ComboBind(Mold_cmb, moldDatatable, "code", "id");

            CavityCode_txt.Select();

            Update_btn.Enabled = Delete_btn.Enabled = false;
        }
Esempio n. 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)
        {
            CavityCode_txt.Text = string.Empty;

            CavityName_txt.Text = string.Empty;

            Mold_cmb.SelectedIndex = -1;

            Cavity_dgv.DataSource = null;

            CavityCode_txt.Select();
            Update_btn.Enabled = Delete_btn.Enabled = false;
        }
Esempio n. 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 AddCavityForm_Load(object sender, EventArgs e)
        {
            FormDatatableFromVo();

            ComboBind(Mold_cmb, moldDatatable, "code", "id");

            CavityCode_txt.Select();

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

                CavityCode_txt.Enabled = false;

                CavityName_txt.Select();
            }
        }
Esempio n. 5
0
        /// <summary>
        /// update the  record to db
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected virtual void Ok_btn_Click(object sender, EventArgs e)
        {
            CavityVo inVo = new CavityVo();

            if (CheckMandatory())
            {
                var sch = StringCheckHelper.GetInstance();

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

                    if (string.IsNullOrEmpty(CavityCode_txt.Text))
                    {
                        CavityCode_txt.Focus();
                    }
                    else
                    {
                        CavityName_txt.Focus();
                    }

                    return;
                }

                if (CavityCode_txt.Text.Trim().Length < 4)
                {
                    MessageData messageData = new MessageData("mmci00008", Properties.Resources.mmci00008, CavityCode_lbl.Text);
                    popUpMessage.Warning(messageData, Text);
                    CavityCode_txt.Focus();
                    return;
                }

                inVo.CavityCode = CavityCode_txt.Text.Trim();

                inVo.CavityName = CavityName_txt.Text.Trim();

                inVo.MoldId = Convert.ToInt32(Mold_cmb.SelectedValue);

                //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))
                {
                    CavityVo checkVo = DuplicateCheck(inVo);

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

                        return;
                    }
                }

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

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

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