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

                ShelfCode_txt.Focus();

                return(false);
            }

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

                ShelfName_txt.Focus();

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

                Area_cmb.Focus();

                return(false);
            }

            return(true);
        }
Example #2
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 AddShelfForm_Load(object sender, EventArgs e)
        {
            FormDatatableFromVo();

            ComboBind(Area_cmb, areaDatatable, "name", "id");

            ShelfCode_txt.Select();

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

                ShelfCode_txt.Enabled = false;

                ShelfName_txt.Select();
            }
        }
Example #3
0
        /// <summary>
        /// update the  record to db
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Ok_btn_Click(object sender, EventArgs e)
        {
            ShelfVo inVo = new ShelfVo();

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

                if (!sch.IsASCII(ShelfCode_txt.Text) || !sch.IsASCII(ShelfName_txt.Text))
                {
                    messageData = new MessageData("mmce00003", Properties.Resources.mmce00003);
                    logger.Info(messageData);
                    popUpMessage.ConfirmationOkCancel(messageData, Text);

                    if (!sch.IsASCII(ShelfCode_txt.Text))
                    {
                        ShelfCode_txt.Focus();
                    }
                    else
                    {
                        ShelfName_txt.Focus();
                    }

                    return;
                }

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

                inVo.ShelfCode = ShelfCode_txt.Text.Trim();

                inVo.ShelfName = ShelfName_txt.Text.Trim();

                inVo.AreaId = Convert.ToInt32(Area_cmb.SelectedValue);

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

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

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

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

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