public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { ProcessWorkVo inVo = (ProcessWorkVo)arg; StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append("Select Count(*) as DisplayCount from m_process_work"); sqlQuery.Append(" where factory_cd = :factcd "); sqlQuery.Append(" and display_order = :displayorder"); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterString("factcd", UserData.GetUserData().FactoryCode); sqlParameter.AddParameterInteger("displayorder", inVo.DisplayOrder); //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); ProcessWorkVo outVo = new ProcessWorkVo(); while (dataReader.Read()) { outVo.AffectedCount = Convert.ToInt32(dataReader["DisplayCount"]); } dataReader.Close(); return(outVo); }
private void LoadProcessWork(int pLineId) { ProcessWorkVo outVo = null; try { outVo = (ProcessWorkVo)DefaultCbmInvoker.Invoke(new GetProcessWorkMasterMntCbm(), new ProcessWorkVo()); outVo.ProcessWorkListVo.ForEach(t => t.ProcessWorkName = string.Concat(t.ProcessWorkCode + " ", t.ProcessWorkName)); } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); } ProcessWorkLineVo processWorkLineInVo = new ProcessWorkLineVo(); processWorkLineInVo.LineId = pLineId; ProcessWorkLineVo processWorkLineOutVo = (ProcessWorkLineVo)DefaultCbmInvoker.Invoke(new GetProcessWorkLineMasterMntCbm(), processWorkLineInVo); if (processWorkLineOutVo != null && pLineId > 0) { foreach (ProcessWorkVo item in outVo.ProcessWorkListVo) { item.IsExists = processWorkLineOutVo.ProcessWorkLineListVo.Exists(t => t.ProcessWorkId == item.ProcessWorkId) ? "True" : "False"; } } CheckAll_chk.Checked = !(outVo.ProcessWorkListVo.Exists(t => t.IsExists == "False")); BindingSource bindingSource = new BindingSource(outVo.ProcessWorkListVo, null); ProcessWork_dgv.AutoGenerateColumns = false; ProcessWork_dgv.DataSource = bindingSource; }
private void AddJigRepairInformationForm_Load(object sender, EventArgs e) { resuft_cmb.Items.Add("OK"); resuft_cmb.Items.Add("NG"); ValueObjectList <ModelVo> modelvolist = (ValueObjectList <ModelVo>)DefaultCbmInvoker.Invoke(new GetModelCbm(), new ModelVo()); model_cmb.DisplayMember = "ModelCode"; BindingSource b1 = new BindingSource(modelvolist.GetList(), null); model_cmb.DataSource = b1; model_cmb.Text = ""; ProcessWorkVo processw = (ProcessWorkVo)DefaultCbmInvoker.Invoke(new GetProcessWorkMasterMntCbm(), new ProcessWorkVo()); process_work_cmb.DisplayMember = "ProcessWorkName"; BindingSource b2 = new BindingSource(processw.ProcessWorkListVo, null); process_work_cmb.DataSource = b2; process_work_cmb.Text = ""; ValueObjectList <JigResponseVo> respmachinevolist = (ValueObjectList <JigResponseVo>)DefaultCbmInvoker.Invoke(new GetJigResponseCbm(), new JigResponseVo()); jigresponse_cmb.DisplayMember = "JigResponseName"; jigresponse_cmb.DataSource = respmachinevolist.GetList(); jigresponse_cmb.Text = ""; ValueObjectList <JigCauseVo> respmachinevolist12 = (ValueObjectList <JigCauseVo>)DefaultCbmInvoker.Invoke(new GetJigCauseCbm(), new JigCauseVo()); jigause_cmb.DisplayMember = "JigCauseName"; jigause_cmb.DataSource = respmachinevolist12.GetList(); jigause_cmb.Text = ""; line_cmb.Text = ""; if (jvo.JigRepairId > 0) { model_cmb.Enabled = false; model_cmb.Text = jvo.ModelCode; process_work_cmb.Text = jvo.ProcessWorkName; line_cmb.Text = jvo.LineCode; jig_code_txt.Text = jvo.JigRepairCode; jigresponse_cmb.Text = jvo.JigResponseName; jigause_cmb.Text = jvo.JigCauseName; resuft_cmb.Text = jvo.JigRepairResult; place_txt.Text = jvo.JigPlace; jigause_cmb.Text = jvo.JigCauseName; afterstatus_txt.Text = jvo.JigAfterRepairStatus; beforestatus_txt.Text = jvo.JigCurrentStatus; timeto_dtp.Value = jvo.TimeTo; timefrom_dtp.Value = jvo.TimeFrom; } }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { ProcessWorkVo inVo = (ProcessWorkVo)arg; StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append("Insert into m_process_work"); sqlQuery.Append(" ( "); sqlQuery.Append(" process_work_cd, "); sqlQuery.Append(" process_work_name, "); sqlQuery.Append(" process_id, "); sqlQuery.Append(" is_phantom,"); sqlQuery.Append(" line_machine_selection ,"); sqlQuery.Append(" display_order ,"); sqlQuery.Append(" registration_user_cd, "); sqlQuery.Append(" registration_date_time, "); sqlQuery.Append(" factory_cd "); sqlQuery.Append(" ) "); sqlQuery.Append("VALUES "); sqlQuery.Append(" ( "); sqlQuery.Append(" :processworkcd ,"); sqlQuery.Append(" :processworkname ,"); sqlQuery.Append(" :processid ,"); sqlQuery.Append(" :isphantom ,"); sqlQuery.Append(" :linemachineselection ,"); sqlQuery.Append(" :displayorder ,"); sqlQuery.Append(" :registrationusercode ,"); sqlQuery.Append(" now() ,"); sqlQuery.Append(" :factorycode "); sqlQuery.Append(" ); "); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterString("processworkcd", inVo.ProcessWorkCode); sqlParameter.AddParameterString("processworkname", inVo.ProcessWorkName); sqlParameter.AddParameterInteger("processid", inVo.ProcessId); sqlParameter.AddParameterString("isphantom", inVo.IsPhantom); sqlParameter.AddParameterInteger("linemachineselection", inVo.LineMachineSelection); sqlParameter.AddParameterInteger("displayorder", inVo.DisplayOrder); sqlParameter.AddParameterString("registrationusercode", inVo.RegistrationUserCode); //sqlParameter.AddParameterDateTime("registrationdatetime", inVo.RegistrationDateTime); sqlParameter.AddParameterString("factorycode", inVo.FactoryCode); ProcessWorkVo outVo = new ProcessWorkVo { AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter) }; return(outVo); }
public AddProcessWorkForm CreateForm(string pmode, ProcessWorkVo userItem = null) { mode = pmode; updateData = userItem; if (string.Equals(mode, CommonConstants.MODE_UPDATE)) { this.Text = UpdateText_lbl.Text; } return(new AddProcessWorkForm()); }
private void process_cmb_SelectedIndexChanged(object sender, EventArgs e) { if (process_cmb.SelectedIndex >= 0) { process_work_cmb.Text = ""; ProcessWorkVo processworkms = (ProcessWorkVo)DefaultCbmInvoker.Invoke(new GetProcessWorkMasterMntCbm(), new ProcessWorkVo { ProcessId = ((ProcessVo)process_cmb.SelectedItem).ProcessId }); process_work_cmb.DisplayMember = "ProcessWorkName"; BindingSource b5 = new BindingSource(processworkms.ProcessWorkListVo, null); process_work_cmb.DataSource = b5; } }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { ProcessWorkVo inVo = (ProcessWorkVo)arg; StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append("select psw.process_work_cd as ProcessWorkCd, pwdr.process_work_id as DefectiveId, "); sqlQuery.Append(" ipw.process_work_id as ItemProcessWorkId,pwls.process_work_id as ProcessSupplierId from m_process_work psw "); sqlQuery.Append(" left outer join m_process_work_defective_reason pwdr on psw.process_work_id = pwdr.process_work_id "); sqlQuery.Append(" left outer join m_item_process_work ipw on psw.process_work_id = ipw.process_work_id "); sqlQuery.Append(" left outer join m_process_work_local_supplier pwls on psw.process_work_id = pwls.process_work_id "); sqlQuery.Append(" where psw.factory_cd = :factcd "); if (inVo.ProcessWorkCode != null) { sqlQuery.Append(" and UPPER(process_work_cd) = UPPER(:processworkcd)"); } //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterString("factcd", UserData.GetUserData().FactoryCode); if (inVo.ProcessWorkCode != null) { sqlParameter.AddParameterString("processworkcd", inVo.ProcessWorkCode); } //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); ProcessWorkVo outVo = new ProcessWorkVo(); while (dataReader.Read()) { //outVo.AffectedCount = Convert.ToInt32(dataReader["WorkCount"]); outVo.DefectiveIdCount = Convert.ToInt32("0" + dataReader["DefectiveId"]); outVo.ItemProcessWorkIdCount = Convert.ToInt32("0" + dataReader["ItemProcessWorkId"]); outVo.ProcessSupplierIdCount = Convert.ToInt32("0" + dataReader["ProcessSupplierId"]); } dataReader.Close(); return(outVo); }
/// <summary> /// To idenctify the relation ship with tables /// </summary> private ProcessWorkVo CheckProcessWorkRelation(ProcessWorkVo inVo) { ProcessWorkVo outVo = new ProcessWorkVo(); try { outVo = outVo = (ProcessWorkVo)base.InvokeCbm(new CheckProcessWorkRelationCbm(), inVo, false); } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); } return(outVo); }
/// <summary> /// checks duplicate Display Record /// </summary> /// <param name="defectVo"></param> /// <returns></returns> private ProcessWorkVo DuplicateDisplayCheck(ProcessWorkVo defectVo) { ProcessWorkVo outVo = new ProcessWorkVo(); try { outVo = (ProcessWorkVo)base.InvokeCbm(new CheckProcessWorkDisplayMasterMntCbm(), defectVo, false); } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); } return(outVo); }
/// <summary> /// binds grid /// </summary> /// <param name="defectiveReasonId"></param> private void BindGrid(int defectiveReasonId) { ProcessWorkVo outVo = null; try { outVo = (ProcessWorkVo)DefaultCbmInvoker.Invoke(new GetProcessWorkMasterMntCbm(), new ProcessWorkVo()); outVo.ProcessWorkListVo.ForEach(t => t.ProcessWorkName = string.Concat(t.ProcessWorkCode + " ", t.ProcessWorkName)); } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); } ProcessDefectiveReasonVo processDefectRsnOutVo = null; ProcessDefectiveReasonVo inVo = new ProcessDefectiveReasonVo(); inVo.DefectiveReasonId = defectiveReasonId; try { processDefectRsnOutVo = (ProcessDefectiveReasonVo)DefaultCbmInvoker.Invoke(new GetProcessDefectiveReasonMasterMntCbm(), inVo); } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); return; } if (outVo != null && defectiveReasonId > 0) { foreach (ProcessWorkVo item in outVo.ProcessWorkListVo) { item.IsExists = processDefectRsnOutVo.ProcessDefectiveReasonListVo.Exists(t => t.ProcessWorkId == item.ProcessWorkId) ? "True" : "False"; } } BindingSource bindingSource = new BindingSource(outVo.ProcessWorkListVo, null); ProcessWork_dgv.AutoGenerateColumns = false; ProcessWork_dgv.DataSource = bindingSource; }
private void process_cmb_SelectedIndexChanged(object sender, EventArgs e) { ProcessWorkVo pvo = (ProcessWorkVo)process_cmb.SelectedItem; ReportDownTimeVo inVo = new ReportDownTimeVo { ProcessWorkId = pvo.ProcessWorkId }; //ReportDownTimeVo outVo = new ReportDownTimeVo(); //outVo = (ReportDownTimeVo)DefaultCbmInvoker.Invoke(new GetProcessMoCbm(), inVo); ValueObjectList <ReportDownTimeVo> outVo = (ValueObjectList <ReportDownTimeVo>)DefaultCbmInvoker.Invoke(new GetProcessMoCbm(), inVo); assy_txt.Text = outVo.GetList()[0].ProcessName; machine_txt.Text = outVo.GetList()[0].MachineName; //ValueObjectList<ProcessWorkVo> prwvo = (ValueObjectList<ProcessWorkVo>)DefaultCbmInvoker.Invoke(new GetCauseAndDefectiveCbm(), new ProcessWorkVo { ProcessWorkId = pvo.ProcessId }); //assy_txt.Text = prwvo.ToString(); //assy_txt.DataSource = prwvo.GetList(); }
/// <summary> /// For setting selected user record into respective controls(textbox and combobox) for update operation /// passing selected user data as parameter /// </summary> /// <param name="dgvMoldType"></param> private void LoadUserData(ProcessWorkVo dgvMoldType) { if (dgvMoldType != null) { this.ProcessWorkCode_txt.Text = dgvMoldType.ProcessWorkCode; this.ProcessWorkName_txt.Text = dgvMoldType.ProcessWorkName; this.Process_cmb.SelectedValue = dgvMoldType.ProcessId.ToString(); // this.isPhantom_cmb.Text = dgvMoldType.IsPhantomDisplay; if (!string.IsNullOrWhiteSpace(dgvMoldType.LineMachineSelectionDisplay)) { this.LineMachineSltn_cmb.Text = dgvMoldType.LineMachineSelectionDisplay.ToString(); } this.DisplayOrder_txt.Text = dgvMoldType.DisplayOrder.ToString(); } }
/// <summary> /// Loads processwork /// </summary> private void GetProcessWork() { try { ProcessWorkVo outVo = null; outVo = (ProcessWorkVo)DefaultCbmInvoker.Invoke(new GetProcessWorkMasterMntCbm(), new ProcessWorkVo()); if (outVo != null && outVo.ProcessWorkListVo.Count > 0) { processWorkList = outVo.ProcessWorkListVo; } } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); } }
/// <summary> /// Loads Process Work /// </summary> private void LoadProcessWork() { ProcessWorkVo outVo = new ProcessWorkVo(); try { outVo = (ProcessWorkVo)base.InvokeCbm(new GetProcessWorkMasterMntCbm(), new ProcessWorkVo(), false); outVo.ProcessWorkListVo.ForEach(p => p.ProcessWorkName = p.ProcessWorkCode + " " + p.ProcessWorkName); } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); Logger.Error(exception.GetMessageData()); return; } ComboBind(ProcessWork_cmb, outVo.ProcessWorkListVo, "ProcessWorkName", "ProcessWorkId"); }
/// <summary> /// Creates seacrh condition as per user inputs /// </summary> /// <returns>search condition</returns> private ProcessWorkVo FormConditionVo() { ProcessWorkVo inVo = new ProcessWorkVo(); if (ProcessWorkCode_txt.Text != string.Empty) { inVo.ProcessWorkCode = ProcessWorkCode_txt.Text; } if (ProcessWorkName_txt.Text != string.Empty) { inVo.ProcessWorkName = ProcessWorkName_txt.Text; } if (Process_cmb.SelectedIndex > -1) { inVo.ProcessId = Convert.ToInt32(Process_cmb.SelectedValue); } return(inVo); }
/// <summary> /// Remove item from gridview /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void RemoveProcessWork_btn_Click(object sender, EventArgs e) { if (this.ItemProcessWork_dgv.SelectedRows.Count > 0) { BindingSource bs = new BindingSource(); bs = (BindingSource)ProcessWork_dgv.DataSource; ProcessWorkVo prcvo = new ProcessWorkVo { ProcessWorkId = Convert.ToInt32(ItemProcessWork_dgv.SelectedRows[0].Cells["colProcessWorkId"].Value), ProcessWorkName = ItemProcessWork_dgv.SelectedRows[0].Cells["colProcessWorkName"].Value.ToString() }; ((List <ProcessWorkVo>)(bs.DataSource)).Add(prcvo); ProcessWork_dgv.DataSource = null; ProcessWork_dgv.DataSource = bs; ItemProcessWork_dgv.Rows.RemoveAt(ItemProcessWork_dgv.SelectedRows[0].Index); } }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { ProcessWorkVo inVo = (ProcessWorkVo)arg; StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append("Update m_process_work"); sqlQuery.Append(" Set "); sqlQuery.Append(" process_work_name = :processworkname, "); sqlQuery.Append(" process_id = :processid, "); sqlQuery.Append(" is_phantom = :isphantom, "); sqlQuery.Append(" line_machine_selection = :linemachineselection, "); sqlQuery.Append(" display_order = :displayorder "); sqlQuery.Append(" Where "); sqlQuery.Append(" process_work_id = :processworkid"); sqlQuery.Append(" and factory_cd = :faccd ;"); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterInteger("processworkid", inVo.ProcessWorkId); sqlParameter.AddParameterString("processworkname", inVo.ProcessWorkName); sqlParameter.AddParameterInteger("processid", inVo.ProcessId); sqlParameter.AddParameterString("isphantom", inVo.IsPhantom); sqlParameter.AddParameterInteger("linemachineselection", inVo.LineMachineSelection); sqlParameter.AddParameterInteger("displayorder", inVo.DisplayOrder); sqlParameter.AddParameterString("faccd", UserData.GetUserData().FactoryCode); ProcessWorkVo outVo = new ProcessWorkVo { AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter) }; return(outVo); }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { ProcessWorkVo inVo = (ProcessWorkVo)arg; StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append("Select Count(*) as WorkCount from m_process_work"); sqlQuery.Append(" where 1 = 1 "); if (inVo.ProcessWorkCode != null) { sqlQuery.Append(" and UPPER(process_work_cd) = UPPER(:processworkcd)"); } //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); if (inVo.ProcessWorkCode != null) { sqlParameter.AddParameterString("processworkcd", inVo.ProcessWorkCode); } //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); ProcessWorkVo outVo = new ProcessWorkVo(); while (dataReader.Read()) { outVo.AffectedCount = Convert.ToInt32(dataReader["WorkCount"]); } dataReader.Close(); return(outVo); }
/// <summary> /// Handles Load event for mold data Insert/Update operations /// Loading mold data for update mold data and binding controls with selected mold record /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void AddProcessWorkForm_Load(object sender, EventArgs e) { if (!this.DesignMode) { FormDatatableFromVo(); ComboBind(Process_cmb, processDatatable, "code", "id"); LoadPhantom(); //LoadLneMchneSltn(); ComboBind(LineMachineSltn_cmb, LneMchneSltn, "name", "id"); LoadLneMchneSltn(); ProcessWorkCode_txt.Select(); if (string.Equals(mode, CommonConstants.MODE_UPDATE)) { LoadUserData(updateData); ProcessWorkCode_txt.Enabled = false; ProcessWorkName_txt.Select(); } else { ProcessWorkVo outVo = (ProcessWorkVo)base.InvokeCbm(new GetDisplayOrderNextValCbm(), null, false); if (outVo != null) { DisplayOrder_txt.Text = outVo.DisplayOrder.ToString(); } else { DisplayOrder_txt.Text = "1"; } } } }
/// <summary> /// binds treeview with process def reason details /// </summary> private void BindTreeView() { ProcessWorkVo prWInVo = new ProcessWorkVo(); if (ProcessWork_cmb.SelectedIndex > -1) { prWInVo.ProcessWorkId = Convert.ToInt32(ProcessWork_cmb.SelectedValue); } ProcessWorkVo prWOutVo = new ProcessWorkVo(); try { prWOutVo = (ProcessWorkVo)base.InvokeCbm(new GetProcessWorkMasterMntCbm(), prWInVo, false); } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); Logger.Error(exception.GetMessageData()); return; } PopulateTreeView(prWOutVo.ProcessWorkListVo); }
private void LoadProcessWorkListBox() { isProcessListLoading = true; ProcessWorkVo outPwVo = (ProcessWorkVo)DefaultCbmInvoker.Invoke(new GetProcessWorkMasterMntCbm(), new ProcessWorkVo()); if (outPwVo.ProcessWorkListVo.Count > 0) { outPwVo.ProcessWorkListVo.ForEach(p => p.ProcessWorkName = p.ProcessWorkCode + " " + p.ProcessWorkName); ProcessWork_lst.DataSource = outPwVo.ProcessWorkListVo; ProcessWork_lst.DisplayMember = "ProcessWorkName"; ProcessWork_lst.ValueMember = "ProcessWorkId"; ProcessWork_lst.SelectedIndex = -1; isProcessListLoading = false; Update_btn.Enabled = true; } else { messageData = new MessageData("mmci00006", Properties.Resources.mmci00006, ProcessWork_lbl.Text); logger.Info(messageData); popUpMessage.Information(messageData, Text); Update_btn.Enabled = false; } }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { ProcessWorkVo inVo = (ProcessWorkVo)arg; StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append("Delete From m_process_work"); sqlQuery.Append(" Where "); sqlQuery.Append(" process_work_id = :processworkid ;"); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterInteger("processworkid", inVo.ProcessWorkId); ProcessWorkVo outVo = new ProcessWorkVo { AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter) }; return(outVo); }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { ProcessWorkVo inVo = (ProcessWorkVo)arg; StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append("Select pw.process_work_id, pw.process_work_cd, pw.process_work_name, pw.is_phantom, pw.line_machine_selection, pw.display_order, "); sqlQuery.Append(" CASE pw.is_phantom WHEN '1' THEN 'Phantom'"); sqlQuery.Append(" WHEN '0' THEN 'Standard' End as phantom_value, "); sqlQuery.Append(" pc.process_id, pc.process_cd, pc.process_name "); sqlQuery.Append(" from m_process_work pw "); sqlQuery.Append("inner join m_process pc on pc.process_id = pw.process_id "); sqlQuery.Append(" where pw.factory_cd = :factcd "); if (inVo.ProcessWorkId > 0) { sqlQuery.Append(" and pw.process_work_id = :processworkid "); } if (inVo.ProcessWorkCode != null) { sqlQuery.Append(" and pw.process_work_cd like :processworkcd "); } if (inVo.ProcessWorkName != null) { sqlQuery.Append(" and pw.process_work_name like :processworkname "); } if (inVo.ProcessId != 0) { sqlQuery.Append(" and pc.process_id = :processid "); } sqlQuery.Append(" order by pw.process_work_id"); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterString("factcd", UserData.GetUserData().FactoryCode); if (inVo.ProcessWorkId > 0) { sqlParameter.AddParameterInteger("processworkid", inVo.ProcessWorkId); } if (inVo.ProcessWorkCode != null) { sqlParameter.AddParameterString("processworkcd", inVo.ProcessWorkCode + "%"); } if (inVo.ProcessWorkName != null) { sqlParameter.AddParameterString("processworkname", inVo.ProcessWorkName + "%"); } if (inVo.ProcessId != 0) { sqlParameter.AddParameterInteger("processid", inVo.ProcessId); } //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); ProcessWorkVo outVo = new ProcessWorkVo(); while (dataReader.Read()) { ProcessWorkVo currOutVo = new ProcessWorkVo(); { currOutVo.ProcessWorkId = ConvertDBNull <int>(dataReader, "process_work_id"); currOutVo.ProcessWorkCode = DBDataCheckHelper.ConvertDBNullToStringNull(dataReader["process_work_cd"]); currOutVo.ProcessWorkName = DBDataCheckHelper.ConvertDBNullToStringNull(dataReader["process_work_name"]); currOutVo.ProcessId = ConvertDBNull <int>(dataReader, "process_id"); currOutVo.ProcessCode = DBDataCheckHelper.ConvertDBNullToStringNull(dataReader["process_cd"]); currOutVo.ProcessName = DBDataCheckHelper.ConvertDBNullToStringNull(dataReader["process_name"]); currOutVo.IsPhantom = DBDataCheckHelper.ConvertDBNullToStringNull(dataReader["is_phantom"]); currOutVo.IsPhantomDisplay = DBDataCheckHelper.ConvertDBNullToStringNull(dataReader["phantom_value"]); currOutVo.LineMachineSelection = ConvertDBNull <int>(dataReader, "line_machine_selection"); currOutVo.DisplayOrder = ConvertDBNull <int>(dataReader, "display_order"); } outVo.ProcessWorkListVo.Add(currOutVo); } dataReader.Close(); return(outVo); }
/// <summary> /// save excel data to DB /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void AddExcel_btn_Click(object sender, EventArgs e) { if (DefectiveReason_dgv.RowCount > 0 && DefectiveReason_dgv.Columns["colRemarks"].Visible == true) { bool isRemarksNG = false; foreach (DataGridViewRow row in DefectiveReason_dgv.Rows) { if (DefectiveReason_dgv["colRemarks", row.Index].Value != null && !string.IsNullOrWhiteSpace(DefectiveReason_dgv["colRemarks", row.Index].Value.ToString())) { row.Cells["colRemarks"].Style.ForeColor = Color.Red; isRemarksNG = true; } } if (isRemarksNG) { messageData = new MessageData("mmci00015", Properties.Resources.mmci00015, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); return; } string previousReasonCode = string.Empty; int uploadedCount = 0; int insertedCount = 0; DefectiveReasonVo defectiveReasonInVo = new DefectiveReasonVo(); ProcessDefectiveReasonVo processDefectiveReasonInVo = new ProcessDefectiveReasonVo(); if (processWorkList.Count == 0) { GetProcessWork(); } this.StartProgress(Properties.Resources.mmci00009); foreach (DataRow row in excelUploadDt.Rows) { if (!string.IsNullOrEmpty(row["DefectiveReasonCode"].ToString()) && previousReasonCode != row["DefectiveReasonCode"].ToString()) { defectiveReasonInVo = new DefectiveReasonVo(); processDefectiveReasonInVo = new ProcessDefectiveReasonVo(); defectiveReasonInVo.DefectiveReasonCode = row["DefectiveReasonCode"].ToString(); defectiveReasonInVo.DefectiveReasonName = row["DefectiveReasonName"].ToString(); defectiveReasonInVo.DefectiveCategoryId = 0; defectiveReasonInVo.DisplayOrder = Convert.ToInt32(row["DisplayOrder"].ToString()); uploadedCount += 1; DataRow[] processWorkCodeList = excelUploadDt.Select("DefectiveReasonCode = '" + defectiveReasonInVo.DefectiveReasonCode + "'"); foreach (DataRow item in processWorkCodeList) { ProcessDefectiveReasonVo addVo = new ProcessDefectiveReasonVo(); ProcessWorkVo processWorkVo = processWorkList.Where(t => t.ProcessWorkCode == item["ProcessWorkCode"].ToString()).FirstOrDefault(); if (processWorkVo != null && processWorkVo.ProcessWorkId > 0) { addVo.ProcessWorkId = processWorkList.Where(t => t.ProcessWorkCode == item["ProcessWorkCode"].ToString()).FirstOrDefault().ProcessWorkId; processDefectiveReasonInVo.ProcessDefectiveReasonListVo.Add(addVo); } } ValueObjectList <ValueObject> inVoList = new ValueObjectList <ValueObject>(); inVoList.add(defectiveReasonInVo); inVoList.add(processDefectiveReasonInVo); DefectiveReasonVo outVo = null; try { outVo = (DefectiveReasonVo)base.InvokeCbm(new AddDefectiveReasonMasterMntNewCbm(), inVoList, false); } catch (Framework.ApplicationException exception) { this.CompleteProgress(); popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); return; } if (outVo != null && outVo.AffectedCount > 0) { insertedCount += outVo.AffectedCount; } } previousReasonCode = row["DefectiveReasonCode"].ToString(); } this.CompleteProgress(); if (insertedCount > 0 && uploadedCount > 0 && insertedCount == uploadedCount) { messageData = new MessageData("mmci00010", Properties.Resources.mmci00010, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); GridBind(FormConditionVo()); } } else { messageData = new MessageData("mmci00016", Properties.Resources.mmci00016, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); } }
private void Save_btn_Click(object sender, EventArgs e) { if (LineDetails_dgv.RowCount > 0 && LineDetails_dgv.Columns["colRemarks"].Visible == true) { if (processWorkList.Count == 0) { GetProcessWork(); } this.StartProgress(Properties.Resources.mmci00009); string previousLineCode = string.Empty; int uploadedCount = 0; int insertedCount = 0; LineVo lineVo = new LineVo(); ProcessWorkLineVo processWorkLineVo = new ProcessWorkLineVo(); foreach (DataRow row in excelUploadDt.Rows) { if (!string.IsNullOrEmpty(row["LineCode"].ToString()) && previousLineCode != row["LineCode"].ToString()) { lineVo = new LineVo(); processWorkLineVo = new ProcessWorkLineVo(); lineVo.LineCode = row["LineCode"].ToString(); lineVo.LineName = row["LineName"].ToString(); uploadedCount += 1; DataRow[] processWorkCodeList = excelUploadDt.Select("LineCode = '" + lineVo.LineCode + "'"); foreach (DataRow item in processWorkCodeList) { ProcessWorkLineVo addVo = new ProcessWorkLineVo(); ProcessWorkVo processWorkVo = processWorkList.Where(t => t.ProcessWorkCode == item["ProcessWorkCode"].ToString()).FirstOrDefault(); if (processWorkVo != null && processWorkVo.ProcessWorkId > 0) { addVo.ProcessWorkId = processWorkVo.ProcessWorkId; processWorkLineVo.ProcessWorkLineListVo.Add(addVo); } } ValueObjectList <ValueObject> inVoList = new ValueObjectList <ValueObject>(); inVoList.add(lineVo); inVoList.add(processWorkLineVo); LineVo outVo = null; try { outVo = (LineVo)base.InvokeCbm(new AddLineMasterAndProcessworkCbm(), inVoList, false); } catch (Framework.ApplicationException exception) { this.CompleteProgress(); popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); return; } if (outVo != null && outVo.AffectedCount > 0) { insertedCount += outVo.AffectedCount; } } previousLineCode = row["LineCode"].ToString(); } this.CompleteProgress(); if (insertedCount > 0 && uploadedCount > 0 && insertedCount == uploadedCount) { messageData = new MessageData("mmci00010", Properties.Resources.mmci00010, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); GridBind(FormConditionVo()); } } else { messageData = new MessageData("mmci00016", Properties.Resources.mmci00016, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); } }
/// <summary> /// update data to db /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected virtual void Ok_btn_Click(object sender, EventArgs e) { if (CheckMandatory()) { string processwrkName = ProcessWorkName_txt.Text; processwrkName = Regex.Replace(processwrkName, @"\s", ""); var sch = StringCheckHelper.GetInstance(); if (!sch.IsASCII(ProcessWorkCode_txt.Text)) { messageData = new MessageData("mmce00003", Properties.Resources.mmce00003); logger.Info(messageData); popUpMessage.ConfirmationOkCancel(messageData, Text); ProcessWorkCode_txt.Focus(); return; } else if (!sch.IsASCII(processwrkName)) { messageData = new MessageData("mmce00003", Properties.Resources.mmce00003); logger.Info(messageData); popUpMessage.ConfirmationOkCancel(messageData, Text); ProcessWorkName_txt.Focus(); return; } ProcessWorkVo inVo = new ProcessWorkVo { ProcessWorkCode = ProcessWorkCode_txt.Text.Trim(), ProcessWorkName = ProcessWorkName_txt.Text.Trim(), ProcessId = Convert.ToInt32(Process_cmb.SelectedValue), //RegistrationDateTime = DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"), // IsPhantom = isPhantom_cmb.SelectedValue.ToString(), IsPhantom = "0", LineMachineSelection = Convert.ToInt32(LineMachineSltn_cmb.SelectedValue.ToString()), DisplayOrder = Convert.ToInt32(DisplayOrder_txt.Text), RegistrationUserCode = UserData.GetUserData().UserCode, FactoryCode = UserData.GetUserData().FactoryCode }; if (string.Equals(mode, CommonConstants.MODE_ADD)) { ProcessWorkVo checkVo = DuplicateCheck(inVo); if (checkVo != null && checkVo.AffectedCount > 0) { messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, ProcessWorkCode_lbl.Text + " : " + ProcessWorkCode_txt.Text); logger.Info(messageData); popUpMessage.ApplicationError(messageData, Text); return; } ProcessWorkVo checkDisplayVo = DuplicateDisplayCheck(inVo); if (checkDisplayVo != null && checkDisplayVo.AffectedCount > 0) { messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, DisplayOrder_lbl.Text + " : " + DisplayOrder_txt.Text); logger.Info(messageData); popUpMessage.ConfirmationOkCancel(messageData, Text); DisplayOrder_txt.Focus(); return; } } else if (string.Equals(mode, CommonConstants.MODE_UPDATE)) { if (updateData.DisplayOrder != Convert.ToInt32(DisplayOrder_txt.Text)) { ProcessWorkVo checkDisplayVo = DuplicateDisplayCheck(inVo); if (checkDisplayVo != null && checkDisplayVo.AffectedCount > 0) { messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, DisplayOrder_lbl.Text + " : " + DisplayOrder_txt.Text); logger.Info(messageData); popUpMessage.ConfirmationOkCancel(messageData, Text); DisplayOrder_txt.Focus(); return; } } } try { if (string.Equals(mode, CommonConstants.MODE_ADD)) { ProcessWorkVo outVo = (ProcessWorkVo)base.InvokeCbm(new AddProcessWorkMasterMntCbm(), inVo, false); IntSuccess = outVo.AffectedCount; } else if (mode.Equals(CommonConstants.MODE_UPDATE)) { inVo.ProcessWorkId = updateData.ProcessWorkId; ProcessWorkVo outVo = (ProcessWorkVo)base.InvokeCbm(new UpdateProcessWorkMasterMntCbm(), 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> /// event to delete the selected record /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected virtual void Delete_btn_Click(object sender, EventArgs e) { int selectedrowindex = ProcessWork_dgv.SelectedCells[0].RowIndex; DataGridViewRow selectedRow = ProcessWork_dgv.Rows[selectedrowindex]; messageData = new MessageData("mmcc00004", Properties.Resources.mmcc00004, selectedRow.Cells["colProcessWorkCode"].Value.ToString()); // Logger.Info(messageData); DialogResult dialogResult = popUpMessage.ConfirmationOkCancel(messageData, Text); if (dialogResult == DialogResult.OK) { ProcessWorkVo inVo = new ProcessWorkVo { ProcessWorkId = Convert.ToInt32(selectedRow.Cells["colProcessWorkId"].Value), RegistrationDateTime = Convert.ToDateTime(DateTime.Now.ToString(UserData.GetUserData().DateTimeFormat)), RegistrationUserCode = UserData.GetUserData().UserCode, }; inVo.ProcessWorkCode = selectedRow.Cells["colProcessWorkCode"].Value.ToString(); try { ProcessWorkVo outCountVo = CheckProcessWorkRelation(inVo); if (outCountVo != null) { StringBuilder message = new StringBuilder(); if (outCountVo.DefectiveIdCount > 0) { message.Append(ProcessWorkRelationTables.ProcessWorkDefectiveReason); } if (outCountVo.ItemProcessWorkIdCount > 0) { if (message.Length > 0) { message.Append(" And "); } message.Append(ProcessWorkRelationTables.ItemProcessWork); } if (outCountVo.ProcessSupplierIdCount > 0) { if (message.Length > 0) { message.Append(" And "); } message.Append(ProcessWorkRelationTables.ProcessWorkSupplier); } if (message.Length > 0) { messageData = new MessageData("mmce00007", Properties.Resources.mmce00007, message.ToString()); popUpMessage.Information(messageData, Text); return; } } ProcessWorkVo outVo = (ProcessWorkVo)base.InvokeCbm(new DeleteProcessWorkMasterMntCbm(), 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 } }
/// <summary> /// Fills all user records to gridview control /// </summary> private void GridBind(ProcessWorkVo conditionInVo) { ProcessWorkVo inVo = new ProcessWorkVo(); ProcessWork_dgv.DataSource = null; try { ProcessWorkVo outVo = (ProcessWorkVo)base.InvokeCbm(new GetProcessWorkMasterMntCbm(), conditionInVo, false); ProcessWork_dgv.AutoGenerateColumns = false; foreach (ProcessWorkVo itemList in outVo.ProcessWorkListVo) { ProcessWorkVo bindVo = new ProcessWorkVo(); bindVo.ProcessWorkId = Convert.ToInt32(itemList.ProcessWorkId); bindVo.ProcessWorkCode = itemList.ProcessWorkCode.ToString(); bindVo.ProcessWorkName = itemList.ProcessWorkName.ToString(); bindVo.ProcessId = Convert.ToInt32(itemList.ProcessId); bindVo.ProcessCode = itemList.ProcessCode.ToString(); bindVo.ProcessName = itemList.ProcessName.ToString(); bindVo.IsPhantomDisplay = itemList.IsPhantomDisplay.ToString(); if (itemList.LineMachineSelection == 1) { bindVo.LineMachineSelectionDisplay = "SingleLine"; } else if (itemList.LineMachineSelection == 2) { bindVo.LineMachineSelectionDisplay = "SingleMachine"; } else if (itemList.LineMachineSelection == 3) { bindVo.LineMachineSelectionDisplay = "SingleLineandSingleMachine"; } bindVo.DisplayOrder = Convert.ToInt32(itemList.DisplayOrder); inVo.ProcessWorkListVo.Add(bindVo); } BindingSource bindingSource1 = new BindingSource(inVo.ProcessWorkListVo, null); if (bindingSource1.Count > 0) { ProcessWork_dgv.DataSource = bindingSource1; } else { messageData = new MessageData("mmci00006", Properties.Resources.mmci00006, null); //process work logger.Info(messageData); popUpMessage.Information(messageData, Text); } ProcessWork_dgv.ClearSelection(); Update_btn.Enabled = false; Delete_btn.Enabled = false; } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); } }