private void btnDelete_Click(object sender, EventArgs e) { DialogResult dlg = MessageBox.Show("Do you want to delete this row ?", "Delete", MessageBoxButtons.YesNo); if (dlg == DialogResult.No) { return; } try { dgvTester.Rows.RemoveAt(dgvTester.SelectedRows[0].Index); IPQCVo vo = (IPQCVo)DefaultCbmInvoker.Invoke(new DeleteItemCbm(), new IPQCVo { No = dgvTester.CurrentRow.Cells["no"].Value.ToString(), Model = dgvTester.CurrentRow.Cells["col_model"].Value.ToString(), Process = dgvTester.CurrentRow.Cells["process"].Value.ToString(), Inspect = dgvTester.CurrentRow.Cells["inspect"].Value.ToString() }, conStringIPQC); } catch (Exception ex) { MessageBox.Show(ex.Message, "Database Responce", MessageBoxButtons.OK, MessageBoxIcon.Warning); } }
public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { IPQCVo inVo = (IPQCVo)vo; StringBuilder sql = new StringBuilder(); ValueObjectList <IPQCVo> voList = new ValueObjectList <IPQCVo>(); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); sql.Append("select inspect, lot, inspectdate, line, qc_user, status, m1, m2, m3, m4, m5, x, r FROM tbl_measure_history WHERE model = :model AND process = :process AND inspect = :inspect AND lot >= :lot AND lot <= :lotlast AND line = :line order by lot, inspectdate"); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameter("model", inVo.Model); sqlParameter.AddParameter("process", inVo.Process); sqlParameter.AddParameter("inspect", inVo.Inspect); sqlParameter.AddParameter("lot", inVo.Lot); sqlParameter.AddParameter("lotlast", inVo.LotLast); sqlParameter.AddParameter("line", inVo.Line); sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); DataSet ds = new DataSet(); ds = sqlCommandAdapter.ExecuteDataSet(sqlParameter); //execute SQL IPQCVo outVo = new IPQCVo { dt = ds.Tables[0] }; return(outVo); }
public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { IPQCVo inVo = (IPQCVo)vo; //Insert StringBuilder sql = new StringBuilder(); sql.Append("INSERT INTO tbl_measure_item(no, model, process, inspect, description, upper, lower, instrument, clm_set, row_set) VALUES (:no, :model, :process, :inspect, :description, :upper, :lower, :instrument, :clm_set, :row_set)"); DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameter("no", inVo.No); sqlParameter.AddParameter("model", inVo.Model); sqlParameter.AddParameter("process", inVo.Process); sqlParameter.AddParameter("inspect", inVo.Inspect); sqlParameter.AddParameter("description", inVo.Description); sqlParameter.AddParameter("upper", inVo.Upper); sqlParameter.AddParameter("lower", inVo.Lower); sqlParameter.AddParameter("instrument", inVo.Instrument); sqlParameter.AddParameter("clm_set", inVo.ClmSet); sqlParameter.AddParameter("row_set", inVo.RowSet); IPQCVo outVo = new IPQCVo { AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter) }; return(outVo); }
public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { IPQCVo inVo = (IPQCVo)vo; StringBuilder sql = new StringBuilder(); ValueObjectList <IPQCVo> voList = new ValueObjectList <IPQCVo>(); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sql.Append("select upper, lower, clm_set, row_set, instrument from tbl_measure_item where model = '" + inVo.Model + "' and inspect = '" + inVo.Inspect + "' and process = '" + inVo.Process + "'"); sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); while (dataReader.Read()) { IPQCVo outVo = new IPQCVo { Upper = double.Parse(dataReader["upper"].ToString()), Lower = double.Parse(dataReader["lower"].ToString()), Instrument = dataReader["instrument"].ToString(), ClmSet = int.Parse(dataReader["clm_set"].ToString()), RowSet = int.Parse(dataReader["row_set"].ToString()) }; voList.add(outVo); } dataReader.Close(); return(voList); }
public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { IPQCVo inVo = (IPQCVo)vo; StringBuilder sql = new StringBuilder(); IPQCVo voList = new IPQCVo(); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sql.Append("delete from tbl_measure_item where no = '" + inVo.No + "' and model = '" + inVo.Model + "' and inspect = '" + inVo.Inspect + "' and process = '" + inVo.Process + "'"); sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); IPQCVo outVo = new IPQCVo { AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter) }; return(outVo); }
public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { IPQCVo inVo = (IPQCVo)vo; StringBuilder sql = new StringBuilder(); ValueObjectList <IPQCVo> voList = new ValueObjectList <IPQCVo>(); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sql.Append("SELECT model FROM tbl_model_dbplace ORDER BY model"); sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); while (dataReader.Read()) { IPQCVo outVo = new IPQCVo { Model = dataReader["model"].ToString() }; voList.add(outVo); } dataReader.Close(); return(voList); }
public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { IPQCVo inVo = (IPQCVo)vo; StringBuilder sql = new StringBuilder(); ValueObjectList <IPQCVo> voList = new ValueObjectList <IPQCVo>(); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sql.Append("select clm_set, description from tbl_measure_item where inspect = '" + inVo.Inspect + "'"); sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); while (dataReader.Read()) { IPQCVo outVo = new IPQCVo { ClmSet = int.Parse(dataReader["clm_set"].ToString()), Description = dataReader["description"].ToString() }; voList.add(outVo); } dataReader.Close(); return(voList); }
public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { IPQCVo inVo = (IPQCVo)vo; StringBuilder sql = new StringBuilder(); ValueObjectList <IPQCVo> voList = new ValueObjectList <IPQCVo>(); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sql.Append("select line from tbl_model_line where model = '" + inVo.Model + "' order by line"); sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); while (dataReader.Read()) { IPQCVo outVo = new IPQCVo { Line = dataReader["line"].ToString() }; voList.add(outVo); } dataReader.Close(); return(voList); }
public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { IPQCVo inVo = (IPQCVo)vo; StringBuilder sql = new StringBuilder(); ValueObjectList <IPQCVo> voList = new ValueObjectList <IPQCVo>(); //create command DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //create parameter DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sql.Append("select no, model, process, inspect, description, instrument from tbl_measure_item where model='" + inVo.Model + "' order by no, process, inspect"); sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); //execute SQL IDataReader dataReader = sqlCommandAdapter.ExecuteReader(trxContext, sqlParameter); while (dataReader.Read()) { IPQCVo outVo = new IPQCVo { No = dataReader["no"].ToString(), Model = dataReader["model"].ToString(), Process = dataReader["process"].ToString(), Inspect = dataReader["inspect"].ToString(), Description = dataReader["description"].ToString(), Instrument = dataReader["instrument"].ToString() }; voList.add(outVo); } dataReader.Close(); return(voList); }
private void btnRegister_Click(object sender, EventArgs e) { if (dtBuffer.Rows.Count <= 0) { return; } string model = txtModel.Text; string process = txtProcess.Text; string inspect = txtInspect.Text; string status = txtStatus.Text; DateTime lot = DateTime.Parse(dtBuffer.Rows[0]["lot"].ToString());; DateTime inspectdate = DateTime.Parse(dtBuffer.Rows[0]["inspectdate"].ToString());; string line = cmbLine.Text; calculateAverageAndRangeInDataTable(ref dtBuffer); bool res; try { vo = (IPQCVo)DefaultCbmInvoker.Invoke(new AddDataCbm(), new IPQCVo { Model = model, Process = process, Inspect = inspect, Lot = lot, Inspectdate = inspectdate, Line = line, ins = 1, dt = dtBuffer }, connectionIPQC); res = true; } catch (Framework.ApplicationException ex) { logger.Error(ex.GetMessageData()); popUpMessage.ApplicationError(ex.GetMessageData(), Text); res = false; } if (res) { DataTable dtTemp = new DataTable(); dtTemp = dtBuffer.Copy(); dtBuffer.Clear(); readDtHistory(); updateDataGripViews(dtBuffer, dtHistory, ref dgvBuffer, ref dgvHistory); btnRegister.Text = "Register"; dtpLotInput.Enabled = true; } }
private void btnDelete_Click(object sender, EventArgs e) { if (dtBuffer.Rows.Count <= 0) { return; } DialogResult result = MessageBox.Show("Do you really want to delete the selected row?", "Notice", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2); if (result == DialogResult.No) { MessageBox.Show("Delete process was canceled.", "Notice", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2); } else if (result == DialogResult.Yes) { try { vo = (IPQCVo)DefaultCbmInvoker.Invoke(new AddDataCbm(), new IPQCVo { Model = txtModel.Text, Inspect = txtInspect.Text, Lot = DateTime.Parse(dtBuffer.Rows[0]["lot"].ToString()), Inspectdate = DateTime.Parse(dtBuffer.Rows[0]["inspectdate"].ToString()), Line = cmbLine.Text, ins = 0 }, connectionIPQC); messageData = new MessageData("mmci00003", Properties.Resources.mmci00003); popUpMessage.Information(messageData, "Notice"); } catch (Framework.ApplicationException ex) { logger.Error(ex.GetMessageData()); popUpMessage.ApplicationError(ex.GetMessageData(), Text); } DataTable dtTemp = new DataTable(); dtTemp = dtBuffer.Copy(); dtBuffer.Clear(); readDtHistory(); colorViewReset(ref dgvHistory); updateDataGripViews(dtBuffer, dtHistory, ref dgvBuffer, ref dgvHistory); btnRegister.Text = "Register"; dtpLotInput.Enabled = true; } }
private void dgvHistory_CellContentClick(object sender, DataGridViewCellEventArgs e) { int curRow = int.Parse(e.RowIndex.ToString()); if (dgvHistory.Columns[e.ColumnIndex] == Open && curRow >= 0) { btnRegister.Text = "Update"; dtpLotInput.Enabled = false; dtBuffer.Clear(); try { vo = (IPQCVo)DefaultCbmInvoker.Invoke(new ReadBufferCbm(), new IPQCVo { Model = txtModel.Text, Inspect = dgvHistory["inspect", curRow].Value.ToString(), Lot = (DateTime)dgvHistory["lot", curRow].Value, Inspectdate = (DateTime)dgvHistory["inspectdate", curRow].Value, Line = dgvHistory["line", curRow].Value.ToString() }, connectionIPQC); } catch (Framework.ApplicationException ex) { logger.Error(ex.GetMessageData()); popUpMessage.ApplicationError(ex.GetMessageData(), Text); return; } dtBuffer = vo.dt; updateDataGripViews(dtBuffer, dtHistory, ref dgvBuffer, ref dgvHistory); if (dgvHistory.Rows.Count >= 1) { dgvHistory.FirstDisplayedScrollingRowIndex = curRow; } colorViewForEdit(ref dgvHistory, curRow); colorViewForEdit(ref dgvBuffer, 0); } }
private void btnSave_Click(object sender, EventArgs e) { try { IPQCVo delvo = (IPQCVo)DefaultCbmInvoker.Invoke(new DeleteBeforeAddCbm(), new IPQCVo { Model = model }, conStringIPQC); for (int i = 0; i < dgvTester.Rows.Count; i++) { IPQCVo vo = (IPQCVo)DefaultCbmInvoker.Invoke(new AddItemCbm(), new IPQCVo { No = dgvTester["no", i].Value.ToString(), Model = model, Process = dgvTester["process", i].Value.ToString(), Inspect = dgvTester["inspect", i].Value.ToString(), Description = dgvTester["description", i].Value.ToString(), Upper = double.Parse(dgvTester["upper", i].Value.ToString()), Lower = double.Parse(dgvTester["lower", i].Value.ToString()), Instrument = dgvTester["instrument", i].Value.ToString(), ClmSet = int.Parse(dgvTester["clmset", i].Value.ToString()), RowSet = int.Parse(dgvTester["rowset", i].Value.ToString()) }, conStringIPQC); } MessageBox.Show(Properties.Resources.mmci00002, "Notice", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.Message, "Database Responce", MessageBoxButtons.OK, MessageBoxIcon.Warning); } finally { dgvTester.ReadOnly = true; dgvTester.AllowUserToAddRows = false; btnSave.Enabled = false; btnAdd.Enabled = true; btnDelete.Enabled = true; } }
private void readDtHistory() { try { vo = (IPQCVo)DefaultCbmInvoker.Invoke(new ReadHistoryCbm(), new IPQCVo { Model = txtModel.Text, Process = txtProcess.Text, Inspect = txtInspect.Text, Lot = dtpLotFrom.Value, LotLast = dtpLotTo.Value, Line = cmbLine.Text }, connectionIPQC); } catch (Framework.ApplicationException ex) { logger.Error(ex.GetMessageData()); popUpMessage.ApplicationError(ex.GetMessageData(), Text); return; } dtHistory = vo.dt; }
public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { IPQCVo inVo = (IPQCVo)vo; //Delete StringBuilder sql = new StringBuilder(); sql.Append("delete from tbl_measure_item where model = :model"); DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameter("model", inVo.Model); IPQCVo outVo = new IPQCVo { AffectedCount = sqlCommandAdapter.ExecuteNonQuery(sqlParameter) }; return(outVo); }
private void btnExport_Click(object sender, EventArgs e) { try { vo = (IPQCVo)DefaultCbmInvoker.Invoke(new AddDataCbm(), new IPQCVo { Inspect = txtInspect.Text }, connectionIPQC); } catch (Framework.ApplicationException ex) { logger.Error(ex.GetMessageData()); popUpMessage.ApplicationError(ex.GetMessageData(), Text); } string sample = vo.Inspect; string descrip = vo.Description; Excel_Class xl = new Excel_Class(); string dtpFrom = dtpLotFrom.Value.ToString("yyyy/MM/dd"); string dtpTo = dtpLotTo.Value.ToString("yyyy/MM/dd"); xl.exportExcelIPQC(txtModel.Text, cmbLine.Text, txtUser.Text, txtUsl.Text, txtLsl.Text, txtProcess.Text, txtInspect.Text, sample, descrip, dgvHistory, dtpFrom, dtpTo); }
public override ValueObject Execute(TransactionContext trxContext, ValueObject vo) { IPQCVo inVo = (IPQCVo)vo; //Delete StringBuilder sqlDel = new StringBuilder(); sqlDel.Append("delete from tbl_measure_history where model = :model and inspect = :inspect and lot = :lot and inspectdate = :inspectdate and line = :line"); DbCommandAdaptor sqlCommandAdapterDel = base.GetDbCommandAdaptor(trxContext, sqlDel.ToString()); DbParameterList sqlParameterDel = sqlCommandAdapterDel.CreateParameterList(); sqlParameterDel.AddParameter("model", inVo.Model); sqlParameterDel.AddParameter("inspect", inVo.Inspect); sqlParameterDel.AddParameter("lot", inVo.Lot); sqlParameterDel.AddParameter("inspectdate", inVo.Inspectdate); sqlParameterDel.AddParameter("line", inVo.Line); sqlCommandAdapterDel.ExecuteNonQuery(sqlParameterDel); if (inVo.ins == 1) { //Insert StringBuilder sql = new StringBuilder(); sql.Append("insert into tbl_measure_history(model, process, inspect, lot, inspectdate, line, qc_user, status, row_set, m1, m2, m3, m4, m5, x, r) VALUES (:model, :process , :inspect, :lot, :inspectdate, :line ,:qc_user, :status, :row_set, :m1, :m2, :m3, :m4, :m5, :x, :r)"); DbCommandAdaptor sqlCommandAdapter = base.GetDbCommandAdaptor(trxContext, sql.ToString()); DbParameterList sqlParameter = sqlCommandAdapter.CreateParameterList(); sqlParameter.AddParameter("model", inVo.Model); sqlParameter.AddParameter("process", inVo.Process); sqlParameter.AddParameter("inspect", inVo.Inspect); sqlParameter.AddParameter("lot", inVo.Lot); sqlParameter.AddParameter("inspectdate", inVo.Inspectdate); sqlParameter.AddParameter("line", inVo.Line); sqlParameter.AddParameter("status", inVo.Status); int k = 1; for (int i = 0; i < inVo.dt.Rows.Count; i++) { sqlParameter.AddParameter("qc_user", inVo.dt.Rows[i]["qc_user"]); sqlParameter.AddParameter("row_set", k); sqlParameter.AddParameter("m1", inVo.dt.Rows[i]["m1"]); sqlParameter.AddParameter("m2", inVo.dt.Rows[i]["m2"]); sqlParameter.AddParameter("m3", inVo.dt.Rows[i]["m3"]); sqlParameter.AddParameter("m4", inVo.dt.Rows[i]["m4"]); sqlParameter.AddParameter("m5", inVo.dt.Rows[i]["m5"]); sqlParameter.AddParameter("x", inVo.dt.Rows[i]["x"]); sqlParameter.AddParameter("r", inVo.dt.Rows[i]["r"]); sqlCommandAdapter.ExecuteNonQuery(sqlParameter); k++; } } IPQCVo outVo = new IPQCVo { AffectedCount = 1 }; return(outVo); }