private void Detail_btn_Click(object sender, EventArgs e)
        {
            if (InspectionTestInstructionId <= 0)
            {
                messageData = new MessageData("mmce00010", Properties.Resources.mmce00010, "InspectionTestInstructionId");
                popUpMessage.Warning(messageData, Text);
                return;
            }
            //updateData
            InspectionTestInstructionVo inVo = new InspectionTestInstructionVo();

            inVo.InspectionTestInstructionId   = InspectionTestInstructionId;
            inVo.InspectionTestInstructionText = InspectionTestInstructionText_txt.Text.Trim();
            inVo.InspectionTestInstructionCode = InspectionTestInstructionCode;

            InspectionTestInstructionDetailForm frm = new GlobalMasterMaintenance.InspectionTestInstructionDetailForm(inVo);

            frm.ShowDialog();
            if (frm.InspectionTestInstructionId > 0)
            {
                InspectionFormatProcessBuzzLogic getprocessid = new InspectionFormatProcessBuzzLogic();
                InspectionReturnVo invo = new InspectionReturnVo();
                invo.InspectionTestInstructionId = frm.InspectionTestInstructionId;
                InspectionTestInstructionId      = frm.InspectionTestInstructionId;
                InspectionReturnVo getInspectionVo = getprocessid.RefreshAllFormGrid(invo);
                if (getInspectionVo != null && getInspectionVo.InspectionItemId > 0)
                {
                    InspectionItemId            = getInspectionVo.InspectionItemId;
                    updateData.InspectionItemId = InspectionItemId;
                    //FormDatatableFromVo();
                    //ComboBind(InspectionItem_cmb, inspectionitemDatatable, "Name", "Id");
                    //InspectionItem_cmb.SelectedValue = InspectionItemId;
                }
            }
        }
        public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            InspectionTestInstructionVo inVo = (InspectionTestInstructionVo)arg;

            StringBuilder sqlQuery = new StringBuilder();

            sqlQuery.Append("Delete from m_inspection_test_instruction");
            sqlQuery.Append(" where inspection_test_instruction_id = :inspectiontestinstructionid ");
            sqlQuery.Append(" and factory_cd = :faccd ;");

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterInteger("inspectiontestinstructionid", inVo.InspectionTestInstructionId);
            sqlParameter.AddParameterString("faccd", UserData.GetUserData().FactoryCode);

            InspectionTestInstructionVo outVo = new InspectionTestInstructionVo {
                AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter)
            };

            return(outVo);
        }
Beispiel #3
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            InspectionTestInstructionVo inVo = (InspectionTestInstructionVo)arg;

            StringBuilder sqlQuery = new StringBuilder();

            sqlQuery.Append("select");
            sqlQuery.Append(" max(inspection_test_instruction_seq) + 1 as seqnumber");
            sqlQuery.Append(" from m_inspection_test_instruction");
            sqlQuery.Append(" where factory_cd = :faccd ");
            sqlQuery.Append(" and inspection_item_id = :inspectionitemid ");

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterString("faccd", UserData.GetUserData().FactoryCode);
            sqlParameter.AddParameterInteger("inspectionitemid", inVo.InspectionItemId);

            //execute SQL
            IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter);

            InspectionTestInstructionVo currOutVo = new InspectionTestInstructionVo();

            while (dataReader.Read())

            {
                currOutVo.AffectedCount = ConvertDBNull <int>(dataReader, "seqnumber");
            }
            dataReader.Close();

            return(currOutVo);
        }
        /// <summary>
        /// inserts new record
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Ok_btn_Click(object sender, EventArgs e)
        {
            InspectionTestInstructionVo inVo = new InspectionTestInstructionVo();
            var sch = StringCheckHelper.GetInstance();

            if (CheckMandatory() == true)
            {
                inVo.InspectionTestInstructionCode = InspectionTestInstructionCode_txt.Text.Trim();

                inVo.InspectionTestInstructionText = InspectionTestInstructionText_txt.Text.Trim();

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

                inVo.Mode = mode;

                if (string.Equals(mode, CommonConstants.MODE_UPDATE))
                {
                    inVo.InspectionTestInstructionId = updateData.InspectionTestInstructionId;
                }

                InspectionTestInstructionVo checkVo = DuplicateCheck(inVo);

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

                    return;
                }

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

                        IntSuccess = outVo.AffectedCount;
                    }
                    else if (mode.Equals(CommonConstants.MODE_UPDATE))
                    {
                        InspectionTestInstructionVo outVo = (InspectionTestInstructionVo)base.InvokeCbm(new UpdateInspectionTestInstructionMasterMntCbm(), 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();
                }
            }
        }
        /// <summary>
        /// GetInspTestCode
        /// </summary>
        private void GetInspTestCode()
        {
            InspectionTestInstructionVo conditionInVo = new InspectionTestInstructionVo();

            conditionInVo.InspectionTestInstructionId = updateData.InspectionTestInstructionId;

            InspectionTestInstructionDetail_dgv.DataSource = null;

            ValueObjectList <InspectionTestInstructionVo> outVo = null;

            try
            {
                outVo = (ValueObjectList <InspectionTestInstructionVo>)base.InvokeCbm(new GetInspectionTestInstructionMasterCbm(), conditionInVo, false);
            }
            catch (Framework.ApplicationException exception)
            {
                popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                logger.Error(exception.GetMessageData());
            }

            if (outVo == null || outVo.GetList() == null || outVo.GetList().Count == 0)
            {
                messageData = new MessageData("mmci00006", Properties.Resources.mmci00006, null);
                logger.Info(messageData);
                //popUpMessage.Information(messageData, Text);
                return;
            }
            updateData.InspectionTestInstructionCode = outVo.GetList()[0].InspectionTestInstructionCode;
        }
        /// <summary>
        /// passing update data to update form
        /// </summary>
        private void BindUpdateInspectionTestInstructionData()
        {
            int selectedrowindex = InspectionTestInstruction_dgv.SelectedCells[0].RowIndex;

            InspectionTestInstructionVo inspTestInstructionVo = (InspectionTestInstructionVo)InspectionTestInstruction_dgv.Rows[selectedrowindex].DataBoundItem;

            AddInspectionTestInstructionForm newAddForm = new AddInspectionTestInstructionForm(CommonConstants.MODE_UPDATE, inspTestInstructionVo);

            newAddForm.ShowDialog(this);

            if (newAddForm.IntSuccess > 0)
            {
                messageData = new MessageData("mmci00002", Properties.Resources.mmci00002, null);
                logger.Info(messageData);
                popUpMessage.Information(messageData, Text);

                GridBind(FormConditionVo());
            }
            else if (newAddForm.IntSuccess == 0)
            {
                messageData = new MessageData("mmci00007", Properties.Resources.mmci00007, null);
                logger.Info(messageData);
                popUpMessage.Information(messageData, Text);
                GridBind(FormConditionVo());
            }
        }
        private bool CheckDataExist()
        {
            InspectionTestInstructionVo inVo = new InspectionTestInstructionVo();

            inVo.InspectionItemId = updateData.InspectionItemId;

            ValueObjectList <InspectionTestInstructionVo> outVo = null;

            try
            {
                outVo = (ValueObjectList <InspectionTestInstructionVo>)base.InvokeCbm(new GetInspectionTestInstructionMasterMntCbm(), inVo, false);
            }
            catch (Framework.ApplicationException exception)
            {
                popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                logger.Error(exception.GetMessageData());
            }

            if (outVo == null || outVo.GetList() == null || outVo.GetList().Count == 0)
            {
                return(false);
            }
            mode = CommonConstants.MODE_UPDATE;
            LoadInspectionTestInstructionData(outVo.GetList()[0]);
            return(true);
        }
