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

                AreaCode_txt.Focus();

                return(false);
            }

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

                AreaName_txt.Focus();

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

                Location_cmb.Focus();

                return(false);
            }

            return(true);
        }
Ejemplo n.º 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 AddAreaForm_Load(object sender, EventArgs e)
        {
            FormDatatableFromVo();

            ComboBind(Location_cmb, locationDatatable, "name", "id");

            AreaCode_txt.Select();

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

                AreaCode_txt.Enabled = false;

                AreaName_txt.Select();
            }
        }
Ejemplo n.º 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)
        {
            AreaVo inVo = new AreaVo();

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

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

                    if (!sch.IsASCII(AreaCode_txt.Text))
                    {
                        AreaCode_txt.Focus();
                    }
                    else
                    {
                        AreaName_txt.Focus();
                    }

                    return;
                }

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

                inVo.AreaCode = AreaCode_txt.Text.Trim();

                inVo.AreaName = AreaName_txt.Text.Trim();

                inVo.LocationId = Convert.ToInt32(Location_cmb.SelectedValue);

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

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

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

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

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