private void Update_btn_Click(object sender, EventArgs e) { if (modelname_cmb.SelectedIndex >= 0) { ModelVo modelvo = (ModelVo)modelname_cmb.SelectedItem; ValueObjectList <ModelProcessVo> deletelist = new ValueObjectList <ModelProcessVo>(); ValueObjectList <ModelProcessVo> addlist = new ValueObjectList <ModelProcessVo>(); for (int i = 0; i < Process_dgv.Rows.Count; i++) { ModelProcess mg = (ModelProcess)Process_dgv.Rows[i].DataBoundItem; if (mg.ModelProcessId > 0 && !mg.Selected) { deletelist.add(new ModelProcessVo { ModelProcessID = mg.ModelProcessId }); } else if (mg.ModelProcessId == 0 && mg.Selected) { addlist.add(new ModelProcessVo { ModelID = modelvo.ModelId, ProcessID = mg.mvo.ProcessId, FactoryCode = UserData.GetUserData().FactoryCode, RegistrationUserCode = UserData.GetUserData().UserCode }); } } if (deletelist.GetList().Count > 0) { DefaultCbmInvoker.Invoke(new DeleteModelProcessCbm(), deletelist); } if (addlist.GetList().Count > 0) { DefaultCbmInvoker.Invoke(new AddModelProcessCbm(), 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); modelname_cmb_SelectedIndexChanged(null, null); } } }
public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { ModelLineVo inVo = (ModelLineVo)vo; StringBuilder sql = new StringBuilder(); DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, string.Empty); DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sql.Append("delete from public.m_model_line Where 1=1 "); if (!String.IsNullOrEmpty(inVo.FactoryCode)) { sql.Append(" and factory_cd = :factory_cd "); sqlParameter.AddParameterString("factory_cd", inVo.FactoryCode); } if (inVo.ModelID > 0) { sql.Append(" and model_id = :model_id "); sqlParameter.AddParameterInteger("model_id", inVo.ModelID); } if (inVo.LineID > 0) { sql.Append(" and line_id = :line_id "); sqlParameter.AddParameterInteger("line_id", inVo.LineID); } if (inVo.ModelLineID > 0) { sql.Append(" and model_line_id = :model_line_id "); sqlParameter.AddParameterInteger("model_line_id", inVo.ModelLineID); } //create command sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //execute SQL ModelVo outVo = new ModelVo { AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter) }; return(outVo); }
private void model_cmb_SelectedIndexChanged(object sender, EventArgs e) { ModelVo mvo = (ModelVo)model_cmb.SelectedItem; ValueObjectList <LineVo> linevo = (ValueObjectList <LineVo>)DefaultCbmInvoker.Invoke(new GetLineMoCbm(), new LineVo { LineId = mvo.ModelId }); line_cmb.DisplayMember = "LineCode"; line_cmb.DataSource = linevo.GetList(); line_cmb.ResetText(); ValueObjectList <ProcessWorkVo> ProcessWorkvolist = (ValueObjectList <ProcessWorkVo>)DefaultCbmInvoker.Invoke(new GetProcessWorkCbm(), new ProcessWorkVo { ProcessWorkId = mvo.ModelId }); process_cmb.DisplayMember = "ProcessWorkName"; process_cmb.DataSource = ProcessWorkvolist.GetList(); }
private void model_cmb_SelectedIndexChanged(object sender, EventArgs e) { if (model_cmb.SelectedItem != null) { ModelVo mvo = (ModelVo)model_cmb.SelectedItem; ValueObjectList<LineVo> linevo = (ValueObjectList<LineVo>)DefaultCbmInvoker.Invoke(new GetLineMoCbm(), new LineVo { LineId = mvo.ModelId }); line_cmb.DisplayMember = "LineCode"; line_cmb.DataSource = linevo.GetList(); } if (model_cmb.SelectedItem != null) { ModelVo mvo = (ModelVo)model_cmb.SelectedItem; ValueObjectList<ProcessVo> linevo = (ValueObjectList<ProcessVo>)DefaultCbmInvoker.Invoke(new GetProcessModelCbm(), new ProcessVo { ProcessId = mvo.ModelId }); process_cmb.DisplayMember = "ProcessName"; process_cmb.DataSource = linevo.GetList(); } }
/// <summary> /// selects user record for updation and show user form /// </summary> private void BindUpdateCavityData() { int selectedrowindex = Machine_dgv.SelectedCells[0].RowIndex; ModelVo vo = (ModelVo)Machine_dgv.Rows[selectedrowindex].DataBoundItem; AddModelMasterForm addform = new AddModelMasterForm(); addform.vo = vo; if (addform.ShowDialog() == DialogResult.OK) { messageData = new MessageData("mmci00002", Properties.Resources.mmci00002, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); GridBind(); } }
private void Delete_btn_Click(object sender, EventArgs e) { if (Machine_dgv.SelectedRows.Count > 0) { int selectedrowindex = Machine_dgv.SelectedCells[0].RowIndex; ModelVo vo = (ModelVo)Machine_dgv.Rows[selectedrowindex].DataBoundItem; messageData = new MessageData("mmcc00004", Properties.Resources.mmcc00004, vo.ModelCode); logger.Info(messageData); DialogResult dialogResult = popUpMessage.ConfirmationOkCancel(messageData, Text); if (dialogResult == DialogResult.OK) { try { ModelVo outVo = (ModelVo)DefaultCbmInvoker.Invoke(new DeleteModelCbm(), vo); if (outVo.AffectedCount > 0) { messageData = new MessageData("mmci00003", Properties.Resources.mmci00003, null); logger.Info(messageData); popUpMessage.Information(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 (Com.Nidec.Mes.Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); } } } }
private bool CheckDate() { if (ModelCode_txt.Text.Trim().Length == 0) { messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, ModelCode_lbl.Text); popUpMessage.Warning(messageData, Text); ModelCode_txt.Focus(); return(false); } if (ModelName_txt.Text.Trim().Length == 0) { messageData = new MessageData("mmcc00005", Properties.Resources.mmcc00005, ModelName_lbl.Text); popUpMessage.Warning(messageData, Text); ModelName_txt.Focus(); return(false); } ModelCode_txt.Text = ModelCode_txt.Text.Trim(); ModelName_txt.Text = ModelName_txt.Text.Trim(); ModelVo outVo = new ModelVo(), inVo = new ModelVo { ModelId = vo.ModelId, ModelCode = ModelCode_txt.Text }; try { outVo = (ModelVo)DefaultCbmInvoker.Invoke(new CheckModelCbm(), inVo); if (outVo.AffectedCount > 0) { messageData = new MessageData("mmcc00006", Properties.Resources.mmcc00006, ModelCode_lbl.Text); popUpMessage.Warning(messageData, Text); ModelCode_txt.Focus(); return(false); } } catch (Com.Nidec.Mes.Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); return(false); } return(true); }
/// <summary> /// form country and factory data for combo /// </summary> //private void FormDatatableFromVo() //{ // moldDatatable = new DataTable(); // moldDatatable.Columns.Add("id"); // moldDatatable.Columns.Add("code"); // try // { // MoldVo moldOutVo = (MoldVo)base.InvokeCbm(new GetMoldMasterMntCbm(), new MoldVo (), false); // foreach (MoldVo mold in moldOutVo.MoldListVo) // { // moldDatatable.Rows.Add(mold.MoldId, mold.MoldCode); // } // } // catch (Framework.ApplicationException exception) // { // popUpMessage.ApplicationError(exception.GetMessageData(), Text); // logger.Error(exception.GetMessageData()); // } //} /// <summary> /// checks duplicate mold Code /// </summary> /// <returns></returns> private ModelVo DuplicateCheck(ModelVo ModelVo) { ModelVo outVo = new ModelVo(); try { this.Cursor = Cursors.WaitCursor; outVo = (ModelVo)base.InvokeCbm(new CheckModelMasterMntCbm(), ModelVo, false); } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); } finally { this.Cursor = Cursors.Default; } return(outVo); }
public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { ModelVo inVo = (ModelVo)vo; StringBuilder sql = new StringBuilder(); DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, string.Empty); DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sql.Append("Select Count(*) as ModelCount "); sql.Append(" from public.m_model"); sql.Append(" Where 1=1 "); if (!String.IsNullOrEmpty(inVo.FactoryCode)) { sql.Append(" and factory_cd = :factory_cd "); sqlParameter.AddParameterString("factory_cd", inVo.FactoryCode); } if (!string.IsNullOrEmpty(inVo.ModelCode)) { sql.Append(" and UPPER(model_cd) = UPPER(:model_cd) "); sqlParameter.AddParameterString("model_cd", inVo.ModelCode); } if (inVo.ModelId > 0) { sql.Append(" and model_id != :model_id "); ///????? sqlParameter.AddParameterInteger("model_id", inVo.ModelId); } sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); ModelVo outVo = new ModelVo(); while (dataReader.Read()) { outVo.AffectedCount = Convert.ToInt32(dataReader["ModelCount"].ToString()); } dataReader.Close(); return(outVo); }
private void model_cmb_SelectedIndexChanged(object sender, EventArgs e) { if (model_cmb.SelectedItem != null) { ModelVo mvo = (ModelVo)model_cmb.SelectedItem; ValueObjectList <DrawingVo> drawvolist = (ValueObjectList <DrawingVo>)DefaultCbmInvoker.Invoke(new GetDrawingModelCbm(), new DrawingVo { ModelId = mvo.ModelId }); drawing_cmb.DisplayMember = "DrawType"; drawing_cmb.DataSource = drawvolist.GetList(); drawing_cmb.Text = ""; ModelVo mdvo = (ModelVo)model_cmb.SelectedItem; ValueObjectList <DrawingVo> machinevolist = (ValueObjectList <DrawingVo>)DefaultCbmInvoker.Invoke(new GetMachineModelCbm(), new DrawingVo { ModelId = mdvo.ModelId }); Machine_cmb.DisplayMember = "MachineName"; Machine_cmb.DataSource = machinevolist.GetList(); Machine_cmb.Text = ""; } }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { ModelVo inVo = (ModelVo)arg; StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append("select count(mm.model_cd) as MoldModelCount from m_model mm"); sqlQuery.Append(" inner join m_mold_detail mod on mod.mold_model_id = mm.model_id"); sqlQuery.Append(" where 1 = 1 "); if (inVo.ModelCode != null) { //sqlQuery.Append(" and UPPER(model_cd) = UPPER(:modelcd) "); sqlQuery.Append(" and UPPER(model_cd) = UPPER(:modelcd) "); } //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); if (inVo.ModelCode != null) { sqlParameter.AddParameterString("modelcd", inVo.ModelCode); } //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); ModelVo outVo = new ModelVo(); while (dataReader.Read()) { outVo.AffectedCount = Convert.ToInt32("0" + dataReader["MoldModelCount"]); } dataReader.Close(); return(outVo); }
private void version_cmb_TextChanged(object sender, EventArgs e) { ModelVo mdvo = (ModelVo)model_cmb.SelectedItem; DocumentVo dvo = (DocumentVo)version_cmb.SelectedItem; ValueObjectList <DocumentVo> dvolist = null; try { dvolist = (ValueObjectList <DocumentVo>)DefaultCbmInvoker.Invoke(getndcbm, new DocumentVo { ModelID = mdvo.ModelId, DocumentCode = version_cmb.Text }); } catch (Framework.ApplicationException ex) { logger.Error(ex.GetMessageData()); popUpMessage.ApplicationError(ex.GetMessageData(), Text); return; } doc_name_cmb.DisplayMember = "DocumentName"; doc_name_cmb.DataSource = dvolist.GetList(); doc_name_cmb.Text = ""; }
private void doc_type_cmb_SelectedIndexChanged(object sender, EventArgs e) { ModelVo mdvo = (ModelVo)model_cmb.SelectedItem; DocumentVo dcvo = (DocumentVo)doc_type_cmb.SelectedItem; ValueObjectList <DocumentVo> dovolist = null; try { dovolist = (ValueObjectList <DocumentVo>)DefaultCbmInvoker.Invoke(dcdCbm, new DocumentVo { ModelID = mdvo.ModelId, DocumentType = dcvo.DocumentType }); } catch (Framework.ApplicationException ex) { logger.Error(ex.GetMessageData()); popUpMessage.ApplicationError(ex.GetMessageData(), Text); return; } version_cmb.DisplayMember = "DocumentCode"; version_cmb.DataSource = dovolist.GetList(); version_cmb.Text = ""; }
private void model_cmb_SelectedIndexChanged(object sender, EventArgs e) { if (model_cmb.SelectedItem != null) { ModelVo mvo = (ModelVo)model_cmb.SelectedItem; ValueObjectList <DrawVo> drawlist = null; try { drawlist = (ValueObjectList <DrawVo>)DefaultCbmInvoker.Invoke(getDrawCmb, new DrawVo()); } catch (Framework.ApplicationException ex) { logger.Error(ex.GetMessageData()); popUpMessage.ApplicationError(ex.GetMessageData(), Text); return; } drawing_cmb.DisplayMember = "DrawCode"; BindingSource b = new BindingSource(drawlist.GetList(), null); drawing_cmb.DataSource = b; drawing_cmb.Text = ""; } }
private void Ok_btn_Click(object sender, EventArgs e) { if (CheckDate()) { ModelVo outVo = new ModelVo(); ModelVo inVo = new ModelVo { ModelId = vo.ModelId, ModelCode = ModelCode_txt.Text, ModelName = ModelName_txt.Text, FactoryCode = UserData.GetUserData().FactoryCode, RegistrationUserCode = UserData.GetUserData().UserCode }; try { if (inVo.ModelId > 0) { outVo = (ModelVo)DefaultCbmInvoker.Invoke(new UpdateModelCbm(), inVo); } else { outVo = (ModelVo)DefaultCbmInvoker.Invoke(new AddModelCbm(), inVo); } } catch (Com.Nidec.Mes.Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); return; } if ((IntSuccess > 0) || (IntSuccess == 0)) { this.DialogResult = DialogResult.OK; this.Close(); } } }
/// <summary> /// Fills all user records to gridview control /// </summary> private void GridBind(ModelVo conditionInVo) { Model_dgv.DataSource = null; try { this.Cursor = Cursors.WaitCursor; ValueObjectList <ModelVo> outVo = (ValueObjectList <ModelVo>)base.InvokeCbm(new GetModelMasterMntCbm(), conditionInVo, false); if (outVo != null && outVo.GetList() != null && outVo.GetList().Count > 0) { Model_dgv.AutoGenerateColumns = false; BindingSource ModelSource1 = new BindingSource(outVo.GetList(), null); Model_dgv.DataSource = ModelSource1; } else { messageData = new MessageData("mmci00006", Properties.Resources.mmci00006, null); //"Model" logger.Info(messageData); popUpMessage.Information(messageData, Text); } Model_dgv.ClearSelection(); Update_btn.Enabled = false; Delete_btn.Enabled = false; } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); } finally { this.Cursor = Cursors.Default; } }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { ModelVo inVo = (ModelVo)arg; StringBuilder sqlQuery = new StringBuilder(); sqlQuery.Append("Delete From m_model"); sqlQuery.Append(" Where "); sqlQuery.Append(" model_id = :modelid ;"); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameterInteger("modelid", inVo.ModelId); ModelVo outVo = new ModelVo { AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter) }; return(outVo); }
/// <summary> /// delete record from DB /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Delete_btn_Click(object sender, EventArgs e) { int selectedrowindex = Model_dgv.SelectedCells[0].RowIndex; DataGridViewRow selectedRow = Model_dgv.Rows[selectedrowindex]; messageData = new MessageData("mmcc00004", Properties.Resources.mmcc00004, selectedRow.Cells["colModelCode"].Value.ToString()); logger.Info(messageData); DialogResult dialogResult = popUpMessage.ConfirmationOkCancel(messageData, Text); if (dialogResult == DialogResult.OK) { ModelVo inVo = new ModelVo(); inVo.ModelId = Convert.ToInt32(selectedRow.Cells["colModelId"].Value); inVo.ModelCode = selectedRow.Cells["colModelCode"].Value.ToString(); try { ModelVo checkVo = CheckRelation(inVo); if (checkVo != null && checkVo.AffectedCount > 0) { messageData = new MessageData("mmce00007", Properties.Resources.mmce00007, "Mold"); popUpMessage.Information(messageData, Text); return; } //this.StartProgress(Properties.Resources.mmci00013); ModelVo outVo = (ModelVo)base.InvokeCbm(new DeleteModelMasterMntCbm(), inVo, false); //this.CompleteProgress(); 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.mmci00004, null); logger.Info(messageData); popUpMessage.Information(messageData, Text); GridBind(FormConditionVo()); } } catch (Framework.ApplicationException exception) { //this.CompleteProgress(); popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); } finally { this.Cursor = Cursors.Default; } } else if (dialogResult == DialogResult.Cancel) { //do something else } }
public override ValueObject Execute(TransactionContext trxContext, ValueObject arg) { ModelVo inVo = (ModelVo)arg; StringBuilder sqlQuery = new StringBuilder(); //create SQL sqlQuery.Append("Select md.model_id, md.model_cd, md.model_name "); sqlQuery.Append(" from m_model md "); sqlQuery.Append(" where 1 = 1 "); if (inVo.ModelCode != null) { sqlQuery.Append(" and md.model_cd like :modelcd "); } if (inVo.ModelName != null) { sqlQuery.Append(" and md.model_name like :modelnm "); } sqlQuery.Append(" order by md.model_cd"); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sqlQuery.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); if (inVo.ModelCode != null) { sqlParameter.AddParameterString("modelcd", inVo.ModelCode + "%"); } if (inVo.ModelName != null) { sqlParameter.AddParameterString("modelnm", inVo.ModelName + "%"); } //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); ValueObjectList <ModelVo> outVo = null; while (dataReader.Read()) { ModelVo currOutVo = new ModelVo(); currOutVo.ModelId = Convert.ToInt32(dataReader["model_id"]); currOutVo.ModelCode = dataReader["model_cd"].ToString(); currOutVo.ModelName = dataReader["model_name"].ToString(); if (outVo == null) { outVo = new ValueObjectList <ModelVo>(); } outVo.add(currOutVo); } dataReader.Close(); return(outVo); }
internal ModelVo InvokeCbm(UpdateModelCbm updateModelCbm, ModelVo inVo, bool v) { throw new NotImplementedException(); }
/// <summary> /// update the record to db /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Ok_btn_Click(object sender, EventArgs e) { ModelVo inVo = new ModelVo(); if (CheckMandatory()) { var sch = StringCheckHelper.GetInstance(); if (!sch.IsASCII(ModelCode_txt.Text) || !sch.IsASCII(ModelName_txt.Text)) { messageData = new MessageData("mmce00003", Properties.Resources.mmce00003); logger.Info(messageData); popUpMessage.ConfirmationOkCancel(messageData, Text); if (!sch.IsASCII(ModelCode_txt.Text)) { ModelCode_txt.Focus(); } else { ModelName_txt.Focus(); } return; } inVo.ModelCode = ModelCode_txt.Text.Trim(); inVo.ModelName = ModelName_txt.Text.Trim(); if (string.Equals(mode, CommonConstants.MODE_ADD)) { ModelVo checkVo = DuplicateCheck(inVo); if (checkVo != null && checkVo.AffectedCount > 0) { messageData = new MessageData("mmce00001", Properties.Resources.mmce00001, ModelCode_lbl.Text + " : " + ModelCode_txt.Text); logger.Info(messageData); popUpMessage.ConfirmationOkCancel(messageData, Text); ModelCode_txt.Focus(); return; } } try { this.Cursor = Cursors.WaitCursor; if (string.Equals(mode, CommonConstants.MODE_ADD)) { ModelVo outVo = (ModelVo)base.InvokeCbm(new AddModelMasterMntCbm(), inVo, false); IntSuccess = outVo.ModelId; } else if (mode.Equals(CommonConstants.MODE_UPDATE)) { inVo.ModelId = updateData.ModelId; ModelVo outVo = (ModelVo)base.InvokeCbm(new UpdateModelMasterMntCbm(), inVo, false); IntSuccess = outVo.AffectedCount; } } catch (Framework.ApplicationException exception) { popUpMessage.ApplicationError(exception.GetMessageData(), Text); logger.Error(exception.GetMessageData()); return; } finally { this.Cursor = Cursors.Default; } if ((IntSuccess > 0) || (IntSuccess == 0)) { this.Close(); } } }