public ValueObject Execute(TransactionContext trxContext, ValueObject vo) { InspectionFormatVo inVo = (InspectionFormatVo)vo; InspectionFormatVo OutVo = null; //InspectionFormatVo formatVo = (InspectionFormatVo)checkInspectionFormatCbm.Execute(trxContext, vo); //if(formatVo != null && formatVo.AffectedCount > 0) //{ // OutVo = new InspectionFormatVo(); // OutVo.AffectedCount = formatVo.AffectedCount; // return OutVo; //} ItemLineInspectionFormatVo ItemlineinVo = new ItemLineInspectionFormatVo(); ItemlineinVo.LineId = inVo.LineId; ItemlineinVo.SapItemCode = inVo.SapItemCode; ItemLineInspectionFormatVo itemlineVo = (ItemLineInspectionFormatVo)checkItemLineInspectionFormatMasterMntCbm.Execute(trxContext, ItemlineinVo); if (itemlineVo != null && itemlineVo.AffectedCount > 0) { OutVo = new InspectionFormatVo(); OutVo.AffectedCount = itemlineVo.AffectedCount; return(OutVo); } return(OutVo); }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { InspectionFormatVo inVo = (InspectionFormatVo)arg; StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append("Update m_inspection_format"); sqlQuery.Append(" Set "); //sqlQuery.Append(" inspection_format_cd = :inspectionformatcd, "); sqlQuery.Append(" inspection_format_name = :inspectionformatname "); sqlQuery.Append(" Where "); sqlQuery.Append(" inspection_format_id = :inspectionformatid "); sqlQuery.Append(" and factory_cd = :faccd ;"); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterInteger("inspectionformatid", inVo.InspectionFormatId); sqlParameter.AddParameterString("inspectionformatcd", inVo.InspectionFormatCode); sqlParameter.AddParameterString("inspectionformatname", inVo.InspectionFormatName); sqlParameter.AddParameterString("faccd", UserData.GetUserData().FactoryCode); InspectionFormatVo outVo = new InspectionFormatVo { AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter) }; return(outVo); }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { InspectionFormatVo inVo = (InspectionFormatVo)arg; StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append("Update m_inspection_format"); sqlQuery.Append(" Set "); sqlQuery.Append(" is_deleted = :isdeleted "); sqlQuery.Append(" Where "); sqlQuery.Append(" inspection_format_id = :inspectionformatid "); sqlQuery.Append(" and factory_cd = :faccd ;"); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterInteger("inspectionformatid", inVo.InspectionFormatId); sqlParameter.AddParameterString("faccd", UserData.GetUserData().FactoryCode); sqlParameter.AddParameterInteger("isdeleted", Convert.ToInt32(GlobalMasterDataTypeEnum.FLAG_ON.GetValue())); UpdateResultVo outVo = new UpdateResultVo { AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter) }; return(outVo); }
/// <summary> /// selects user record for updation and show inspectionformat form /// </summary> private void BindUpdateInspectionFormatData() { int selectedrowindex = InspectionFormatDetails_dgv.SelectedCells[0].RowIndex; InspectionFormatVo selectedInspectionFormat = (InspectionFormatVo)InspectionFormatDetails_dgv.Rows[selectedrowindex].DataBoundItem; AddInspectionFormatMasterForm newAddForm = new AddInspectionFormatMasterForm(CommonConstants.MODE_UPDATE, selectedInspectionFormat); newAddForm.ShowDialog(this); if (newAddForm.IntSuccess > 0) { messageData = new MessageData("mmci00002", Properties.Resources.mmci00002, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); GridBind(FormConditionVo()); InspectionFormatDetails_dgv.Rows[selectedrowindex].Selected = true; InspectionFormatDetails_dgv_CellClick(this, new DataGridViewCellEventArgs(0, selectedrowindex)); InspectionFormatDetails_dgv.FirstDisplayedScrollingRowIndex = selectedrowindex; } else if (newAddForm.IntSuccess == 0) { messageData = new MessageData("mmci00007", Properties.Resources.mmci00007, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); GridBind(FormConditionVo()); } }
/// <summary> /// Creates seacrh condition as per user inputs /// </summary> /// <returns>search condition</returns> protected InspectionFormatVo FormConditionVo() { InspectionFormatVo inVo = new InspectionFormatVo(); if (InspectionFormatCode_txt.Text != string.Empty) { inVo.InspectionFormatCode = InspectionFormatCode_txt.Text; } if (InspectionFormatName_txt.Text != string.Empty) { inVo.InspectionFormatName = InspectionFormatName_txt.Text; } //if(ItemId_cmb.SelectedIndex > -1) //{ // inVo.SapItemCode = ItemId_cmb.SelectedValue.ToString(); //} if (ItemCode_txt.Text != string.Empty) // && sapItemGlobalVo != null { inVo.SapItemCode = ItemCode_txt.Text; // sapItemGlobalVo.SapItemCode; } if (LineId_cmb.SelectedIndex > -1) { inVo.LineCode = LineId_cmb.SelectedValue.ToString(); } return(inVo); }
/// <summary> /// event to delete the selected record /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Delete_btn_Click(object sender, EventArgs e) { int selectedrowindex = InspectionFormatDetails_dgv.SelectedCells[0].RowIndex; DataGridViewRow selectedRow = InspectionFormatDetails_dgv.Rows[selectedrowindex]; messageData = new MessageData("mmcc00004", Properties.Resources.mmcc00004, selectedRow.Cells["colInspectionFormatName"].Value.ToString()); DialogResult dialogResult = popUpMessage.ConfirmationOkCancel(messageData, Text); if (dialogResult == DialogResult.OK) { InspectionFormatVo inVo = new InspectionFormatVo { InspectionFormatId = Convert.ToInt32(selectedRow.Cells["colInspectionFormatId"].Value), InspectionFormatCode = selectedRow.Cells["colInspectionFormatCode"].Value.ToString(), }; try { // InspectionFormatVo checkVo = CheckRelation(inVo); //if (checkVo != null && checkVo.InspectionFormatId > 0) //{ // messageData = new MessageData("mmci00022", Properties.Resources.mmci00022, null); // popUpMessage.Information(messageData, Text); // return; //} UpdateResultVo outVo = (UpdateResultVo)base.InvokeCbm(new UpdateInspectionFormatDeleteFlagMasterMntCbm(), inVo, false); if (outVo.AffectedCount > 0) { messageData = new MessageData("mmci00003", Properties.Resources.mmci00003, null); logger.Info(messageData); popUpMessage.Information(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 } }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { InspectionFormatVo inVo = (InspectionFormatVo)arg; StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append("Insert into m_inspection_format"); sqlQuery.Append(" ( "); sqlQuery.Append(" inspection_format_cd, "); sqlQuery.Append(" inspection_format_name, "); sqlQuery.Append(" registration_user_cd, "); sqlQuery.Append(" registration_date_time, "); sqlQuery.Append(" is_deleted, "); sqlQuery.Append(" factory_cd "); sqlQuery.Append(" ) "); sqlQuery.Append("VALUES "); sqlQuery.Append(" ( "); sqlQuery.Append(" :inspectionformatcd ,"); sqlQuery.Append(" :inspectionformatname ,"); sqlQuery.Append(" :registrationusercode ,"); sqlQuery.Append(" :regdatetime ,"); sqlQuery.Append(" :isdeleted, "); sqlQuery.Append(" :factorycode "); sqlQuery.Append(" ) "); sqlQuery.Append("RETURNING inspection_format_id;"); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterString("inspectionformatcd", inVo.InspectionFormatCode); sqlParameter.AddParameterString("inspectionformatname", inVo.InspectionFormatName); UserData userdata = trxContext.UserData; sqlParameter.AddParameterString("registrationusercode", userdata.UserCode); sqlParameter.AddParameterDateTime("regdatetime", trxContext.ProcessingDBDateTime); sqlParameter.AddParameterString("factorycode", userdata.FactoryCode); sqlParameter.AddParameterString("isdeleted", GlobalMasterDataTypeEnum.FLAG_OFF.GetValue().ToString()); IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); InspectionFormatVo outVo = null; while (dataReader.Read()) { outVo = new InspectionFormatVo(); outVo.InspectionFormatId = ConvertDBNull <int>(dataReader, "inspection_format_id"); } dataReader.Close(); return(outVo); }
/// <summary> /// Fills all user records to gridview control /// </summary> protected void GridBind(InspectionFormatVo conditionInVo) { if (conditionInVo == null) { return; } Process_btn.Enabled = false; Update_btn.Enabled = false; Delete_btn.Enabled = false; InspectionFormatDetails_dgv.DataSource = null; ValueObjectList <InspectionFormatVo> outVo = null; try { outVo = (ValueObjectList <InspectionFormatVo>)base.InvokeCbm(new GetInspectionFormatMasterMntCbm(), 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; } InspectionFormatDetails_dgv.AutoGenerateColumns = false; BindingSource bindingSource1 = new BindingSource(outVo.GetList(), null); if (bindingSource1 != null && bindingSource1.Count > 0) { InspectionFormatDetails_dgv.DataSource = bindingSource1; } else { messageData = new MessageData("mmci00006", Properties.Resources.mmci00006, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); } ChangeGridDataColorForRelationDataCheck(); InspectionFormatDetails_dgv.ClearSelection(); }
private void Process_btn_Click(object sender, EventArgs e) { int selectedrowindex = InspectionFormatDetails_dgv.SelectedCells[0].RowIndex; InspectionFormatVo selectedInspectionFormat = (InspectionFormatVo)InspectionFormatDetails_dgv.Rows[selectedrowindex].DataBoundItem; InspectionProcessForFormatForm frm = new InspectionProcessForFormatForm(); frm.FormatId = selectedInspectionFormat.InspectionFormatId; frm.FormatCode = selectedInspectionFormat.InspectionFormatCode; frm.FormatName = selectedInspectionFormat.InspectionFormatName; frm.ShowDialog(); GridBind(FormConditionVo()); }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { InspectionFormatVo inVo = (InspectionFormatVo)arg; StringBuilder sqlQuery = new StringBuilder(); //create SQL sqlQuery.Append(" Select if.inspection_format_id, ip.inspection_format_id as inspectionprocessid "); sqlQuery.Append(" from m_inspection_format if "); sqlQuery.Append(" left join m_inspection_process ip on "); sqlQuery.Append(" ip.inspection_format_id = if.inspection_format_id "); //sqlQuery.Append(" left join m_item_line_inspection_format ilif on "); //sqlQuery.Append(" ilif.inspection_format_id = if.inspection_format_id "); sqlQuery.Append(" where if.factory_cd = :faccd "); if (inVo.InspectionFormatCode != null) { sqlQuery.Append(" and UPPER(if.inspection_format_cd) = UPPER(:inspectionformatcd)"); } //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterString("faccd", UserData.GetUserData().FactoryCode); if (inVo.InspectionFormatCode != null) { sqlParameter.AddParameterString("inspectionformatcd", inVo.InspectionFormatCode); } //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); InspectionFormatVo outVo = null; while (dataReader.Read()) { if (outVo == null) { outVo = new InspectionFormatVo(); } outVo.InspectionFormatId = ConvertDBNull <int>(dataReader, "inspectionprocessid"); } dataReader.Close(); return(outVo); }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { InspectionFormatVo inVo = (InspectionFormatVo)arg; StringBuilder sqlQuery = new StringBuilder(); //create SQL sqlQuery.Append("Select Count(*) as InspectionFormatCount from m_inspection_format "); sqlQuery.Append(" where factory_cd = :faccd "); //if (inVo.InspectionFormatCode != null) //{ // sqlQuery.Append(" and UPPER(inspection_format_cd) Like UPPER(:inspectionformatcd) "); //} if (inVo.InspectionFormatName != null) { sqlQuery.Append(" and UPPER(inspection_format_name) = UPPER(:inspectionformatname) "); } //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterString("faccd", UserData.GetUserData().FactoryCode); if (inVo.InspectionFormatName != null) { sqlParameter.AddParameterString("inspectionformatname", inVo.InspectionFormatName); } //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); InspectionFormatVo outVo = new InspectionFormatVo { AffectedCount = 0 }; while (dataReader.Read()) { outVo.AffectedCount = Convert.ToInt32(dataReader["InspectionFormatCount"]); } dataReader.Close(); return(outVo); }
public ValueObject Execute(TransactionContext trxContext, ValueObject vo) { InspectionFormatVo inVo = (InspectionFormatVo)vo; UpdateResultVo OutVo = new UpdateResultVo(); OutVo = (UpdateResultVo)deleteInspectionFormatcbm.Execute(trxContext, inVo); if (OutVo != null && OutVo.AffectedCount > 0) { ItemLineInspectionFormatVo itemlineInVo = new ItemLineInspectionFormatVo(); itemlineInVo.InspectionFormatId = inVo.InspectionFormatId; return(deleteItemLineInspectionFormatMasterMntCbm.Execute(trxContext, itemlineInVo)); } return(OutVo); }
/// <summary> /// event to delete the selected record /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected virtual void Ok_btn_Click(object sender, EventArgs e) { InspectionFormatVo inspectionFormatInVo = (InspectionFormatVo)InspectionFormatDetails_dgv.Rows[InspectionFormatDetails_dgv.CurrentRow.Index].DataBoundItem; InspectionFormatId = inspectionFormatInVo.InspectionFormatId; InspectionFormatName = inspectionFormatInVo.InspectionFormatName; //BindingSource currentDatagridSource = (BindingSource)InspectionFormatDetails_dgv.DataSource; //List<InspectionFormatVo> dataSourceVo = (List<InspectionFormatVo>)currentDatagridSource.DataSource; //InspectionFormatId = dataSourceVo[InspectionFormatDetails_dgv.CurrentRow.Index].InspectionFormatId; //InspectionFormatName = dataSourceVo[InspectionFormatDetails_dgv.CurrentRow.Index].InspectionFormatName; this.Close(); }
/// <summary> /// checks Inspection relation to other tables in DB /// </summary> /// <param name="InspVo"></param> /// <returns></returns> private InspectionFormatVo CheckRelation(InspectionFormatVo InspVo) { InspectionFormatVo outVo = new InspectionFormatVo(); try { outVo = (InspectionFormatVo)base.InvokeCbm(new CheckInspectionFormatRelationCbm(), InspVo, false); } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); } return(outVo); }
/// <summary> /// checks duplicate FactoryCode /// </summary> /// <param name="InspFormatVo"></param> /// <returns></returns> protected InspectionFormatVo DuplicateCheckForUpdate(InspectionFormatVo InspFormatVo) { InspectionFormatVo outVo = new InspectionFormatVo(); try { outVo = (InspectionFormatVo)base.InvokeCbm(new CheckInspectionFormatMasterMntCbm(), InspFormatVo, false); } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); } return(outVo); }
private void ChangeGridDataColorForRelationDataCheck() { foreach (DataGridViewRow row in InspectionFormatDetails_dgv.Rows) { InspectionFormatVo InspectionUpdateVo = (InspectionFormatVo)row.DataBoundItem; if (InspectionUpdateVo.InspectionProcessId == 0) { row.DefaultCellStyle.ForeColor = Color.Red; InspectionUpdateVo.InspectionProcessName = Properties.Resources.mmci00028; } if (InspectionUpdateVo.InspectionItemLineFormatId == 0) { row.DefaultCellStyle.ForeColor = Color.Red; InspectionUpdateVo.InspectionItemLineName = Properties.Resources.mmci00027; } } }
/// <summary> /// constructor /// </summary> /// <param name="pmode"></param> /// <param name="factoryItem"></param> public AddInspectionFormatMasterForm(string pmode, InspectionFormatVo InspectionFormatItem = null) { InitializeComponent(); mode = pmode; updateData = InspectionFormatItem; if (string.Equals(mode, CommonConstants.MODE_UPDATE)) { this.Text = UpdateText_lbl.Text; sapItemSearchVo = new SapItemSearchVo(); sapItemSearchVo.SapItemCode = updateData.SapItemCode; sapItemSearchVo.SapItemName = updateData.SapItemName; sapItemSearchVo.SapMaterialGroupId = updateData.SapMaterialGroupId; } }
/// <summary> /// For setting selected factory record into respective controls(textbox and combobox) for update operation /// passing selected factory data as parameter /// </summary> /// <param name="dgvInspectionFormat"></param> private void LoadInspectionFormatData(InspectionFormatVo dgvInspectionFormat) { if (dgvInspectionFormat != null) { SampleName_lbl.Text = dgvInspectionFormat.InspectionFormatName; if (dgvInspectionFormat.InspectionFormatCode.Length > 5) { this.InspectionFormatName_txt.Text = dgvInspectionFormat.InspectionFormatName.Replace(dgvInspectionFormat.InspectionFormatCode.Substring(0, dgvInspectionFormat.InspectionFormatCode.Length - 5), ""); } else { this.InspectionFormatName_txt.Text = dgvInspectionFormat.InspectionFormatName; } //this.ItemId_cmb.SelectedValue = dgvInspectionFormat.SapItemCode; this.ItemCode_txt.Text = dgvInspectionFormat.SapItemCode; // + " - " + dgvInspectionFormat.SapItemName; this.LineId_cmb.SelectedValue = dgvInspectionFormat.LineCode; } }
public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { InspectionFormatVo inVo = (InspectionFormatVo)vo; StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append("Select count(ir.inspection_report_id) as duplicate_report "); sqlQuery.Append(" from sap_item si "); sqlQuery.Append(" inner join m_item_line_inspection_format ilif on ilif.sap_matnr_item_cd = si.sap_matnr_item_cd "); sqlQuery.Append(" inner join m_line ml on ilif.line_id = ml.line_id "); sqlQuery.Append(" inner join t_inspection_report ir on ir.item_line_inspection_format_id = ilif.item_line_inspection_format_id "); sqlQuery.Append(" where ir.factory_cd = :faccd "); if (inVo.InspectionFormatId > 0) { sqlQuery.Append(" and ilif.inspection_format_id = :inspectionformatid "); } //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterString("faccd", UserData.GetUserData().FactoryCode); sqlParameter.AddParameterInteger("inspectionformatid", inVo.InspectionFormatId); //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); UpdateResultVo outVo = new UpdateResultVo(); while (dataReader.Read()) { outVo.AffectedCount = Convert.ToInt32(dataReader["duplicate_report"]); } dataReader.Close(); return(outVo); }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { InspectionFormatVo inVo = (InspectionFormatVo)arg; StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append(" Select "); sqlQuery.Append(" inspection_format_cd "); sqlQuery.Append(" From "); sqlQuery.Append(" m_inspection_format if "); sqlQuery.Append(" inner join "); sqlQuery.Append(" m_item_line_inspection_format ilf "); sqlQuery.Append(" on if.inspection_format_id = ilf.inspection_format_id "); sqlQuery.Append(" where if.factory_cd = :factorycode "); sqlQuery.Append(" and ilf.sap_matnr_item_cd = :sapitemcd "); sqlQuery.Append(" and ilf.line_id = :lineid "); sqlQuery.Append(" order by if.inspection_format_id desc "); sqlQuery.Append(" limit 1"); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterString("sapitemcd", inVo.SapItemCode); sqlParameter.AddParameterInteger("lineid", inVo.LineId); sqlParameter.AddParameterString("factorycode", trxContext.UserData.FactoryCode); //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); InspectionFormatVo outVo = new InspectionFormatVo(); while (dataReader.Read()) { outVo.InspectionFormatCode = ConvertDBNull <string>(dataReader, "inspection_format_cd"); } dataReader.Close(); return(outVo); }
/// <summary> /// To get the Format Id based on Process id /// </summary> /// <param name="inspectionprocessid"></param> /// <returns></returns> public InspectionFormatVo getFormatDetails(CopyInspectionFormatVo inVo) { InspectionFormatVo outVo = null; try { outVo = (InspectionFormatVo)DefaultCbmInvoker.Invoke(new GetInspectionFormatDetailForCopyFunctionMasterMntCbm(), inVo); } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), null); logger.Error(exception.GetMessageData()); } if (outVo != null && outVo.InspectionFormatId > 0) { outVo.InspectionFormatCode = outVo.InspectionFormatCode.Substring(0, outVo.InspectionFormatCode.Length - 6); outVo.InspectionFormatIdCopy = outVo.InspectionFormatId; } return(outVo); }
/// <summary> /// To get the Format Id based on item id /// </summary> /// <param name="inspectionprocessid"></param> /// <returns></returns> private InspectionFormatVo FormFormatVo(int inspectionitemid) { InspectionFormatVo outVo = null; CopyInspectionFormatVo inVo = new CopyInspectionFormatVo(); inVo.InspectionItemId = inspectionitemid; try { outVo = (InspectionFormatVo)base.InvokeCbm(new GetInspectionFormatDetailForCopyFunctionMasterMntCbm(), inVo, false); } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); } if (outVo != null && outVo.InspectionFormatId > 0) { outVo.InspectionFormatCode = outVo.InspectionFormatCode.Substring(0, outVo.InspectionFormatCode.Length - 6); outVo.InspectionFormatIdCopy = outVo.InspectionFormatId; } return(outVo); }
public ValueObject Execute(TransactionContext trxContext, ValueObject vo) { InspectionFormatVo inVo = (InspectionFormatVo)vo; InspectionFormatVo OutVo = null; int SerialNumber = 1; InspectionFormatVo getseqVo = (InspectionFormatVo)getInspectionFormatLastRecordforSerailNoMasterMnt.Execute(trxContext, vo); if (getseqVo != null && getseqVo.InspectionFormatCode != null) { string[] splitval = getseqVo.InspectionFormatCode.Split(Convert.ToChar(GlobalMasterDataTypeEnum.CODE_SEPARATOR.GetValue())); if (splitval.Length > 3) { if (splitval[splitval.Length - 1].All(Char.IsDigit)) { SerialNumber = Convert.ToInt32(splitval[splitval.Length - 1]) + 1; } } } inVo.InspectionFormatCode = inVo.InspectionFormatCode + GlobalMasterDataTypeEnum.CODE_SEPARATOR.GetValue() + SerialNumber.ToString().PadLeft(5, '0'); inVo.InspectionFormatSeq = getseqVo.InspectionFormatSeq; InspectionFormatVo returnformatidVo = (InspectionFormatVo)addInspectionFormatCbm.Execute(trxContext, inVo); if (returnformatidVo != null && returnformatidVo.InspectionFormatId > 0) { ItemLineInspectionFormatVo itemlineInVo = new ItemLineInspectionFormatVo(); itemlineInVo.InspectionFormatId = returnformatidVo.InspectionFormatId; itemlineInVo.SapItemCode = inVo.SapItemCode; itemlineInVo.LineId = inVo.LineId; ItemLineInspectionFormatVo ItemlineOutVo = (ItemLineInspectionFormatVo)addItemLineInspectionFormatMasterMntCbm.Execute(trxContext, itemlineInVo); if (ItemlineOutVo != null) { OutVo = new InspectionFormatVo(); OutVo.AffectedCount = ItemlineOutVo.AffectedCount; OutVo.InspectionFormatId = returnformatidVo.InspectionFormatId; OutVo.InspectionFormatCode = inVo.InspectionFormatCode; } } return(OutVo); }
private void FormatCopy_cntxMnu_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { if (string.IsNullOrEmpty(e.ClickedItem.Text) || InspectionFormatDetails_dgv.Rows.Count == 0) { return; } if (InspectionFormatDetails_dgv.SelectedRows.Count > 0) { FormatCopy_cntxMnu.Items.Clear(); this.Cursor = Cursors.WaitCursor; int selectedrowindex = InspectionFormatDetails_dgv.SelectedCells[0].RowIndex; InspectionFormatVo InspectionCopyVo = (InspectionFormatVo)InspectionFormatDetails_dgv.Rows[selectedrowindex].DataBoundItem; InspectionFormatVo inspectionInVo = new InspectionFormatVo(); inspectionInVo.InspectionFormatIdCopy = InspectionCopyVo.InspectionFormatId; inspectionInVo.InspectionFormatName = InspectionCopyVo.InspectionFormatName; AddInspectionFormatMasterForm newAddForm = new AddInspectionFormatMasterForm(CommonConstants.MODE_ADD, inspectionInVo); newAddForm.ShowDialog(); if (newAddForm.IntSuccess > 0) { messageData = new MessageData("mmci00001", Properties.Resources.mmci00001, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); GridBind(FormConditionVo()); if (InspectionFormatDetails_dgv.Rows.Count > 0 && InspectionFormatDetails_dgv.Columns.Count > 0 && InspectionFormatDetails_dgv.Columns["colInspectionFormatId"] != null) { int searchItemId; if (newAddForm.IntSuccess > 0) { searchItemId = newAddForm.IntSuccess; } else { searchItemId = 0; } DataGridViewRow row = InspectionFormatDetails_dgv.Rows .Cast <DataGridViewRow>() .FirstOrDefault(r => r.Cells["colInspectionFormatId"].Value.ToString().Equals(searchItemId.ToString())); if (row == null) { return; } InspectionFormatDetails_dgv.Rows[row.Index].Selected = true; InspectionFormatDetails_dgv_CellClick(sender, new DataGridViewCellEventArgs(0, row.Index)); InspectionFormatDetails_dgv.FirstDisplayedScrollingRowIndex = row.Index; } } this.Cursor = Cursors.Default; } }
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)); }
/// <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 = InspectionSelectionValue_dgv.SelectedCells[0].RowIndex; DataGridViewRow selectedRow = InspectionSelectionValue_dgv.Rows[selectedrowindex]; messageData = new MessageData("mmcc00004", Properties.Resources.mmcc00004, selectedRow.Cells["colInspectionItemSelectionValueText"].Value.ToString()); // Logger.Info(messageData); DialogResult dialogResult = popUpMessage.ConfirmationOkCancel(messageData, Text); if (dialogResult == DialogResult.OK) { InspectionItemSelectionDatatypeValueVo inVo = new InspectionItemSelectionDatatypeValueVo(); inVo.InspectionItemSelectionDatatypeValueId = Convert.ToInt32(selectedRow.Cells["colInspectionItemSelectionDatatypeValueId"].Value.ToString()); inVo.DeleteFlag = true; if (inspectionItemdata != null) { inVo.InspectionItemId = inspectionItemdata.InspectionItemId; } else { inVo.InspectionItemId = InspectionItemId; } //UpdateInspectionItemSelectionDatatypeValueVo = inVo; //this.Close(); try { UpdateResultVo deleteVo = null; if (inspectionItemdata == null) { deleteVo = (UpdateResultVo)base.InvokeCbm(new DeleteInspectionItemSelectionDatatypeValueCbm(), inVo, false); if (deleteVo == null) { return; } IntSuccess = deleteVo.AffectedCount; if (deleteVo.AffectedCount > 0) { this.messageData = new MessageData("mmci00003", Properties.Resources.mmci00003, null); logger.Info(this.messageData); popUpMessage.Information(this.messageData, Text); } else if (deleteVo.AffectedCount == 0) { messageData = new MessageData("mmci00007", Properties.Resources.mmci00007, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); } GridBind(); } else { string message = string.Format(Properties.Resources.mmci00038, "Inspection Item Selection Datatype Value", selectedRow.Cells["colInspectionItemSelectionValueText"].Value.ToString()); StartProgress(message); ValueObjectList <ValueObject> inVoList = new ValueObjectList <ValueObject>(); InspectionFormatVo passformatVo = FormFormatVo(inspectionItemdata.InspectionItemId); if (passformatVo == null || passformatVo.InspectionFormatId == 0) { return; } inVoList.add(passformatVo); inVoList.add(null); inVoList.add(null); inVoList.add(inVo); 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.AffectedCount; InspectionItemId = outVo.InspectionItemId; inspectionItemdata.InspectionItemId = outVo.InspectionItemId; InspectionFormatProcessBuzzLogic getprocessid = new InspectionFormatProcessBuzzLogic(); InspectionReturnVo invo = new InspectionReturnVo(); invo.InspectionItemId = outVo.InspectionItemId; InspectionReturnVo getInspectionVo = getprocessid.RefreshAllFormGrid(invo); if (getInspectionVo != null && getInspectionVo.InspectionProcessId > 0) { InspectionProcessId = getInspectionVo.InspectionProcessId; } this.messageData = new MessageData("mmci00003", Properties.Resources.mmci00003, null); logger.Info(this.messageData); popUpMessage.Information(this.messageData, Text); GridBind(); } else { messageData = new MessageData("mmci00007", Properties.Resources.mmci00007, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); } } } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); } //string message = string.Format(Properties.Resources.mmci00038, "Inspection Selection DataType Value", selectedRow.Cells["colInspectionItemSelectionValueText"].Value.ToString()); //StartProgress(message); //ValueObjectList<ValueObject> inVoList = new ValueObjectList<ValueObject>(); //InspectionFormatVo passformatVo = FormFormatVo(inspectionItemdata.InspectionItemId); //if (passformatVo == null || passformatVo.InspectionFormatId == 0) return; //inVoList.add(passformatVo); //inVoList.add(null); //inVoList.add(null); //inVoList.add(inVo); //inVoList.add(null); //inVoList.add(null); //inVoList.add(null); //UpdateResultVo outVo = (UpdateResultVo)base.InvokeCbm(new UpdateAllInspectionFunctionMasterMntCbm(), inVoList, false); //CompleteProgress(); //if (outVo == null) { return; } //try //{ // UpdateResultVo outVo = (UpdateResultVo)base.InvokeCbm(new DeleteInspectionItemSelectionDatatypeValueCbm(), inVo, false); // if (outVo.AffectedCount > 0) // { // this.messageData = new MessageData("mmci00003", Properties.Resources.mmci00003, null); // logger.Info(this.messageData); // popUpMessage.Information(this.messageData, Text); // } // 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 override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { CopyInspectionFormatVo inVo = (CopyInspectionFormatVo)arg; StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append(" select distinct if.* "); sqlQuery.Append(" ,ilf.line_id,ilf.sap_matnr_item_cd "); sqlQuery.Append(" from m_inspection_format if "); sqlQuery.Append(" inner join m_item_line_inspection_format ilf "); sqlQuery.Append(" on if.inspection_format_id = ilf.inspection_format_id "); sqlQuery.Append(" left join "); sqlQuery.Append(" m_inspection_process ip "); sqlQuery.Append(" on ip.inspection_format_id = if.inspection_format_id "); sqlQuery.Append(" left join "); sqlQuery.Append(" m_inspection_item it "); sqlQuery.Append(" on it.inspection_process_id = ip.inspection_process_id "); sqlQuery.Append(" left join "); sqlQuery.Append(" m_inspection_specification isn "); sqlQuery.Append(" on isn.inspection_item_id = it.inspection_item_id "); sqlQuery.Append(" left join "); sqlQuery.Append(" m_inspection_test_instruction ti on "); sqlQuery.Append(" ti.inspection_item_id = it.inspection_item_id "); sqlQuery.Append(" left join "); sqlQuery.Append(" m_inspection_item_selection_datatype_value sv "); sqlQuery.Append(" on sv.inspection_item_id = it.inspection_item_id "); sqlQuery.Append(" left join m_inspection_test_instruction_detail itd "); sqlQuery.Append(" on itd.inspection_test_instruction_id = ti.inspection_test_instruction_id "); sqlQuery.Append(" where if.factory_cd = :factorycd "); if (inVo.InspectionFormatId > 0) { sqlQuery.Append(" and if.inspection_format_id = :inspectionformatid "); } if (inVo.InspectionProcessId > 0) { sqlQuery.Append(" and ip.inspection_process_id = :inspectionprocessid "); } if (inVo.InspectionItemId > 0) { sqlQuery.Append(" and it.inspection_item_id = :inspectionitemid "); } if (inVo.InspectionSelectionDataTypeValueId > 0) { sqlQuery.Append(" and sv.inspection_item_selection_datatype_value_id = :selectiondatatypevalueid"); } if (inVo.InspectionSpecificationId > 0) { sqlQuery.Append(" and isn.inspection_specification_id = :inspectionspecificationid "); } if (inVo.InspectionTestInstructionId > 0) { sqlQuery.Append(" and ti.inspection_test_instruction_id = :inspectiontestinstructionid "); } if (inVo.InspectionTestInstructionDetailId > 0) { sqlQuery.Append(" and itd.inspection_test_instruction_detail_id = :inspectiontestinstdetailid "); } //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterInteger("inspectionformatid", inVo.InspectionFormatId); sqlParameter.AddParameterInteger("inspectionprocessid", inVo.InspectionProcessId); sqlParameter.AddParameterInteger("inspectionitemid", inVo.InspectionItemId); sqlParameter.AddParameterInteger("selectiondatatypevalueid", inVo.InspectionSelectionDataTypeValueId); sqlParameter.AddParameterInteger("inspectionspecificationid", inVo.InspectionSpecificationId); sqlParameter.AddParameterInteger("inspectiontestinstructionid", inVo.InspectionTestInstructionId); sqlParameter.AddParameterInteger("inspectiontestinstdetailid", inVo.InspectionTestInstructionDetailId); sqlParameter.AddParameterString("factorycd", trxContext.UserData.FactoryCode); //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); InspectionFormatVo outVo = new InspectionFormatVo(); while (dataReader.Read()) { outVo = new InspectionFormatVo(); outVo.InspectionFormatId = ConvertDBNull <Int32>(dataReader, "inspection_format_id"); outVo.InspectionFormatCode = ConvertDBNull <string>(dataReader, "inspection_format_cd"); outVo.InspectionFormatName = ConvertDBNull <string>(dataReader, "inspection_format_name"); outVo.SapItemCode = ConvertDBNull <string>(dataReader, "sap_matnr_item_cd"); //outVo.ItemCode = ConvertDBNull<string>(dataReader, "global_item_cd"); outVo.LineId = ConvertDBNull <int>(dataReader, "line_id"); //outVo.LineCode = ConvertDBNull<string>(dataReader, "line_cd"); } dataReader.Close(); return(outVo); }
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]; outVo = new InspectionReturnVo(); if (updateprocessVo != null && updateprocessVo.DeleteFlag) { InspectionProcessVo inspectionProcessVo = new InspectionProcessVo(); //delete inspectionprocess inspectionProcessVo = (InspectionProcessVo)deleteInspectionProcessMasterMntCbm.Execute(trxContext, updateprocessVo); InspectionItemVo InItemVo = new InspectionItemVo(); InItemVo.InspectionProcessId = updateprocessVo.InspectionProcessId; //get inspection item id ValueObjectList <InspectionItemVo> InspectionItemVo = (ValueObjectList <InspectionItemVo>)getInspectionItemMasterCbm.Execute(trxContext, InItemVo); if (InspectionItemVo == null || InspectionItemVo.GetList() == null || InspectionItemVo.GetList().Count == 0) { outVo.AffectedCount = inspectionProcessVo.AffectedCount; outVo.InspectionFormatId = updateFormatVo.InspectionFormatIdCopy; return(outVo); } foreach (InspectionItemVo getitemVo in InspectionItemVo.GetList()) { InspectionItemSelectionDatatypeValueVo deleteInspectionItemSelectionDatatypeValueVo = new InspectionItemSelectionDatatypeValueVo(); deleteInspectionItemSelectionDatatypeValueVo.InspectionItemId = getitemVo.InspectionItemId; //delete inspectionitemselectionvalue UpdateResultVo inspectionItemSelectionDatatypeValueVo = (UpdateResultVo)deleteInspectionItemSelectionDatatypeValueCbm.Execute(trxContext, deleteInspectionItemSelectionDatatypeValueVo); InspectionSpecificationVo deleteSpecInVo = new InspectionSpecificationVo(); deleteSpecInVo.InspectionItemId = getitemVo.InspectionItemId; //delete inspectionspecification InspectionSpecificationVo inspectionSpecificationVo = (InspectionSpecificationVo)deleteInspectionSpecificationMasterMntCbm.Execute(trxContext, deleteSpecInVo); InspectionTestInstructionVo inTestVo = new InspectionTestInstructionVo(); inTestVo.InspectionItemId = getitemVo.InspectionItemId; //get inspectiontestinstruction id ValueObjectList <InspectionTestInstructionVo> inspectionTestInstructionVo = (ValueObjectList <InspectionTestInstructionVo>)getInspectionTestInstructionMasterMntCbm.Execute(trxContext, inTestVo); if (inspectionTestInstructionVo != null && inspectionTestInstructionVo.GetList() != null && inspectionTestInstructionVo.GetList().Count > 0) { //delete inspectiontestinstruction InspectionTestInstructionVo deleteInspectionTestInstructionVo = (InspectionTestInstructionVo)deleteInspectionTestInstructionMasterMntNewCbm.Execute(trxContext, inspectionTestInstructionVo.GetList()[0]); } //delete inspectionitem InspectionItemVo deleteinspectionItemVo = (InspectionItemVo)deleteInspectionItemMasterMntCbm.Execute(trxContext, getitemVo); } outVo.AffectedCount = inspectionProcessVo.AffectedCount; outVo.InspectionFormatId = updateFormatVo.InspectionFormatIdCopy; return(outVo); } else if (updateitemVo != null && updateitemVo.DeleteFlag) { InspectionItemSelectionDatatypeValueVo deleteInspectionItemSelectionDatatypeValueVo = new InspectionItemSelectionDatatypeValueVo(); deleteInspectionItemSelectionDatatypeValueVo.InspectionItemId = updateitemVo.InspectionItemId; //delete inspectionitemselectionvalue UpdateResultVo inspectionItemSelectionDatatypeValueVo = (UpdateResultVo)deleteInspectionItemSelectionDatatypeValueCbm.Execute(trxContext, deleteInspectionItemSelectionDatatypeValueVo); InspectionSpecificationVo deleteSpecInVo = new InspectionSpecificationVo(); deleteSpecInVo.InspectionItemId = updateitemVo.InspectionItemId; //delete inspectionspecification InspectionSpecificationVo inspectionSpecificationVo = (InspectionSpecificationVo)deleteInspectionSpecificationMasterMntCbm.Execute(trxContext, deleteSpecInVo); InspectionTestInstructionVo inTestVo = new InspectionTestInstructionVo(); inTestVo.InspectionItemId = updateitemVo.InspectionItemId; //get inspectiontestinstruction id ValueObjectList <InspectionTestInstructionVo> inspectionTestInstructionVo = (ValueObjectList <InspectionTestInstructionVo>)getInspectionTestInstructionMasterMntCbm.Execute(trxContext, inTestVo); if (inspectionTestInstructionVo != null && inspectionTestInstructionVo.GetList() != null && inspectionTestInstructionVo.GetList().Count > 0) { //delete inspectiontestinstruction InspectionTestInstructionVo deleteInspectionTestInstructionVo = (InspectionTestInstructionVo)deleteInspectionTestInstructionMasterMntNewCbm.Execute(trxContext, inspectionTestInstructionVo.GetList()[0]); } //delete inspectionitem InspectionItemVo deleteinspectionItemVo = (InspectionItemVo)deleteInspectionItemMasterMntCbm.Execute(trxContext, updateitemVo); outVo.AffectedCount = deleteinspectionItemVo.AffectedCount; outVo.InspectionProcessId = updateitemVo.InspectionProcessId; return(outVo); } else if (updateSelectionDataTypeValueVo != null && updateSelectionDataTypeValueVo.DeleteFlag) { //delete inspectionitemselectionvalue UpdateResultVo inspectionItemSelectionDatatypeValueVo = (UpdateResultVo)deleteInspectionItemSelectionDatatypeValueCbm.Execute(trxContext, updateSelectionDataTypeValueVo); outVo.AffectedCount = inspectionItemSelectionDatatypeValueVo.AffectedCount; outVo.InspectionItemId = updateSelectionDataTypeValueVo.InspectionItemId; return(outVo); } else if (updateSpecificationVo != null && updateSpecificationVo.DeleteFlag) { //delete inspectionspecification InspectionSpecificationVo deleteinspectionSpecificationVo = (InspectionSpecificationVo)deleteInspectionSpecificationMasterMntCbm.Execute(trxContext, updateSpecificationVo); outVo.AffectedCount = deleteinspectionSpecificationVo.AffectedCount; outVo.InspectionItemId = updateSpecificationVo.InspectionItemId; return(outVo); } else if (updateTestInstructionVo != null && updateTestInstructionVo.DeleteFlag) { //delete inspectiontestinstruction InspectionTestInstructionVo deleteinspectionTestInstructionVo = (InspectionTestInstructionVo)deleteInspectionTestInstructionMasterMntNewCbm.Execute(trxContext, updateTestInstructionVo); outVo.AffectedCount = deleteinspectionTestInstructionVo.AffectedCount; outVo.InspectionItemId = updateTestInstructionVo.InspectionItemId; outVo.InspectionTestInstructionId = updateTestInstructionVo.InspectionTestInstructionId; return(outVo); } else if (updateTestInstructionDetailVo != null && updateTestInstructionDetailVo.DeleteFlag) { //delete inspectiontestinstructiondetail InspectionTestInstructionVo deleteInspectionTestInstructionDetailVo = (InspectionTestInstructionVo)deleteInspectionTestInstructionDetailMasterMntCbm.Execute(trxContext, updateTestInstructionDetailVo); outVo.AffectedCount = deleteInspectionTestInstructionDetailVo.AffectedCount; outVo.InspectionTestInstructionId = updateTestInstructionDetailVo.InspectionTestInstructionId; return(outVo); } 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 = 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) { ValueObjectList <ValueObject> inVo = (ValueObjectList <ValueObject>)vo; InspectionFormatVo FormatVo = (InspectionFormatVo)inVo.GetList()[0]; InspectionProcessVo UpdateProcessVo = (InspectionProcessVo)inVo.GetList()[1]; ValueObjectList <InspectionProcessVo> inspectionProcessListInVo = new ValueObjectList <InspectionProcessVo>(); ValueObjectList <InspectionProcessVo> inspectionProcessInsertedListInVo = new ValueObjectList <InspectionProcessVo>(); ValueObjectList <ValueObjectList <ValueObject> > outVo = null; InspectionProcessVo returnProcessInsertedVo = null; int InspFormatId = 0; //get inspection process master data for the formatid InspectionProcessVo ProcessInVo = new InspectionProcessVo(); ProcessInVo.InspectionFormatId = FormatVo.InspectionFormatIdCopy; inspectionProcessListInVo = (ValueObjectList <InspectionProcessVo>)getInspectionProcessMasterMntCbm.Execute(trxContext, ProcessInVo); //if process data not found return the vo if (inspectionProcessListInVo == null || inspectionProcessListInVo.GetList() == null || inspectionProcessListInVo.GetList().Count == 0) { return(outVo); } int processCount = 1; inspectionProcessListInVo.GetList().ForEach(v => { v.InspectionProcessCode = FormatVo.InspectionFormatCode + GlobalMasterDataTypeEnum.CODE_SEPARATOR.GetValue() + GlobalMasterDataTypeEnum.PROCESS_CODE.GetValue() + GlobalMasterDataTypeEnum.CODE_SEPARATOR.GetValue() + processCount; v.InspectionFormatId = FormatVo.InspectionFormatId; processCount += 1; }); if (UpdateProcessVo != null && UpdateProcessVo.InspectionProcessId > 0) { if (UpdateProcessVo.DeleteFlag) { inspectionProcessListInVo.GetList().Remove(inspectionProcessListInVo.GetList().Single(v => v.InspectionProcessId == UpdateProcessVo.InspectionProcessId)); } else { foreach (InspectionProcessVo processVo in inspectionProcessListInVo.GetList().Where(v => v.InspectionProcessId == UpdateProcessVo.InspectionProcessId)) { processVo.InspectionProcessName = UpdateProcessVo.InspectionProcessName; } } } returnProcessInsertedVo = (InspectionProcessVo)addInspectionProcessMasterMntCbm.Execute(trxContext, inspectionProcessListInVo); ProcessInVo.InspectionFormatId = FormatVo.InspectionFormatId; inspectionProcessInsertedListInVo = (ValueObjectList <InspectionProcessVo>)getInspectionProcessMasterMntCbm.Execute(trxContext, ProcessInVo); foreach (InspectionProcessVo OldProcessVo in inspectionProcessListInVo.GetList()) { InspectionProcessVo NewProcessVo = null; ValueObjectList <ValueObject> CombinationVo = new ValueObjectList <ValueObject>(); foreach (InspectionProcessVo processVo in inspectionProcessInsertedListInVo.GetList().Where(v => v.InspectionProcessCode == OldProcessVo.InspectionProcessCode)) { NewProcessVo = processVo; } if (InspFormatId == 0) { InspFormatId = NewProcessVo.InspectionFormatId; } CombinationVo.add(OldProcessVo); CombinationVo.add(NewProcessVo); if (outVo == null) { outVo = new ValueObjectList <ValueObjectList <ValueObject> >(); } outVo.add(CombinationVo); } if (UpdateProcessVo != null) { ValueObjectList <ValueObject> returnOutListVo = new ValueObjectList <ValueObject>(); UpdateProcessVo.InspectionFormatId = InspFormatId; returnOutListVo.add(UpdateProcessVo); outVo.add(returnOutListVo); } return(outVo); }