Пример #1
0
        /// <summary>
        /// Checks mandatory fields
        /// </summary>
        /// <returns></returns>
        private bool CheckMandatory()
        {
            if (InspectionSpecificationCode_txt.Text == string.Empty)
            {
                messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, InspectionSpecificationCode_lbl.Text);
                popUpMessage.Warning(messageData, Text);

                InspectionSpecificationCode_txt.Focus();

                return(false);
            }

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

                InspectionSpecificationText_txt.Focus();

                return(false);
            }

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

                ValueFrom_txt.Focus();

                return(false);
            }

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

                InspectionItem_cmb.Focus();

                return(false);
            }

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

                SpecificationResultJudgeType_cmb.Focus();

                return(false);
            }

            return(true);
        }
Пример #2
0
        /// <summary>
        /// Checks mandatory fields
        /// </summary>
        /// <returns></returns>
        private bool CheckMandatory()
        {
            if (InspectionSpecificationText_txt.Text == string.Empty)
            {
                messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, InspectionSpecificationText_lbl.Text);
                popUpMessage.Warning(messageData, Text);

                InspectionSpecificationText_txt.Focus();

                return(false);
            }
            if (Operator_cmb.SelectedIndex < 0 && (InspectionItemDataType == Convert.ToInt32(GlobalMasterDataTypeEnum.DATATYPE_DATETIME.GetValue()) ||
                                                   InspectionItemDataType == Convert.ToInt32(GlobalMasterDataTypeEnum.DATATYPE_NUMBER.GetValue()) ||
                                                   InspectionItemDataType == Convert.ToInt32(GlobalMasterDataTypeEnum.DATATYPE_DECIMAL.GetValue())))
            {
                messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, OperatorFrom_lbl.Text);
                popUpMessage.Warning(messageData, Text);

                Operator_cmb.Focus();

                return(false);
            }
            if (InspectionItemDataType == Convert.ToInt32(GlobalMasterDataTypeEnum.DATATYPE_NUMBER.GetValue()))
            {
                string value_name = string.Empty;
                try
                {
                    value_name         = ValueFrom_lbl.Text;
                    ValueFrom_txt.Text = Convert.ToInt32(ValueFrom_txt.Text).ToString();
                    if (!string.IsNullOrEmpty(ValueTo_txt.Text.Trim()))
                    {
                        value_name       = ValueTo_lbl.Text;
                        ValueTo_txt.Text = Convert.ToInt32(ValueTo_txt.Text).ToString();
                    }
                }
                catch (Exception ex)
                {
                    messageData = new MessageData("mmce00010", Properties.Resources.mmce00010, value_name);
                    popUpMessage.Warning(messageData, Text);
                    ValueFrom_txt.Focus();
                    return(false);
                }
            }
            if (InspectionItemDataType != Convert.ToInt32(GlobalMasterDataTypeEnum.DATATYPE_DATETIME.GetValue()) && string.IsNullOrEmpty(ValueFrom_txt.Text))
            {
                messageData = new MessageData("mmce00002", Properties.Resources.mmce00002, ValueFrom_lbl.Text);
                popUpMessage.Warning(messageData, Text);

                Operator_cmb.Focus();

                return(false);
            }
            if (InspectionItemDataType == Convert.ToInt32(GlobalMasterDataTypeEnum.DATATYPE_DATETIME.GetValue()) &&
                DateTo_dtp.Enabled == true && DateTo_dtp.Value < DateFrom_dtp.Value)
            {
                messageData = new MessageData("mmci00030", Properties.Resources.mmci00030);
                popUpMessage.Warning(messageData, Text);

                Operator_cmb.Focus();

                return(false);
            }
            if (ValueFrom_txt.Text != string.Empty && Convert.ToInt32(Operator_cmb.SelectedIndex) == 0)
            {
                if (!string.IsNullOrEmpty(ValueTo_txt.Text) && Convert.ToDecimal("0" + ValueTo_txt.Text) <= Convert.ToDecimal(ValueFrom_txt.Text))
                {
                    messageData = new MessageData("mmce00010", Properties.Resources.mmce00010, ValueTo_lbl.Text);
                    popUpMessage.Warning(messageData, Text);

                    ValueTo_txt.Focus();

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

            //    InspectionItem_cmb.Focus();

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

                SpecificationResultJudgeType_cmb.Focus();

                return(false);
            }
            return(true);
        }