Beispiel #8
0
        private void InspectionTestInstruction_btn_Click(object sender, EventArgs e)
        {
            int selectedrowindex             = InspectionItem_dgv.SelectedCells[0].RowIndex;
            InspectionItemVo InspectionAddVo = (InspectionItemVo)InspectionItem_dgv.Rows[selectedrowindex].DataBoundItem;

            InspectionTestInstructionVo inVo = new InspectionTestInstructionVo();

            inVo.InspectionTestInstructionId   = InspectionAddVo.InspectionTestInstructionId;
            inVo.InspectionTestInstructionCode = InspectionAddVo.InspectionTestInstructionCode;
            inVo.InspectionItemId   = InspectionAddVo.InspectionItemId;
            inVo.InspectionItemCode = InspectionAddVo.InspectionItemCode;
            inVo.InspectionItemName = InspectionAddVo.InspectionItemName;

            AddInspectionTestInstructionForItemForm newAddForm = new AddInspectionTestInstructionForItemForm(CommonConstants.MODE_ADD, inVo);

            newAddForm.InspectionProcessId = InspectionProcessId;
            newAddForm.ShowDialog();
            if (newAddForm.InspectionItemId > 0)
            {
                InspectionFormatProcessBuzzLogic getprocessid = new InspectionFormatProcessBuzzLogic();
                InspectionReturnVo invo = new InspectionReturnVo();
                invo.InspectionItemId = newAddForm.InspectionItemId;
                InspectionReturnVo getInspectionVo = getprocessid.RefreshAllFormGrid(invo);
                if (getInspectionVo != null && getInspectionVo.InspectionProcessId > 0)
                {
                    InspectionProcessId = getInspectionVo.InspectionProcessId;
                    //LoadInspectionProcessCombo();
                    //InspectionProcess_cmb.SelectedValue = InspectionProcessId;
                }
            }

            GridBind();

            if (InspectionItem_dgv.Rows.Count > 0 && InspectionItem_dgv.Columns.Count > 0 && InspectionItem_dgv.Columns["ColInspectionItemId"] != null)
            {
                int searchItemId;
                if (newAddForm.InspectionItemId > 0)
                {
                    searchItemId = newAddForm.InspectionItemId;
                }
                else
                {
                    searchItemId = InspectionAddVo.InspectionItemId;
                }

                DataGridViewRow row = InspectionItem_dgv.Rows
                                      .Cast <DataGridViewRow>()
                                      .FirstOrDefault(r => r.Cells["ColInspectionItemId"].Value.ToString().Equals(searchItemId.ToString()));

                if (row == null)
                {
                    return;
                }

                InspectionItem_dgv.Rows[row.Index].Selected = true;
                InspectionItem_dgv_CellClick(sender, new DataGridViewCellEventArgs(0, row.Index));
                InspectionItem_dgv.FirstDisplayedScrollingRowIndex = row.Index;
            }
        }
Beispiel #9
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            //InspectionItemVo inspectionItemVo = (InspectionItemVo)arg;

            ValueObjectList <ValueObjectList <ValueObject> > inVo = (ValueObjectList <ValueObjectList <ValueObject> >)arg;
            List <int> ItemList = new List <int>();

            foreach (ValueObjectList <ValueObject> getItemVo in inVo.GetList())
            {
                if ((((InspectionItemVo)getItemVo.GetList()[0]).InspectionItemId) != 0)
                {
                    ItemList.Add(((InspectionItemVo)getItemVo.GetList()[0]).InspectionItemId);
                }
            }

            StringBuilder sqlQuery = new StringBuilder();

            sqlQuery.Append("select * ");
            sqlQuery.Append(" from m_inspection_test_instruction");
            sqlQuery.Append(" where factory_cd = :faccd ");
            sqlQuery.Append(" and inspection_item_id = ANY (:inspectionItemId) ");

            sqlQuery.Append(" order by inspection_test_instruction_id ");

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterString("faccd", UserData.GetUserData().FactoryCode);
            sqlParameter.AddParameter("inspectionItemId", ItemList);

            //execute SQL
            IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter);

            ValueObjectList <InspectionTestInstructionVo> outVo = null;

            while (dataReader.Read())
            {
                InspectionTestInstructionVo currOutVo = new InspectionTestInstructionVo();

                currOutVo.InspectionTestInstructionId   = ConvertDBNull <Int32>(dataReader, "inspection_test_instruction_id");
                currOutVo.InspectionTestInstructionCode = ConvertDBNull <string>(dataReader, "inspection_test_instruction_cd");
                currOutVo.InspectionTestInstructionText = ConvertDBNull <string>(dataReader, "inspection_test_instruction_text");
                currOutVo.InspectionItemId = ConvertDBNull <Int32>(dataReader, "inspection_item_id");

                if (outVo == null)
                {
                    outVo = new ValueObjectList <InspectionTestInstructionVo>();
                }
                outVo.add(currOutVo);
            }
            dataReader.Close();

            return(outVo);
        }
