/// <summary> /// Fills all user records to gridview control /// </summary> private void GridBind(MachineVo conditionInVo) { Machine_dgv.DataSource = null; try { MachineVo outVo = (MachineVo)base.InvokeCbm(new GetMachineMasterMntCbm(), conditionInVo, false); Machine_dgv.AutoGenerateColumns = false; BindingSource bindingSource1 = new BindingSource(outVo.MachineListVo, null); if (bindingSource1.Count > 0) { Machine_dgv.DataSource = bindingSource1; } else { messageData = new MessageData("mmci00006", Properties.Resources.mmci00006, null); //process logger.Info(messageData); popUpMessage.Information(messageData, Text); } Machine_dgv.ClearSelection(); Update_btn.Enabled = false; Delete_btn.Enabled = false; } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); } }
/// <summary> /// selects user record for updation and show user form /// </summary> private void BindUpdateUserData() { int selectedrowindex = Machine_dgv.SelectedCells[0].RowIndex; MachineVo selectedData = (MachineVo)Machine_dgv.Rows[selectedrowindex].DataBoundItem; AddMachineForm newAddForm = new AddMachineForm(CommonConstants.MODE_UPDATE, selectedData); newAddForm.ShowDialog(this); if (newAddForm.IntSuccess > 0) { messageData = new MessageData("mmci00002", Properties.Resources.mmci00002, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); GridBind(FormConditionVo()); } else if (newAddForm.IntSuccess == 0) { messageData = new MessageData("mmci00007", Properties.Resources.mmci00007, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); GridBind(FormConditionVo()); } }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { MachineVo inVo = (MachineVo)arg; StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append("Delete From m_machine"); sqlQuery.Append(" Where "); sqlQuery.Append(" machine_id = :machineid"); sqlQuery.Append(" and factory_cd = :faccd ;"); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterInteger("machineid", inVo.MachineId); sqlParameter.AddParameterString("faccd", UserData.GetUserData().FactoryCode); MachineVo outVo = new MachineVo { AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter) }; return(outVo); }
public ValueObject Execute(TransactionContext trxContext, ValueObject vo) { List <ValueObject> inList = ((ValueObjectList <ValueObject>)vo).GetList(); MachineVo machineInVo = (MachineVo)inList.FirstOrDefault(); ProcessWorkMachineVo processWorkMachineInVo = (ProcessWorkMachineVo)inList.Skip(1).FirstOrDefault(); MachineVo machineOutVo = (MachineVo)updateMachineMasterMntCbm.Execute(trxContext, machineInVo); if (machineOutVo.AffectedCount > 0) { ProcessWorkMachineVo deleteInVo = new ProcessWorkMachineVo(); deleteInVo.MachineId = machineInVo.MachineId; ProcessWorkMachineVo deleteOutVo = (ProcessWorkMachineVo)deleteProcessWorkMachineMasterMntCbm.Execute(trxContext, deleteInVo); foreach (ProcessWorkMachineVo curInVo in processWorkMachineInVo.ProcessWorkMachineListVo) { curInVo.MachineId = machineInVo.MachineId; ProcessWorkMachineVo processWorkLineOutVo = (ProcessWorkMachineVo)addProcessWorkMachineMasterMntCbm.Execute(trxContext, curInVo); } } return(machineOutVo); }
public ValueObject Execute(TransactionContext trxContext, ValueObject vo) { List <ValueObject> inList = ((ValueObjectList <ValueObject>)vo).GetList(); MachineVo machineInVo = (MachineVo)inList.FirstOrDefault(); ProcessWorkMachineVo processWorkMachineInVo = (ProcessWorkMachineVo)inList.Skip(1).FirstOrDefault(); MachineVo machineOutVo = (MachineVo)addMachineMasterMntCbm.Execute(trxContext, machineInVo); int count = 0; if (machineOutVo != null && machineOutVo.MachineId > 0) { count += 1; foreach (ProcessWorkMachineVo curInVo in processWorkMachineInVo.ProcessWorkMachineListVo) { curInVo.MachineId = machineOutVo.MachineId; ProcessWorkMachineVo processWorkMachineOutVo = (ProcessWorkMachineVo)addProcessWorkMachineMasterMntCbm.Execute(trxContext, curInVo); } } machineOutVo.AffectedCount = count; return(machineOutVo); }
private void MachineName_cmb_SelectedIndexChanged(object sender, EventArgs e) { foreach (Cause item in cause) { item.Selected = false; item.CauseId = 0; } if (MachineName_cmb.SelectedIndex >= 0) { MachineVo mv = (MachineVo)MachineName_cmb.SelectedItem; ValueObjectList <CauseVo> mlv = (ValueObjectList <CauseVo>)DefaultCbmInvoker.Invoke(new Cbm.GetCauseCbm(), new CauseVo { MachineID = mv.MachineId }); foreach (CauseVo vo in mlv.GetList()) { Cause ml = cause.Find(x => x.dvo.DefectiveReasonId == vo.DefectiveID); if (ml != null) { ml.Selected = true; ml.CauseId = vo.CauseID; } } } Cause_dgv.Refresh(); }
private void machinename_cmb_SelectedIndexChanged(object sender, EventArgs e) { foreach (RespMachine item in respmachine) { item.Selected = false; item.RespMachineID = 0; } if (machinename_cmb.SelectedIndex >= 0) { MachineVo mm = (MachineVo)machinename_cmb.SelectedItem; ValueObjectList <ResponseMachineVo> mlv = (ValueObjectList <ResponseMachineVo>)DefaultCbmInvoker.Invoke(new Cbm.GetResponseMachineCbm(), new ResponseMachineVo { MachineId = mm.MachineId }); foreach (ResponseMachineVo vo in mlv.GetList()) { RespMachine ml = respmachine.Find(x => x.mvo.ProdutionWorkContentId == vo.ProdutionWorkContentId); if (ml != null) { ml.Selected = true; ml.RespMachineID = vo.ResponseMachineId; } } } RespMachine_dgv.Refresh(); }
private void ReportDownTimeForm_Load(object sender, EventArgs e) { 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 = ""; ProcessVo processvo = (ProcessVo)DefaultCbmInvoker.Invoke(new GetProcessMasterMntCbm(), new ProcessVo()); process_cmb.DisplayMember = "ProcessName"; BindingSource b2 = new BindingSource(processvo.ProcessListVo, null); process_cmb.DataSource = b2; process_cmb.Text = ""; MachineVo machinevo = (MachineVo)DefaultCbmInvoker.Invoke(new GetMachineMasterMntCbm(), new MachineVo()); machine_cmb.DisplayMember = "MachineName"; BindingSource b4 = new BindingSource(machinevo.MachineListVo, null); machine_cmb.DataSource = b4; machine_cmb.Text = ""; line_cmb.Text = ""; cause_cmb.Text = ""; action_cmb.Text = ""; }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { MachineVo inVo = (MachineVo)arg; MachineVo outVo = new MachineVo(); StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append("Select * from m_machine "); sqlQuery.Append(" where 1 = 1 "); if (inVo.MachineCode != null) { sqlQuery.Append(" and machine_cd like :machinecd "); } if (inVo.MachineName != null) { sqlQuery.Append(" and machine_name like :machinename "); } sqlQuery.Append(" order by machine_name"); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); if (inVo.MachineCode != null) { sqlParameter.AddParameterString("machinecd", inVo.MachineCode + "%"); } if (inVo.MachineName != null) { sqlParameter.AddParameterString("machinename", inVo.MachineName + "%"); } //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); while (dataReader.Read()) { MachineVo currOutVo = new MachineVo { MachineId = Convert.ToInt32(dataReader["machine_id"]), MachineCode = dataReader["machine_cd"].ToString(), MachineName = dataReader["machine_name"].ToString(), }; outVo.MachineListVo.Add(currOutVo); } dataReader.Close(); return(outVo); }
/// <summary> /// For setting selected user record into respective controls(textbox and combobox) for update operation /// passing selected user data as parameter /// </summary> /// <param name="dgvData"></param> private void LoadUserData(MachineVo dgvData) { if (dgvData != null) { MachineCode_txt.Text = dgvData.MachineCode; MachineName_txt.Text = dgvData.MachineName; } }
private void ProcessWForm_Load(object sender, EventArgs e) { MachineVo machinevo = (MachineVo)DefaultCbmInvoker.Invoke(new GetMachineMasterMntCbm(), new MachineVo()); Machine_cmb.DisplayMember = "MachineName"; BindingSource b4 = new BindingSource(machinevo.MachineListVo, null); Machine_cmb.DataSource = b4; Machine_cmb.Text = ""; }
/// <summary> /// event to delete the selected record /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Delete_btn_Click(object sender, EventArgs e) { if (isExcelUpload) { return; } int selectedrowindex = Machine_dgv.SelectedCells[0].RowIndex; DataGridViewRow selectedRow = Machine_dgv.Rows[selectedrowindex]; messageData = new MessageData("mmcc00004", Properties.Resources.mmcc00004, selectedRow.Cells["colMachineCode"].Value.ToString()); // Logger.Info(messageData); DialogResult dialogResult = popUpMessage.ConfirmationOkCancel(messageData, Text); if (dialogResult == DialogResult.OK) { MachineVo inVo = new MachineVo { MachineId = Convert.ToInt32(selectedRow.Cells["colMachineId"].Value), }; try { MachineVo outVo = (MachineVo)base.InvokeCbm(new DeleteMachineMasterAndProcessworkCbm(), 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 ValueObject Execute(TransactionContext trxContext, ValueObject vo) { MachineVo deleteMachineOutVo = (MachineVo)deleteMachineMasterMntCbm.Execute(trxContext, vo); if (deleteMachineOutVo.AffectedCount > 0) { ProcessWorkMachineVo inVo = new ProcessWorkMachineVo(); inVo.MachineId = ((MachineVo)vo).MachineId; ProcessWorkMachineVo deleteProcessWorkMachineOutVo = (ProcessWorkMachineVo)deleteProcessWorkMachineMasterMntCbm.Execute(trxContext, inVo); } return(deleteMachineOutVo); }
/// <summary> /// constructor for the form /// </summary> /// <param name="pmode"></param> /// <param name="dataItem"></param> public AddMachineForm(string pmode, MachineVo dataItem = null) { InitializeComponent(); mode = pmode; updateData = dataItem; if (string.Equals(mode, CommonConstants.MODE_UPDATE)) { this.Text = UpdateText_lbl.Text; } }
/// <summary> /// Check for duplicate /// </summary> /// <returns></returns> private MachineVo DuplicateCheck(MachineVo pMachineVo) { MachineVo outVo = new MachineVo(); try { outVo = (MachineVo)base.InvokeCbm(new CheckMachineMasterMntCbm(), pMachineVo, false); } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); } return(outVo); }
/// <summary> /// Creates seacrh condition as per user inputs /// </summary> /// <returns>search condition</returns> private MachineVo FormConditionVo() { MachineVo inVo = new MachineVo(); if (MachineCode_txt.Text != string.Empty) { inVo.MachineCode = MachineCode_txt.Text; } if (MachineName_txt.Text != string.Empty) { inVo.MachineName = MachineName_txt.Text; } return(inVo); }
private void AddGroupMachineForm_Load(object sender, EventArgs e) { GroupMachineCode_txt.Select(); if (vo.GroupMachineId > 0) { GroupMachineCode_txt.Text = vo.GroupMachineCode; GroupMachineName_txt.Text = vo.GroupMachineName; } MachineVo machinevo = (MachineVo)DefaultCbmInvoker.Invoke(new GetMachineMasterMntCbm(), new MachineVo()); Machine_cmb.DisplayMember = "MachineName"; BindingSource b4 = new BindingSource(machinevo.MachineListVo, null); Machine_cmb.DataSource = b4; Machine_cmb.Text = ""; }
private void Update_btn_Click(object sender, EventArgs e) { if (MachineName_cmb.SelectedIndex >= 0) { MachineVo machinevo = (MachineVo)MachineName_cmb.SelectedItem; ValueObjectList <CauseVo> deletelist = new ValueObjectList <CauseVo>(); ValueObjectList <CauseVo> addlist = new ValueObjectList <CauseVo>(); for (int i = 0; i < Cause_dgv.Rows.Count; i++) { Cause mg = (Cause)Cause_dgv.Rows[i].DataBoundItem; if (mg.CauseId > 0 && !mg.Selected) { deletelist.add(new CauseVo { CauseID = mg.CauseId }); } else if (mg.CauseId == 0 && mg.Selected) { addlist.add(new CauseVo { MachineID = machinevo.MachineId, DefectiveID = mg.dvo.DefectiveReasonId, FactoryCode = UserData.GetUserData().FactoryCode, RegistrationUserCode = UserData.GetUserData().UserCode }); } } if (deletelist.GetList().Count > 0) { DefaultCbmInvoker.Invoke(new DeleteCauseCbm(), deletelist); } if (addlist.GetList().Count > 0) { DefaultCbmInvoker.Invoke(new AddCauseCbm(), addlist); } if (addlist.GetList().Count > 0 || deletelist.GetList().Count > 0) { messageData = new MessageData("mmci00002", Properties.Resources.mmci00002, null); logger.Info(messageData); DialogResult dialogResult = popUpMessage.ConfirmationOkCancel(messageData, Text); MachineName_cmb_SelectedIndexChanged(null, null); } } }
public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { ResponseMachineVo inVo = (ResponseMachineVo)vo; StringBuilder sql = new StringBuilder(); DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, string.Empty); DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sql.Append("delete from public.m_response_machine Where 1=1 "); if (!String.IsNullOrEmpty(inVo.FactoryCode)) { sql.Append(" and factory_cd = :factory_cd "); sqlParameter.AddParameterString("factory_cd", inVo.FactoryCode); } if (inVo.MachineId > 0) { sql.Append(" and machine_id = :machine_id "); sqlParameter.AddParameterInteger("machine_id", inVo.MachineId); } if (inVo.ProdutionWorkContentId > 0) { sql.Append(" and prodution_work_content_id = :prodution_work_content_id "); sqlParameter.AddParameterInteger("prodution_work_content_id", inVo.ProdutionWorkContentId); } if (inVo.ResponseMachineId > 0) { sql.Append(" and response_machine_id = :response_machine_id "); sqlParameter.AddParameterInteger("response_machine_id", inVo.ResponseMachineId); } //create command sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //execute SQL MachineVo outVo = new MachineVo { AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter) }; return(outVo); }
private void Update_btn_Click(object sender, EventArgs e) { if (machinename_cmb.SelectedIndex >= 0) { MachineVo machinevo = (MachineVo)machinename_cmb.SelectedItem; ValueObjectList <ResponseMachineVo> deletelist = new ValueObjectList <ResponseMachineVo>(); ValueObjectList <ResponseMachineVo> addlist = new ValueObjectList <ResponseMachineVo>(); for (int i = 0; i < RespMachine_dgv.Rows.Count; i++) { RespMachine mg = (RespMachine)RespMachine_dgv.Rows[i].DataBoundItem; if (mg.RespMachineID > 0 && !mg.Selected) { deletelist.add(new ResponseMachineVo { ResponseMachineId = mg.RespMachineID }); } else if (mg.RespMachineID == 0 && mg.Selected) { addlist.add(new ResponseMachineVo { MachineId = machinevo.MachineId, ProdutionWorkContentId = mg.mvo.ProdutionWorkContentId, FactoryCode = UserData.GetUserData().FactoryCode, RegistrationUserCode = UserData.GetUserData().UserCode }); } } if (deletelist.GetList().Count > 0) { DefaultCbmInvoker.Invoke(new DeleteResponseMachineCbm(), deletelist); } if (addlist.GetList().Count > 0) { DefaultCbmInvoker.Invoke(new AddResponseMachineCbm(), addlist); } if (addlist.GetList().Count > 0 || deletelist.GetList().Count > 0) { messageData = new MessageData("mmci00002", Properties.Resources.mmci00002, null); logger.Info(messageData); DialogResult dialogResult = popUpMessage.ConfirmationOkCancel(messageData, Text); machinename_cmb_SelectedIndexChanged(null, null); } } }
private void ReportDownTimeForm_Load(object sender, EventArgs e) { int usr_cd; //Load ComboBox 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; ProcessVo processvo = (ProcessVo)DefaultCbmInvoker.Invoke(new GetProcessMasterMntCbm(), new ProcessVo()); assy_cmb.DisplayMember = "ProcessName"; BindingSource b2 = new BindingSource(processvo.ProcessListVo, null); assy_cmb.DataSource = b2; MachineVo machinevo = (MachineVo)DefaultCbmInvoker.Invoke(new GetMachineMasterMntCbm(), new MachineVo()); machine_cmb.DisplayMember = "MachineName"; BindingSource b4 = new BindingSource(machinevo.MachineListVo, null); machine_cmb.DataSource = b4; ResetControlValues.ResetControlValue(Search_tbpnl); //Check Permission ReportDownTimeVo inVo = new ReportDownTimeVo { RegistrationUserCode = UserData.GetUserData().UserCode }; ReportDownTimeVo usrvo = (ReportDownTimeVo)DefaultCbmInvoker.Invoke(new CheckPermissionCbm(), new ReportDownTimeVo { RegistrationUserCode = inVo.RegistrationUserCode }); usr_cd = usrvo.AffectedCount; if (usr_cd == 1) { update_btn.Enabled = true; Delete_btn.Enabled = true; } }
public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { CauseVo inVo = (CauseVo)vo; StringBuilder sql = new StringBuilder(); DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, string.Empty); DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sql.Append("delete from public.m_ncvp_cause Where 1=1 "); if (!String.IsNullOrEmpty(inVo.FactoryCode)) { sql.Append(" and factory_cd = :factory_cd "); sqlParameter.AddParameterString("factory_cd", inVo.FactoryCode); } if (inVo.MachineID > 0) { sql.Append(" and machine_id = :machine_id "); sqlParameter.AddParameterInteger("machine_id", inVo.MachineID); } if (inVo.DefectiveID > 0) { sql.Append(" and defective_reason_id = :defective_reason_id "); sqlParameter.AddParameterInteger("defective_reason_id", inVo.DefectiveID); } if (inVo.CauseID > 0) { sql.Append(" and cause_id = :cause_id "); sqlParameter.AddParameterInteger("cause_id", inVo.CauseID); } //create command sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //execute SQL MachineVo outVo = new MachineVo { AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter) }; return(outVo); }
private void machine_cmb_SelectedIndexChanged(object sender, EventArgs e) { if (machine_cmb.SelectedItem != null) { MachineVo mvo = (MachineVo)machine_cmb.SelectedItem; ValueObjectList <DefectiveReasonVo> defectivereasonvo = (ValueObjectList <DefectiveReasonVo>)DefaultCbmInvoker.Invoke(new GetCauseAndDefectiveCbm(), new DefectiveReasonVo { DefectiveReasonId = mvo.MachineId }); cause_cmb.DisplayMember = "DefectiveReasonName"; cause_cmb.DataSource = defectivereasonvo.GetList(); ValueObjectList <ProdutionWorkContentVo> respmachinevolist = (ValueObjectList <ProdutionWorkContentVo>)DefaultCbmInvoker.Invoke(new GetActicAndContentCbm(), new ProdutionWorkContentVo { ProdutionWorkContentId = mvo.MachineId }); action_cmb.DisplayMember = "ProdutionWorkContentName"; action_cmb.DataSource = respmachinevolist.GetList(); } }
private void AddUpdateReportDownTimeFrom_Load(object sender, EventArgs e) { 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 = ""; ProcessVo processvo = (ProcessVo)DefaultCbmInvoker.Invoke(new GetProcessMasterMntCbm(), new ProcessVo()); process_cmb.DisplayMember = "ProcessName"; BindingSource b2 = new BindingSource(processvo.ProcessListVo, null); process_cmb.DataSource = b2; process_cmb.Text = ""; MachineVo machinevo = (MachineVo)DefaultCbmInvoker.Invoke(new GetMachineMasterMntCbm(), new MachineVo()); machine_cmb.DisplayMember = "MachineName"; BindingSource b4 = new BindingSource(machinevo.MachineListVo, null); machine_cmb.DataSource = b4; machine_cmb.Text = ""; process_work_cmb.Text = ""; line_cmb.Text = ""; cause_cmb.Text = ""; action_cmb.Text = ""; if (reportDownTimeVo.DowntimeReportId > 0) { model_cmb.Text = reportDownTimeVo.ModelCode; machine_cmb.Enabled = false; process_cmb.Text = reportDownTimeVo.ProcessName; process_work_cmb.Text = reportDownTimeVo.ProcessWorkName; line_cmb.Text = reportDownTimeVo.LineCode; cause_cmb.Text = reportDownTimeVo.DefectiveReasonName; action_cmb.Text = reportDownTimeVo.ProductionWorkContentName; remake_txt.Text = reportDownTimeVo.Remakes; } }
private void Update_btn_Click(object sender, EventArgs e) { if (machinename_cmb.SelectedIndex >= 0) { MachineVo machinevo = (MachineVo)machinename_cmb.SelectedItem; ValueObjectList <MachineAndEquipmentVo> deletelist = new ValueObjectList <MachineAndEquipmentVo>(); ValueObjectList <MachineAndEquipmentVo> addlist = new ValueObjectList <MachineAndEquipmentVo>(); for (int i = 0; i < Equipment_dgv.Rows.Count; i++) { MachineEquipment mg = (MachineEquipment)Equipment_dgv.Rows[i].DataBoundItem; if (mg.MachineEquipmentId > 0 && !mg.Selected) { deletelist.add(new MachineAndEquipmentVo { MachineAndEquipmentID = mg.MachineEquipmentId }); } else if (mg.MachineEquipmentId == 0 && mg.Selected) { addlist.add(new MachineAndEquipmentVo { MachineID = machinevo.MachineId, EquipmentID = mg.evo.EquipmentId, }); } } if (deletelist.GetList().Count > 0) { DefaultCbmInvoker.Invoke(new DeleteMachineEquipmentCbm(), deletelist); } if (addlist.GetList().Count > 0) { DefaultCbmInvoker.Invoke(new AddMachineEquipmentCbm(), addlist); } if (addlist.GetList().Count > 0 || deletelist.GetList().Count > 0) { messageData = new MessageData("mmci00002", Properties.Resources.mmci00002, null); logger.Info(messageData); DialogResult dialogResult = popUpMessage.ConfirmationOkCancel(messageData, Text); machinename_cmb_SelectedIndexChanged(null, null); } } }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { MachineVo inVo = (MachineVo)arg; StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append("Insert into m_machine"); sqlQuery.Append(" ( "); sqlQuery.Append(" machine_cd, "); sqlQuery.Append(" machine_name, "); sqlQuery.Append(" registration_user_cd, "); sqlQuery.Append(" registration_date_time, "); sqlQuery.Append(" factory_cd "); sqlQuery.Append(" ) "); sqlQuery.Append("VALUES "); sqlQuery.Append(" ( "); sqlQuery.Append(" :machinecd ,"); sqlQuery.Append(" :machinename ,"); sqlQuery.Append(" :registrationusercode ,"); sqlQuery.Append(" :registrationdatetime ,"); sqlQuery.Append(" :factorycode "); sqlQuery.Append(" ) "); sqlQuery.Append(" RETURNING machine_id;"); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterString("machinecd", inVo.MachineCode); sqlParameter.AddParameterString("machinename", inVo.MachineName); sqlParameter.AddParameterString("registrationusercode", UserData.GetUserData().UserCode); sqlParameter.AddParameterDateTime("registrationdatetime", trxContext.ProcessingDBDateTime); sqlParameter.AddParameterString("factorycode", UserData.GetUserData().FactoryCode); MachineVo outVo = new MachineVo(); outVo.MachineId = (int?)sqlCommandAdapter.ExecuteScalar(sqlParameter) ?? 0; return(outVo); }
private void CauseMasterForm_Load(object sender, EventArgs e) { try { DefectiveReasonVo defectiveReasonvo = (DefectiveReasonVo)DefaultCbmInvoker.Invoke(getDefectiveReasonMasterMntCmb, new DefectiveReasonVo()); foreach (DefectiveReasonVo vo in defectiveReasonvo.DefectiveReasonListVo) { cause.Add(new Cause { dvo = vo, Selected = false, CauseId = 0 }); } BindingSource bds = new BindingSource(cause, null); Cause_dgv.DataSource = bds; MachineVo machinelist = (MachineVo)DefaultCbmInvoker.Invoke(getMachineMasterMntCbm, new MachineVo()); MachineName_cmb.DisplayMember = "MachineName"; MachineName_cmb.DataSource = machinelist.MachineListVo; MachineName_cmb.SelectedIndex = -1; } catch { } //gfg }
private void ResponseMachineMasterForm_Load(object sender, EventArgs e) { try { ValueObjectList <ProdutionWorkContentVo> prodvo = (ValueObjectList <ProdutionWorkContentVo>)DefaultCbmInvoker.Invoke(getProdutionWorkContentCbm, new ProdutionWorkContentVo()); foreach (ProdutionWorkContentVo vo in prodvo.GetList()) { respmachine.Add(new RespMachine { mvo = vo, Selected = false, RespMachineID = 0 }); } BindingSource bds = new BindingSource(respmachine, null); RespMachine_dgv.DataSource = bds; MachineVo machinelist = (MachineVo)DefaultCbmInvoker.Invoke(getMachineMasterMntCbm, new MachineVo()); machinename_cmb.DisplayMember = "MachineName"; machinename_cmb.DataSource = machinelist.MachineListVo; machinename_cmb.SelectedIndex = -1; } catch { } //gfg }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { MachineVo inVo = (MachineVo)arg; StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append("Insert into m_machine"); sqlQuery.Append(" ( "); sqlQuery.Append(" machine_cd, "); sqlQuery.Append(" machine_name, "); sqlQuery.Append(" registration_user_cd, "); sqlQuery.Append(" registration_date_time, "); sqlQuery.Append(" factory_cd "); sqlQuery.Append(" ) "); sqlQuery.Append("VALUES "); sqlQuery.Append(" ( "); sqlQuery.Append(" :machinecd ,"); sqlQuery.Append(" :machinename ,"); 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("machinecd", inVo.MachineCode); sqlParameter.AddParameterString("machinename", inVo.MachineName); sqlParameter.AddParameterString("registrationusercode", inVo.RegistrationUserCode); //sqlParameter.AddParameterDateTime("registrationdatetime", inVo.RegistrationDateTime); sqlParameter.AddParameterString("factorycode", inVo.FactoryCode); MachineVo outVo = new MachineVo { AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter) }; return(outVo); }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { MachineVo inVo = (MachineVo)arg; StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append("Select Count(*) as MachineCount from m_machine "); sqlQuery.Append(" where factory_cd = :faccd "); if (inVo.MachineCode != null) { sqlQuery.Append(" and UPPER(machine_cd) = UPPER(:machinecd)"); } //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterString("faccd", UserData.GetUserData().FactoryCode); if (inVo.MachineCode != null) { sqlParameter.AddParameterString("machinecd", inVo.MachineCode); } //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); MachineVo outVo = new MachineVo(); while (dataReader.Read()) { outVo.AffectedCount = Convert.ToInt32(dataReader["MachineCount"]); } dataReader.Close(); return(outVo); }