Exemplo n.º 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);
        }
Exemplo n.º 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);
        }