Beispiel #10
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            InspectionTestInstructionVo inVo = (InspectionTestInstructionVo)arg;

            StringBuilder sql = new StringBuilder();

            //create SQL
            sql.Append("Select Count(*) as InspectionTestInstructionDetailCount from m_inspection_test_instruction_detail");
            sql.Append(" where factory_cd = :faccd ");

            if (inVo.InspectionTestInstructionDetailText != null)
            {
                sql.Append(" and UPPER(inspection_test_instruction_detail_text) = UPPER(:inspectiontestinstructiondetailtext)");
            }

            if (inVo.InspectionTestInstructionId > 0)
            {
                sql.Append(" and inspection_test_instruction_id = :inspectiontestinstructionid ");
            }

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterString("faccd", UserData.GetUserData().FactoryCode);

            if (inVo.InspectionTestInstructionDetailText != null)
            {
                sqlParameter.AddParameterString("inspectiontestinstructiondetailtext", inVo.InspectionTestInstructionDetailText);
            }

            if (inVo.InspectionTestInstructionId > 0)
            {
                sqlParameter.AddParameterInteger("inspectiontestinstructionid", inVo.InspectionTestInstructionId);
            }

            //execute SQL
            IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter);

            InspectionTestInstructionVo outVo = new InspectionTestInstructionVo {
                AffectedCount = 0
            };

            while (dataReader.Read())
            {
                outVo.AffectedCount = Convert.ToInt32(dataReader["InspectionTestInstructionDetailCount"]);
            }

            dataReader.Close();

            return(outVo);
        }
        /// <summary>
        /// constructor
        /// </summary>
        /// <param name="pmode"></param>
        /// <param name="userItem"></param>
        public AddInspectionTestInstructionForItemForm(string pmode, InspectionTestInstructionVo userItem = null)
        {
            InitializeComponent();

            mode       = pmode;
            updateData = userItem;
            if (string.Equals(mode, CommonConstants.MODE_UPDATE))
            {
                this.Text = UpdateText_lbl.Text;
            }
        }
        /// <summary>
        /// Loads selected data from data grid
        /// </summary>
        /// <param name="dgvInspectionTestInstruction"></param>
        private void LoadInspectionTestInstructionData(InspectionTestInstructionVo dgvInspectionTestInstruction)
        {
            if (dgvInspectionTestInstruction != null)
            {
                this.InspectionTestInstructionCode_txt.Text = dgvInspectionTestInstruction.InspectionTestInstructionCode;

                this.InspectionTestInstructionText_txt.Text = dgvInspectionTestInstruction.InspectionTestInstructionText;

                this.InspectionItem_cmb.SelectedValue = dgvInspectionTestInstruction.InspectionItemId.ToString();
            }
        }
        public ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            InspectionTestInstructionVo deleteOutVo = (InspectionTestInstructionVo)deleteInspTestInstructionMasterMntCbm.Execute(trxContext, vo);

            if (deleteOutVo.AffectedCount > 0)
            {
                InspectionTestInstructionVo deleteDetailVo = (InspectionTestInstructionVo)deleteInspTestInstructionDetailMasterMntCbm.Execute(trxContext, vo);
            }

            return(deleteOutVo);
        }
        /// <summary>
        /// Detail screen
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Detail_btn_Click(object sender, EventArgs e)
        {
            if (InspectionTestInstruction_dgv.Rows.Count == 0 || InspectionTestInstruction_dgv.SelectedRows.Count == 0)
            {
                return;
            }
            int selectedrowindex             = InspectionTestInstruction_dgv.SelectedCells[0].RowIndex;
            InspectionTestInstructionVo inVo = (InspectionTestInstructionVo)InspectionTestInstruction_dgv.Rows[selectedrowindex].DataBoundItem;

            InspectionTestInstructionDetailForm newdetailform = new InspectionTestInstructionDetailForm(inVo);

            newdetailform.ShowDialog();
            GridBind(FormConditionVo());
        }
        public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            ValueObjectList <InspectionTestInstructionVo> inspectionTestInstructionVo = (ValueObjectList <InspectionTestInstructionVo>)arg;

            List <int> inspectionTestInstructionId = inspectionTestInstructionVo.GetList().Select(v => v.InspectionTestInstructionId).Distinct().ToList();

            StringBuilder sqlQuery = new StringBuilder();

            sqlQuery.Append("select * ");
            sqlQuery.Append(" from m_inspection_test_instruction_detail");
            sqlQuery.Append(" where factory_cd = :faccd ");
            sqlQuery.Append(" and inspection_test_instruction_id = ANY(:inspectionTestInstructionId) ");

            sqlQuery.Append(" order by inspection_test_instruction_detail_id ");

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterString("faccd", UserData.GetUserData().FactoryCode);
            sqlParameter.AddParameter("inspectionTestInstructionId", inspectionTestInstructionId);

            //execute SQL
            IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter);

            ValueObjectList <InspectionTestInstructionVo> outVo = null;

            while (dataReader.Read())
            {
                InspectionTestInstructionVo currOutVo = new InspectionTestInstructionVo();

                currOutVo.InspectionTestInstructionDetailId          = ConvertDBNull <int>(dataReader, "inspection_test_instruction_detail_id");
                currOutVo.InspectionTestInstructionDetailCode        = ConvertDBNull <string>(dataReader, "inspection_test_instruction_detail_cd");
                currOutVo.InspectionTestInstructionDetailText        = ConvertDBNull <string>(dataReader, "inspection_test_instruction_detail_text");
                currOutVo.InspectionTestInstructionDetailResultCount = ConvertDBNull <int>(dataReader, "inspection_test_instruction_detail_result_count");
                currOutVo.InspectionTestInstructionDetailMachine     = ConvertDBNull <string>(dataReader, "inspection_test_instruction_detail_machine_text");
                currOutVo.InspectionTestInstructionId = ConvertDBNull <int>(dataReader, "inspection_test_instruction_id");

                if (outVo == null)
                {
                    outVo = new ValueObjectList <InspectionTestInstructionVo>();
                }
                outVo.add(currOutVo);
            }
            dataReader.Close();

            return(outVo);
        }