Пример #3
0
        /// <summary>
        /// inserts new record
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Ok_btn_Click(object sender, EventArgs e)
        {
            InspectionSpecificationVo inVo = new InspectionSpecificationVo();
            var sch = StringCheckHelper.GetInstance();

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

                    if (string.IsNullOrEmpty(InspectionSpecificationCode_txt.Text))
                    {
                        InspectionSpecificationCode_txt.Focus();
                    }
                    else if (string.IsNullOrEmpty(InspectionSpecificationText_txt.Text))
                    {
                        InspectionSpecificationText_txt.Focus();
                    }
                    return;
                }

                if (string.Equals(mode, CommonConstants.MODE_SELECT))
                {
                    if (InspectionSpecificationCode_txt.Text == updateData.InspectionSpecificationCode)
                    {
                        messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, InspectionSpecificationCode_lbl.Text + " : " + InspectionSpecificationCode_txt.Text);
                        logger.Info(messageData);
                        popUpMessage.ConfirmationOkCancel(messageData, Text);

                        return;
                    }
                    if (InspectionSpecificationText_txt.Text == updateData.InspectionSpecificationText)
                    {
                        messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, InspectionSpecificationText_lbl.Text + " : " + InspectionSpecificationText_txt.Text);
                        logger.Info(messageData);
                        popUpMessage.ConfirmationOkCancel(messageData, Text);

                        return;
                    }
                }

                inVo.InspectionSpecificationCode = InspectionSpecificationCode_txt.Text.Trim();

                inVo.InspectionSpecificationText = InspectionSpecificationText_txt.Text.Trim();

                // inVo.ValueFrom = Convert.ToDecimal(ValueFrom_txt.Text.Trim());

                if (!string.IsNullOrWhiteSpace(ValueTo_txt.Text.Trim()))
                {
                    //  inVo.ValueTo = Convert.ToDecimal(ValueTo_txt.Text.Trim());
                }

                if (!string.IsNullOrWhiteSpace(Unit_txt.Text.Trim()))
                {
                    inVo.Unit = Unit_txt.Text.Trim();
                }

                if (!string.IsNullOrWhiteSpace(OperatorFrom_txt.Text.Trim()))
                {
                    inVo.OperatorFrom = OperatorFrom_txt.Text.Trim();
                }

                if (!string.IsNullOrWhiteSpace(OperatorTo_txt.Text.Trim()))
                {
                    inVo.OperatorTo = OperatorTo_txt.Text.Trim();
                }

                inVo.InspectionItemId = Convert.ToInt32(InspectionItem_cmb.SelectedValue.ToString());

                inVo.SpecificationResultJudgeType = Convert.ToInt32(SpecificationResultJudgeType_cmb.SelectedValue.ToString());

                if (mode.Equals(CommonConstants.MODE_UPDATE))
                {
                    inVo.InspectionSpecificationId = updateData.InspectionSpecificationId;
                }

                inVo.Mode = mode;

                InspectionSpecificationVo checkVo = DuplicateCheck(inVo);

                if (checkVo != null && checkVo.AffectedCount > 0)
                {
                    messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, InspectionSpecificationCode_lbl.Text + " : " + InspectionSpecificationCode_txt.Text +
                                                  Environment.NewLine + " OR " + Environment.NewLine + InspectionItem_lbl.Text + " : " + InspectionItem_cmb.Text);
                    logger.Info(messageData);
                    popUpMessage.ConfirmationOkCancel(messageData, Text);

                    return;
                }

                try
                {
                    if (string.Equals(mode, CommonConstants.MODE_ADD) || string.Equals(mode, CommonConstants.MODE_SELECT))
                    {
                        UpdateResultVo outVo = (UpdateResultVo)base.InvokeCbm(new AddInspectionSpecificationMasterMntCbm(), inVo, false);

                        IntSuccess = outVo.AffectedCount;
                    }
                    else if (mode.Equals(CommonConstants.MODE_UPDATE))
                    {
                        InspectionSpecificationVo outVo = (InspectionSpecificationVo)base.InvokeCbm(new UpdateInspectionSpecificationMasterMntCbm(), 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();
                }
            }
        }