Beispiel #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);
        }
Beispiel #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())
            {
                return;
            }

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

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

            inVo.DisplayOrder = Convert.ToInt32(InspectionProcessDisplayOrder_txt.Text);

            if (string.Equals(mode, CommonConstants.MODE_ADD))
            {
                InspectionProcessVo checkVo = DuplicateCheck(inVo);
                if (checkVo != null && checkVo.AffectedCount > 0)
                {
                    messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, InspectionProcessName_lbl.Text + " : " + InspectionProcessName_txt.Text);
                    logger.Info(messageData);
                    popUpMessage.Information(messageData, Text);
                    return;
                }

                InspectionProcessVo checkDisplayVo = DuplicateDisplayCheck(inVo);
                if (checkDisplayVo != null && checkDisplayVo.AffectedCount > 0)
                {
                    messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, InspectionProcessDisplayOrder_lbl.Text + " : " + InspectionProcessDisplayOrder_txt.Text);
                    logger.Info(messageData);
                    popUpMessage.Information(messageData, Text);
                    InspectionProcessDisplayOrder_txt.Focus();
                    return;
                }

                if (InspectionprocessId == 0)
                {
                    inVo.InspectionProcessCode = updateData.InspectionFormatCode + GlobalMasterDataTypeEnum.CODE_SEPARATOR.GetValue() + GlobalMasterDataTypeEnum.PROCESS_CODE.GetValue() + GlobalMasterDataTypeEnum.CODE_SEPARATOR.GetValue() + RunningNumber;
                    InspectionProcessVo outVo = null;
                    try
                    {
                        outVo = (InspectionProcessVo)base.InvokeCbm(new AddInspectionProcessMasterMntCbm(), inVo, false);
                    }
                    catch (Framework.ApplicationException exception)
                    {
                        popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                        logger.Error(exception.GetMessageData());
                        return;
                    }
                    if (outVo == null)
                    {
                        return;
                    }
                    IntSuccess = outVo.InspectionProcessId;
                }
                else
                {
                    inVo.InspectionProcessIdCopy = InspectionprocessId;
                    //InspectionFormatVo getformatvo = inspectionFormatOutVo.GetList().Where(t => t.InspectionFormatId == inVo.InspectionFormatId).FirstOrDefault();
                    //if (getformatvo == null) return;

                    string message = string.Format(Properties.Resources.mmci00036, CopyProcess_txt.Text);
                    base.StartProgress(message);

                    inVo.InspectionFormatCode = updateData.InspectionFormatCode; // getformatvo.InspectionFormatCode;
                    inVo.SequenceNo           = RunningNumber;

                    ValueObjectList <ValueObject> inVoList = new ValueObjectList <ValueObject>();
                    inVoList.add(null);
                    inVoList.add(inVo);
                    inVoList.add(null);
                    inVoList.add(null);
                    inVoList.add(null);
                    inVoList.add(null);
                    inVoList.add(null);
                    InspectionReturnVo OutVo = null;
                    try
                    {
                        OutVo = (InspectionReturnVo)base.InvokeCbm(new CopyInspectionFormatMasterMntCbm(), inVoList, false);
                    }
                    catch (Framework.ApplicationException exception)
                    {
                        popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                        logger.Error(exception.GetMessageData());
                        return;
                    }
                    finally
                    {
                        CompleteProgress();
                    }
                    if (OutVo != null && OutVo.AffectedCount > 0)
                    {
                        IntSuccess     = OutVo.InspectionProcessId;
                        ReturnFormatId = OutVo.InspectionFormatId;
                    }
                }
            }
            else if (mode.Equals(CommonConstants.MODE_UPDATE))
            {
                if (InspectionProcessName_txt.Text == updateData.InspectionProcessName && InspectionProcessDisplayOrder_txt.Text == updateData.DisplayOrder.ToString())
                {
                    return;
                }
                if (InspectionProcessName_txt.Text != updateData.InspectionProcessName)
                {
                    InspectionProcessVo checkVo = DuplicateCheck(inVo);
                    if (checkVo != null && checkVo.AffectedCount > 0)
                    {
                        messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, InspectionProcessName_lbl.Text + " : " + InspectionProcessName_txt.Text);
                        logger.Info(messageData);
                        popUpMessage.Information(messageData, Text);

                        return;
                    }
                }
                if (InspectionProcessDisplayOrder_txt.Text != updateData.DisplayOrder.ToString())
                {
                    InspectionProcessVo checkDisplayVo = DuplicateDisplayCheck(inVo);
                    if (checkDisplayVo != null && checkDisplayVo.AffectedCount > 0)
                    {
                        messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, InspectionProcessDisplayOrder_lbl.Text + " : " + InspectionProcessDisplayOrder_txt.Text);
                        logger.Info(messageData);
                        popUpMessage.Information(messageData, Text);
                        InspectionProcessDisplayOrder_txt.Focus();
                        return;
                    }
                }

                inVo.InspectionProcessId   = updateData.InspectionProcessId;
                inVo.InspectionProcessCode = updateData.InspectionProcessCode;

                string message = string.Format(Properties.Resources.mmci00037, "Inspection Process", InspectionProcessName_txt.Text);
                StartProgress(message);

                ValueObjectList <ValueObject> inVoList     = new ValueObjectList <ValueObject>();
                InspectionFormatVo            passformatVo = FormFormatVo(updateData.InspectionProcessId);
                if (passformatVo == null || passformatVo.InspectionFormatId == 0)
                {
                    return;
                }

                inVoList.add(passformatVo);
                inVoList.add(inVo);
                inVoList.add(null);
                inVoList.add(null);
                inVoList.add(null);
                inVoList.add(null);
                inVoList.add(null);

                InspectionReturnVo outVo = null;

                try
                {
                    outVo = (InspectionReturnVo)base.InvokeCbm(new UpdateAllInspectionFunctionMasterMntCbm(), inVoList, false);
                }
                catch (Framework.ApplicationException exception)
                {
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    logger.Error(exception.GetMessageData());
                    return;
                }
                finally
                {
                    CompleteProgress();
                }
                if (outVo != null && outVo.AffectedCount > 0)
                {
                    IntSuccess     = outVo.InspectionProcessId;
                    ReturnFormatId = outVo.InspectionFormatId;
                }
            }
            if (IntSuccess > 0)
            {
                this.Close();
            }
        }