Beispiel #16
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            InspectionTestInstructionVo inVo = (InspectionTestInstructionVo)arg;

            StringBuilder sqlQuery = new StringBuilder();

            sqlQuery.Append("Insert into m_inspection_test_instruction_detail");
            sqlQuery.Append(" ( ");
            sqlQuery.Append(" inspection_test_instruction_detail_cd,");
            sqlQuery.Append(" inspection_test_instruction_detail_text,");
            sqlQuery.Append(" inspection_test_instruction_detail_result_count,");
            sqlQuery.Append(" inspection_test_instruction_detail_machine_text, ");
            sqlQuery.Append(" inspection_test_instruction_id,");
            sqlQuery.Append(" registration_user_cd,");
            sqlQuery.Append(" registration_date_time,");
            sqlQuery.Append(" factory_cd");
            sqlQuery.Append(" ) ");
            sqlQuery.Append("VALUES	");
            sqlQuery.Append(" ( ");
            sqlQuery.Append(" :inspectiontestinstructiondetailcd,");
            sqlQuery.Append(" :inspectiontestinstructiondetailtext,");
            sqlQuery.Append(" :inspectiontestinstructiondetailresultcount,");
            sqlQuery.Append(" :inspectiontestinstructiondetailmachine,");
            sqlQuery.Append(" :inspectiontestinstructionid,");
            sqlQuery.Append(" :registrationusercode,");
            sqlQuery.Append(" :regdatetime,");
            sqlQuery.Append(" :factorycode");
            sqlQuery.Append(" ); ");

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterString("inspectiontestinstructiondetailcd", inVo.InspectionTestInstructionDetailCode);
            sqlParameter.AddParameterString("inspectiontestinstructiondetailtext", inVo.InspectionTestInstructionDetailText);
            sqlParameter.AddParameterInteger("inspectiontestinstructiondetailresultcount", inVo.InspectionTestInstructionDetailResultCount);
            sqlParameter.AddParameterInteger("inspectiontestinstructionid", inVo.InspectionTestInstructionId);
            sqlParameter.AddParameterString("inspectiontestinstructiondetailmachine", inVo.InspectionTestInstructionDetailMachine);
            sqlParameter.AddParameterString("registrationusercode", UserData.GetUserData().UserCode);
            sqlParameter.AddParameterDateTime("regdatetime", trxContext.ProcessingDBDateTime);
            sqlParameter.AddParameterString("factorycode", UserData.GetUserData().FactoryCode);

            UpdateResultVo outVo = new UpdateResultVo {
                AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter)
            };

            return(outVo);
        }
        /// <summary>
        /// checks duplicate Inspection Specification code
        /// </summary>
        /// <returns></returns>
        private InspectionTestInstructionVo DuplicateCheck(InspectionTestInstructionVo InsSpecVo)
        {
            InspectionTestInstructionVo outVo = new InspectionTestInstructionVo();

            try
            {
                outVo = (InspectionTestInstructionVo)base.InvokeCbm(new CheckInspectionTestInstructionMasterMntCbm(), InsSpecVo, false);
            }
            catch (Framework.ApplicationException exception)
            {
                popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                logger.Error(exception.GetMessageData());
            }

            return(outVo);
        }
        /// <summary>
        /// delete the selected record
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Delete_btn_Click(object sender, EventArgs e)
        {
            int selectedrowindex = InspectionTestInstruction_dgv.SelectedCells[0].RowIndex;

            DataGridViewRow selectedRow = InspectionTestInstruction_dgv.Rows[selectedrowindex];

            messageData = new MessageData("mmcc00004", Properties.Resources.mmcc00004, selectedRow.Cells["colInspectionTestInstructionCode"].Value.ToString());
            // Logger.Info(messageData);
            DialogResult dialogResult = popUpMessage.ConfirmationOkCancel(messageData, Text);

            if (dialogResult == DialogResult.OK)
            {
                InspectionTestInstructionVo inVo = new InspectionTestInstructionVo();

                inVo.InspectionTestInstructionId   = Convert.ToInt32(selectedRow.Cells["colInspectionTestInstructionId"].Value.ToString());
                inVo.InspectionTestInstructionCode = selectedRow.Cells["colInspectionTestInstructionCode"].Value.ToString();
                try
                {
                    InspectionTestInstructionVo outVo = (InspectionTestInstructionVo)base.InvokeCbm(new DeleteInspectionTestInstructionMasterMntNewCbm(), inVo, false);

                    if (outVo.AffectedCount > 0)
                    {
                        this.messageData = new MessageData("mmci00003", Properties.Resources.mmci00003, null);
                        logger.Info(this.messageData);
                        popUpMessage.Information(this.messageData, Text);

                        GridBind(FormConditionVo());
                    }
                    else if (outVo.AffectedCount == 0)
                    {
                        messageData = new MessageData("mmci00007", Properties.Resources.mmci00007, null);
                        logger.Info(messageData);
                        popUpMessage.Information(messageData, Text);
                        GridBind(FormConditionVo());
                    }
                }
                catch (Framework.ApplicationException exception)
                {
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    logger.Error(exception.GetMessageData());
                }
            }
            else if (dialogResult == DialogResult.Cancel)
            {
                //do something else
            }
        }
        /// <summary>
        /// Fills all user records to gridview control
        /// </summary>
        private void GridBind()
        {
            Update_btn.Enabled = false;

            Delete_btn.Enabled = false;

            InspectionTestInstructionVo conditionInVo = new InspectionTestInstructionVo();

            conditionInVo.InspectionTestInstructionId = updateData.InspectionTestInstructionId;

            InspectionTestInstructionDetail_dgv.DataSource = null;

            ValueObjectList <InspectionTestInstructionVo> outVo = null;

            try
            {
                outVo = (ValueObjectList <InspectionTestInstructionVo>)base.InvokeCbm(new GetInspectionTestInstructionDetailMasterMntCbm(), conditionInVo, false);
            }
            catch (Framework.ApplicationException exception)
            {
                popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                logger.Error(exception.GetMessageData());
            }

            if (outVo == null || outVo.GetList() == null || outVo.GetList().Count == 0)
            {
                messageData = new MessageData("mmci00006", Properties.Resources.mmci00006, null);
                logger.Info(messageData);
                //popUpMessage.Information(messageData, Text);
                return;
            }
            InspectionTestInstructionDetail_dgv.AutoGenerateColumns = false;

            BindingSource bindingSource1 = new BindingSource(outVo.GetList(), null);

            if (bindingSource1 != null && bindingSource1.Count > 0)
            {
                InspectionTestInstructionDetail_dgv.DataSource = bindingSource1;
            }
            else
            {
                messageData = new MessageData("mmci00006", Properties.Resources.mmci00006, null);
                logger.Info(messageData);
                popUpMessage.Information(messageData, Text);
            }
            InspectionTestInstructionDetail_dgv.ClearSelection();
        }
        public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            InspectionTestInstructionVo inVo = (InspectionTestInstructionVo)arg;

            StringBuilder sqlQuery = new StringBuilder();

            sqlQuery.Append("Insert into m_inspection_test_instruction");
            sqlQuery.Append(" ( ");
            sqlQuery.Append(" inspection_test_instruction_cd,");
            sqlQuery.Append(" inspection_test_instruction_text,");
            sqlQuery.Append(" inspection_item_id,");
            sqlQuery.Append(" registration_user_cd,");
            sqlQuery.Append(" registration_date_time,");
            sqlQuery.Append(" factory_cd");
            sqlQuery.Append(" ) ");
            sqlQuery.Append("VALUES	");
            sqlQuery.Append(" ( ");
            sqlQuery.Append(" :inspectiontestinstructioncd,");
            sqlQuery.Append(" :inspectiontestinstructiontext,");
            sqlQuery.Append(" :inspectionitemid,");
            sqlQuery.Append(" :registrationusercode,");
            sqlQuery.Append(" :regdatetime,");
            sqlQuery.Append(" :factorycode");
            sqlQuery.Append(" ) ");
            sqlQuery.Append(" RETURNING inspection_test_instruction_id;");
            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterString("inspectiontestinstructioncd", inVo.InspectionTestInstructionCode);
            sqlParameter.AddParameterString("inspectiontestinstructiontext", inVo.InspectionTestInstructionText);
            sqlParameter.AddParameterInteger("inspectionitemid", inVo.InspectionItemId);

            UserData userdata = trxContext.UserData;

            sqlParameter.AddParameterString("registrationusercode", userdata.UserCode);
            sqlParameter.AddParameterDateTime("regdatetime", trxContext.ProcessingDBDateTime);
            sqlParameter.AddParameterString("factorycode", userdata.FactoryCode);

            InspectionTestInstructionVo outVo = new InspectionTestInstructionVo();

            outVo.InspectionTestInstructionId = (int?)sqlCommandAdapter.ExecuteScalar(sqlParameter) ?? 0;
            return(outVo);
        }
        /// <summary>
        /// Loads selected data from data grid
        /// </summary>
        /// <param name="dgvInspectionTestInstruction"></param>
        private void LoadInspectionTestInstructionData(InspectionTestInstructionVo dgvInspectionTestInstruction)
        {
            if (dgvInspectionTestInstruction != null)
            {
                this.InspectionTestInstructionText_txt.Text = dgvInspectionTestInstruction.InspectionTestInstructionText;

                //this.InspectionItem_cmb.SelectedValue = dgvInspectionTestInstruction.InspectionItemId.ToString();

                this.InspectionItem_cmb.Text = updateData.InspectionItemName;

                InspectionTestInstructionId = dgvInspectionTestInstruction.InspectionTestInstructionId;

                InspectionTestInstructionCode = dgvInspectionTestInstruction.InspectionTestInstructionCode;

                Detail_btn.Enabled = delete_btn.Enabled = true;

                mode = CommonConstants.MODE_UPDATE;
            }
        }
