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

                InspectionProcessName_txt.Focus();

                return(false);
            }

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

            //    InspectionFormat_cmb.Focus();

            //    return false;
            //}

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

                InspectionProcessDisplayOrder_txt.Focus();

                return(false);
            }

            return(true);
        }
Example #2
0
        /// <summary>
        /// inserts new record
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Ok_btn_Click(object sender, EventArgs e)
        {
            InspectionProcessVo inVo = new InspectionProcessVo();
            var sch = StringCheckHelper.GetInstance();

            if (CheckMandatory() == true)
            {
                if (string.IsNullOrEmpty(InspectionProcessCode_txt.Text) || string.IsNullOrEmpty(InspectionProcessName_txt.Text))
                {
                    messageData = new MessageData("mmce00003", Properties.Resources.mmce00003);
                    logger.Info(messageData);
                    popUpMessage.ConfirmationOkCancel(messageData, Text);

                    if (string.IsNullOrEmpty(InspectionProcessCode_txt.Text))
                    {
                        InspectionProcessCode_txt.Focus();
                    }
                    else if (string.IsNullOrEmpty(InspectionProcessName_txt.Text))
                    {
                        InspectionProcessName_txt.Focus();
                    }
                    return;
                }
                inVo.InspectionProcessCode = InspectionProcessCode_txt.Text.Trim();

                inVo.InspectionProcessName = InspectionProcessName_txt.Text.Trim();

                inVo.InspectionFormatId = Convert.ToInt32(InspectionFormat_cmb.SelectedValue.ToString());

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

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

                        return;
                    }
                }

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

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

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