Beispiel #22
0
        private bool CheckDataExist(int inspectionItemId)
        {
            InspectionSpecificationVo inSpecVo = new InspectionSpecificationVo();

            inSpecVo.InspectionItemId = inspectionItemId;

            ValueObjectList <InspectionSpecificationVo> outSpecVo = null;

            try
            {
                outSpecVo = (ValueObjectList <InspectionSpecificationVo>)base.InvokeCbm(new GetInspectionSpecificationMasterMntCbm(), inSpecVo, false);
            }
            catch (Framework.ApplicationException exception)
            {
                //popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                logger.Error(exception.GetMessageData());
            }

            InspectionTestInstructionVo inTestInstVo = new InspectionTestInstructionVo();

            inTestInstVo.InspectionItemId = inspectionItemId;

            ValueObjectList <InspectionTestInstructionVo> outTestInstVo = null;

            try
            {
                outTestInstVo = (ValueObjectList <InspectionTestInstructionVo>)base.InvokeCbm(new GetInspectionTestInstructionMasterMntCbm(), inTestInstVo, false);
            }
            catch (Framework.ApplicationException exception)
            {
                //popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                logger.Error(exception.GetMessageData());
            }

            if ((outTestInstVo == null || outTestInstVo.GetList() == null || outTestInstVo.GetList().Count == 0) &&
                (outSpecVo == null || outSpecVo.GetList() == null || outSpecVo.GetList().Count == 0))
            {
                return(false);
            }

            return(true);
        }
        /// <summary>
        /// Creates seacrh condition as per user inputs
        /// </summary>
        /// <returns>search condition</returns>
        private InspectionTestInstructionVo FormConditionVo()
        {
            InspectionTestInstructionVo inVo = new InspectionTestInstructionVo();

            if (InspectionTestInstructionCode_txt.Text != string.Empty)
            {
                inVo.InspectionTestInstructionCode = InspectionTestInstructionCode_txt.Text;
            }

            if (InspectionTestInstructionText_txt.Text != string.Empty)
            {
                inVo.InspectionTestInstructionText = InspectionTestInstructionText_txt.Text;
            }

            if (InspectionItemId_cmb.SelectedIndex > -1)
            {
                inVo.InspectionItemId = Convert.ToInt32(InspectionItemId_cmb.SelectedValue.ToString());
            }

            return(inVo);
        }
        /// <summary>
        /// passing update data to update form
        /// </summary>
        private void BindUpdateInspectionTestInstructionDetailData()
        {
            int selectedrowindex = InspectionTestInstructionDetail_dgv.SelectedCells[0].RowIndex;

            InspectionTestInstructionVo inspTestInstructionVo = (InspectionTestInstructionVo)InspectionTestInstructionDetail_dgv.Rows[selectedrowindex].DataBoundItem;

            AddInspectionTestInstructionDetailForm newAddForm = new AddInspectionTestInstructionDetailForm(CommonConstants.MODE_UPDATE, inspTestInstructionVo);

            newAddForm.InspectionTestInstructionText = updateData.InspectionTestInstructionText;

            newAddForm.ShowDialog(this);

            if (newAddForm.InspectionTestInstructionId > 0)
            {
                updateData.InspectionTestInstructionId = newAddForm.InspectionTestInstructionId;
                InspectionTestInstructionId            = newAddForm.InspectionTestInstructionId;
                GetInspTestCode();
            }
            GridBind();

            InspectionTestInstructionDetail_dgv.Rows[selectedrowindex].Selected = true;
            InspectionTestInstructionDetail_dgv_CellClick(this, new DataGridViewCellEventArgs(0, selectedrowindex));
            InspectionTestInstructionDetail_dgv.FirstDisplayedScrollingRowIndex = selectedrowindex;

            //if (newAddForm.IntSuccess > 0)
            //{
            //    messageData = new MessageData("mmci00002", Properties.Resources.mmci00002, null);
            //    logger.Info(messageData);
            //    popUpMessage.Information(messageData, Text);

            //    GridBind();
            //}
            //else if (newAddForm.IntSuccess == 0)
            //{
            //    messageData = new MessageData("mmci00007", Properties.Resources.mmci00007, null);
            //    logger.Info(messageData);
            //    popUpMessage.Information(messageData, Text);
            //    GridBind();
            //}
        }
        public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            InspectionTestInstructionVo inVo = (InspectionTestInstructionVo)arg;

            StringBuilder sqlQuery = new StringBuilder();

            sqlQuery.Append("Update m_inspection_test_instruction_detail");
            sqlQuery.Append(" Set ");
            sqlQuery.Append(" inspection_test_instruction_detail_cd = :inspectiontestinstructiondetailcd, ");
            sqlQuery.Append(" inspection_test_instruction_detail_text = :inspectiontestinstructiondetailtext, ");
            sqlQuery.Append(" inspection_test_instruction_detail_result_count = :inspectiontestinstructiondetailresultcount, ");
            sqlQuery.Append(" inspection_test_instruction_id = :inspectiontestinstructionid, ");
            sqlQuery.Append(" inspection_test_instruction_detail_machine_text = :inspectiontestinstructiondetailmachine ");
            sqlQuery.Append(" Where	");
            sqlQuery.Append(" inspection_test_instruction_detail_id = :inspectiontestinstructiondetailid ");
            sqlQuery.Append(" and factory_cd = :faccd ;");


            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterInteger("inspectiontestinstructiondetailid", inVo.InspectionTestInstructionDetailId);
            sqlParameter.AddParameterString("inspectiontestinstructiondetailcd", inVo.InspectionTestInstructionDetailCode);
            sqlParameter.AddParameterString("inspectiontestinstructiondetailtext", inVo.InspectionTestInstructionDetailText);
            sqlParameter.AddParameterInteger("inspectiontestinstructiondetailresultcount", inVo.InspectionTestInstructionDetailResultCount);
            sqlParameter.AddParameterInteger("inspectiontestinstructionid", inVo.InspectionTestInstructionId);
            sqlParameter.AddParameterString("inspectiontestinstructiondetailmachine", inVo.InspectionTestInstructionDetailMachine);
            sqlParameter.AddParameterString("faccd", UserData.GetUserData().FactoryCode);

            InspectionTestInstructionVo outVo = new InspectionTestInstructionVo {
                AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter)
            };

            return(outVo);
        }
Beispiel #26
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            InspectionTestInstructionVo inVo = (InspectionTestInstructionVo)arg;

            StringBuilder sqlQuery = new StringBuilder();

            sqlQuery.Append("select");
            sqlQuery.Append(" inspection_test_instruction_detail_cd");
            sqlQuery.Append(" from m_inspection_test_instruction_detail");
            sqlQuery.Append(" where factory_cd = :faccd ");
            sqlQuery.Append(" and inspection_test_instruction_id = :inspectiontestinstructionid ");
            sqlQuery.Append(" order by inspection_test_instruction_detail_id desc ");
            sqlQuery.Append(" limit 1 ");

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterString("faccd", UserData.GetUserData().FactoryCode);
            sqlParameter.AddParameterInteger("inspectiontestinstructionid", inVo.InspectionTestInstructionId);

            //execute SQL
            IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter);

            InspectionTestInstructionVo currOutVo = new InspectionTestInstructionVo();

            while (dataReader.Read())
            {
                currOutVo.InspectionTestInstructionDetailCode = ConvertDBNull <string>(dataReader, "inspection_test_instruction_detail_cd");
            }
            dataReader.Close();

            return(currOutVo);
        }
Beispiel #27
0
        public override ValueObject Execute(TransactionContext trxContext, ValueObject arg)
        {
            InspectionTestInstructionVo inVo = (InspectionTestInstructionVo)arg;

            StringBuilder sqlQuery = new StringBuilder();

            sqlQuery.Append("select");
            sqlQuery.Append(" inspection_test_instruction_id,");
            sqlQuery.Append(" inspection_test_instruction_cd,");
            sqlQuery.Append(" inspection_test_instruction_text");
            sqlQuery.Append(" from m_inspection_test_instruction");
            sqlQuery.Append(" where factory_cd = :faccd ");

            if (inVo.InspectionTestInstructionCode != null)
            {
                sqlQuery.Append(" and inspection_test_instruction_cd like :inspectiontestinstructioncd ");
            }

            if (inVo.InspectionTestInstructionText != null)
            {
                sqlQuery.Append(" and inspection_test_instruction_text like :inspectiontestinstructiontext ");
            }

            if (inVo.InspectionTestInstructionId > 0)
            {
                sqlQuery.Append(" and inspection_test_instruction_id = :inspectiontestinstructionid ");
            }

            sqlQuery.Append(" order by inspection_test_instruction_cd ");

            //create command
            DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString());

            //create parameter
            DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList();

            sqlParameter.AddParameterString("faccd", UserData.GetUserData().FactoryCode);

            if (inVo.InspectionTestInstructionCode != null)
            {
                sqlParameter.AddParameterString("inspectiontestinstructioncd", inVo.InspectionTestInstructionCode + "%");
            }

            if (inVo.InspectionTestInstructionText != null)
            {
                sqlParameter.AddParameterString("inspectiontestinstructiontext", inVo.InspectionTestInstructionText + "%");
            }

            if (inVo.InspectionTestInstructionId > 0)
            {
                sqlParameter.AddParameterInteger("inspectiontestinstructionid", inVo.InspectionTestInstructionId);
            }

            //execute SQL
            IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter);

            ValueObjectList <InspectionTestInstructionVo> outVo = null;

            while (dataReader.Read())

            {
                InspectionTestInstructionVo currOutVo = new InspectionTestInstructionVo();
                currOutVo.InspectionTestInstructionId   = ConvertDBNull <Int32>(dataReader, "inspection_test_instruction_id");
                currOutVo.InspectionTestInstructionCode = ConvertDBNull <string>(dataReader, "inspection_test_instruction_cd");
                currOutVo.InspectionTestInstructionText = ConvertDBNull <string>(dataReader, "inspection_test_instruction_text");

                if (outVo == null)
                {
                    outVo = new ValueObjectList <InspectionTestInstructionVo>();
                }
                outVo.add(currOutVo);
            }
            dataReader.Close();

            return(outVo);
        }
 /// <summary>
 /// constructor
 /// </summary>
 public InspectionTestInstructionDetailForm(InspectionTestInstructionVo userdata)
 {
     updateData = userdata;
     InitializeComponent();
 }
        /// <summary>
        /// delete the selected record
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Delete_btn_Click(object sender, EventArgs e)
        {
            int selectedrowindex = InspectionTestInstructionDetail_dgv.SelectedCells[0].RowIndex;

            DataGridViewRow selectedRow = InspectionTestInstructionDetail_dgv.Rows[selectedrowindex];

            messageData = new MessageData("mmcc00004", Properties.Resources.mmcc00004, selectedRow.Cells["colInspectionTestInstructionDetailText"].Value.ToString());
            // Logger.Info(messageData);
            DialogResult dialogResult = popUpMessage.ConfirmationOkCancel(messageData, Text);

            if (dialogResult == DialogResult.OK)
            {
                InspectionTestInstructionVo inVo = new InspectionTestInstructionVo();

                inVo.InspectionTestInstructionDetailId = Convert.ToInt32(selectedRow.Cells["colInspectionTestInstructionDetailId"].Value.ToString());
                inVo.InspectionTestInstructionId       = Convert.ToInt32(selectedRow.Cells["colInspectionTestInstructionId"].Value.ToString());
                inVo.DeleteFlag = true;

                string message = string.Format(Properties.Resources.mmci00038, "Inspection Test Instruction Detail", selectedRow.Cells["colInspectionTestInstructionDetailText"].Value.ToString());
                StartProgress(message);

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

                inVoList.add(passformatVo);
                inVoList.add(null);
                inVoList.add(null);
                inVoList.add(null);
                inVoList.add(null);
                inVoList.add(null);
                inVoList.add(inVo);
                InspectionReturnVo outVo = new InspectionReturnVo();
                try
                {
                    outVo = (InspectionReturnVo)base.InvokeCbm(new UpdateAllInspectionFunctionMasterMntCbm(), inVoList, false);
                }
                catch (Framework.ApplicationException exception)
                {
                    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                    logger.Error(exception.GetMessageData());
                }
                finally
                {
                    CompleteProgress();
                }
                if (outVo == null)
                {
                    return;
                }

                InspectionTestInstructionId            = outVo.InspectionTestInstructionId;
                updateData.InspectionTestInstructionId = outVo.InspectionTestInstructionId;

                GetInspTestCode();
                GridBind();

                this.messageData = new MessageData("mmci00003", Properties.Resources.mmci00003, null);
                logger.Info(this.messageData);
                popUpMessage.Information(this.messageData, Text);


                //inVo.InspectionTestInstructionDetailCode = selectedRow.Cells["colInspectionTestInstructionDetailCode"].Value.ToString();
                //try
                //{

                //    InspectionTestInstructionVo outVo = (InspectionTestInstructionVo)base.InvokeCbm(new DeleteInspectionTestInstructionDetailMasterMntCbm(), inVo, false);

                //    if (outVo.AffectedCount > 0)
                //    {
                //        this.messageData = new MessageData("mmci00003", Properties.Resources.mmci00003, null);
                //        logger.Info(this.messageData);
                //        popUpMessage.Information(this.messageData, Text);

                //        GridBind();
                //    }
                //    else if (outVo.AffectedCount == 0)
                //    {
                //        messageData = new MessageData("mmci00007", Properties.Resources.mmci00007, null);
                //        logger.Info(messageData);
                //        popUpMessage.Information(messageData, Text);
                //        GridBind();
                //    }
                //}
                //catch (Framework.ApplicationException exception)
                //{
                //    popUpMessage.ApplicationError(exception.GetMessageData(), Text);
                //    logger.Error(exception.GetMessageData());
                //}
            }
            else if (dialogResult == DialogResult.Cancel)
            {
                //do something else
            }
        }
        public ValueObject Execute(TransactionContext trxContext, ValueObject vo)
        {
            InspectionFormatVo            inVo     = new InspectionFormatVo();
            ValueObjectList <ValueObject> inListVo = (ValueObjectList <ValueObject>)vo;
            InspectionReturnVo            outVo    = null;

            if (inListVo == null && inListVo.GetList() == null && inListVo.GetList().Count == 0)
            {
                return(null);
            }

            InspectionFormatVo  updateFormatVo  = (InspectionFormatVo)inListVo.GetList()[0];
            InspectionProcessVo updateprocessVo = (InspectionProcessVo)inListVo.GetList()[1];
            InspectionItemVo    updateitemVo    = (InspectionItemVo)inListVo.GetList()[2];
            InspectionItemSelectionDatatypeValueVo updateSelectionDataTypeValueVo = (InspectionItemSelectionDatatypeValueVo)inListVo.GetList()[3];
            InspectionSpecificationVo   updateSpecificationVo         = (InspectionSpecificationVo)inListVo.GetList()[4];
            InspectionTestInstructionVo updateTestInstructionVo       = (InspectionTestInstructionVo)inListVo.GetList()[5];
            InspectionTestInstructionVo updateTestInstructionDetailVo = (InspectionTestInstructionVo)inListVo.GetList()[6];

            if (!(updateprocessVo != null && updateprocessVo.InspectionProcessIdCopy > 0 && updateitemVo != null && updateitemVo.InspectionItemIdCopy > 0))
            {
                InspectionFormatVo inspFormatVo = new InspectionFormatVo();
                inspFormatVo.InspectionFormatId   = updateFormatVo.InspectionFormatIdCopy;
                inspFormatVo.InspectionFormatCode = updateFormatVo.InspectionFormatCode;
                inspFormatVo.InspectionFormatName = updateFormatVo.InspectionFormatName;

                UpdateResultVo updateResultVo = (UpdateResultVo)checkInspectionFormatExitInTransactionCbm.Execute(trxContext, inspFormatVo);
                if (updateResultVo.AffectedCount == 0)
                {
                    outVo = new InspectionReturnVo();

                    if (updateFormatVo.Mode == CommonConstants.MODE_UPDATE)
                    {
                        //update inspectionformat
                        InspectionFormatVo inspectionFormatVo = (InspectionFormatVo)updateInspectionFormatMasterMntCbm.Execute(trxContext, inspFormatVo);

                        outVo.AffectedCount      = inspectionFormatVo.AffectedCount;
                        outVo.InspectionFormatId = inspFormatVo.InspectionFormatId;
                        return(outVo);
                    }

                    if (updateprocessVo != null)
                    {
                        InspectionProcessVo inspectionProcessVo = new InspectionProcessVo();

                        if (updateprocessVo.DeleteFlag)
                        {
                            //delete inspectionprocess
                            return((InspectionReturnVo)deleteAllInspectionFunctionMasterMntCbm.Execute(trxContext, vo));
                        }
                        else
                        {
                            //update inspectionprocess
                            inspectionProcessVo = (InspectionProcessVo)updateInspectionProcessMasterMntCbm.Execute(trxContext, updateprocessVo);
                        }

                        outVo.AffectedCount       = inspectionProcessVo.AffectedCount;
                        outVo.InspectionProcessId = updateprocessVo.InspectionProcessId;
                        outVo.InspectionFormatId  = inspFormatVo.InspectionFormatId;
                        return(outVo);
                    }
                    if (updateSelectionDataTypeValueVo != null)
                    {
                        if (updateSelectionDataTypeValueVo.DeleteFlag)
                        {
                            //delete inspectionitemselectionvalue
                            return((InspectionReturnVo)deleteAllInspectionFunctionMasterMntCbm.Execute(trxContext, vo));
                        }
                        else
                        {
                            //update inspectionitemselectionvalue
                            UpdateResultVo inspectionItemSelectionDatatypeValueVo = (UpdateResultVo)updateInspectionItemSelectionDatatypeValueCbm.Execute(trxContext, updateSelectionDataTypeValueVo);

                            outVo.AffectedCount    = inspectionItemSelectionDatatypeValueVo.AffectedCount;
                            outVo.InspectionItemId = updateSelectionDataTypeValueVo.InspectionItemId;
                            return(outVo);
                        }
                    }
                    if (updateitemVo != null)
                    {
                        InspectionItemVo inspectionItemVo = new InspectionItemVo();

                        if (updateitemVo.DeleteFlag)
                        {
                            //delete inspectionitem
                            return((InspectionReturnVo)deleteAllInspectionFunctionMasterMntCbm.Execute(trxContext, vo));
                        }
                        else
                        {
                            //update inspectionitem
                            inspectionItemVo = (InspectionItemVo)updateInspectionItemMasterMntCbm.Execute(trxContext, updateitemVo);
                        }

                        outVo.AffectedCount       = inspectionItemVo.AffectedCount;
                        outVo.InspectionItemId    = updateitemVo.InspectionItemId;
                        outVo.InspectionProcessId = updateitemVo.InspectionProcessId;
                        return(outVo);
                    }
                    if (updateSpecificationVo != null)
                    {
                        InspectionSpecificationVo inspectionSpecificationVo = new InspectionSpecificationVo();

                        if (updateSpecificationVo.DeleteFlag)
                        {
                            //delete inspectionspecification
                            return((InspectionReturnVo)deleteAllInspectionFunctionMasterMntCbm.Execute(trxContext, vo));
                        }
                        else
                        {
                            //update inspectionspecification
                            inspectionSpecificationVo = (InspectionSpecificationVo)updateInspectionSpecificationMasterMntCbm.Execute(trxContext, updateSpecificationVo);
                        }

                        outVo.AffectedCount    = inspectionSpecificationVo.AffectedCount;
                        outVo.InspectionItemId = updateSpecificationVo.InspectionItemId;
                        return(outVo);
                    }
                    if (updateTestInstructionVo != null)
                    {
                        InspectionTestInstructionVo inspectionTestInstructionVo = new InspectionTestInstructionVo();

                        if (updateTestInstructionVo.DeleteFlag)
                        {
                            //delete inspectiontestinstruction
                            return((InspectionReturnVo)deleteAllInspectionFunctionMasterMntCbm.Execute(trxContext, vo));
                        }
                        else
                        {
                            //update inspectiontestinstruction
                            inspectionTestInstructionVo = (InspectionTestInstructionVo)updateInspectionTestInstructionMasterMntCbm.Execute(trxContext, updateTestInstructionVo);
                        }

                        outVo.AffectedCount               = inspectionTestInstructionVo.AffectedCount;
                        outVo.InspectionItemId            = updateTestInstructionVo.InspectionItemId;
                        outVo.InspectionTestInstructionId = updateTestInstructionVo.InspectionTestInstructionId;
                        return(outVo);
                    }
                    if (updateTestInstructionDetailVo != null)
                    {
                        InspectionTestInstructionVo inspectionTestInstructionDetailVo = new InspectionTestInstructionVo();

                        if (updateTestInstructionDetailVo.DeleteFlag)
                        {
                            //delete inspectiontestinstructiondetail
                            return((InspectionReturnVo)deleteAllInspectionFunctionMasterMntCbm.Execute(trxContext, vo));
                        }
                        else
                        {
                            //update inspectiontestinstructiondetail
                            inspectionTestInstructionDetailVo = (InspectionTestInstructionVo)updateInspectionTestInstructionDetailMasterMntCbm.Execute(trxContext, updateTestInstructionDetailVo);
                        }

                        outVo.AffectedCount = inspectionTestInstructionDetailVo.AffectedCount;
                        outVo.InspectionTestInstructionId = updateTestInstructionDetailVo.InspectionTestInstructionId;
                        return(outVo);
                    }
                }
            }

            inVo = (InspectionFormatVo)inListVo.GetList()[0];
            inVo.InspectionFormatId = inVo.InspectionFormatIdCopy;

            updateInspectionFormatDeleteFlagMasterMntCbm.Execute(trxContext, inVo);
            return(copyInspectionFormatMasterMntCbm.Execute(trxContext, vo));
        }