public OutputOnDbProperty SearchPO(PurchaseOrderProperty dataItem) { OutputOnDbProperty IN_resultData = new OutputOnDbProperty(); //## Check PO ###################################################################### IN_resultData = this.CheckPo(dataItem); if (IN_resultData.StatusOnDb == true) { if (IN_resultData.ResultOnDb.Rows.Count <= 0) { //Insert PO resultData = this.InsertPO(dataItem); } else { //Updata PO resultData = this.UpdataPO(dataItem); } } else { return(IN_resultData); } return(resultData); }
private void txtSerial_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (txtSerial.Text == "") { MessageBox.Show("Please Input Serial", "Stop", MessageBoxButtons.OK, MessageBoxIcon.Information); this.ClearPage(); return; } this.btnSave.Enabled = (this.txtSerial.Text.Count() > 0) ? true : false; InputProperty _searchSerial = new InputProperty { SERIAL_NO = txtSerial.Text.Trim() }; _data = new PurchaseOrderProperty(); _data = _controller.SearchSerialUpdatePO(_searchSerial); if (_data.Order == null || _data.Flow == null || _data.Input == null || _data.Serial == null) { MessageBox.Show("Not found data Please Check Serial", "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); this.ClearPage(); return; } this.lblFFT_OR.Text = _data.Order.FFT_ORDER_ID; this.lblGroup.Text = _data.Order.GROUP; this.lblInputtype.Text = _data.Input.ORDER_TYPE_NAME; this.txtPO.Text = (_data.PO != "" || _data.PO != null) ?_data.PO:""; this.txtPO.Enabled = true; } }
public string SearchPO(PurchaseOrderProperty dataItem) { sql = @"SELECT SERIAL_ID, FFT_ORDER_ID,`GROUP` FROM `po` WHERE REPLACE(SERIAL_ID, ' ', '') = REPLACE('" + dataItem.Serial.ID + @"', ' ', '') AND REPLACE(FFT_ORDER_ID, ' ', '') = REPLACE('" + dataItem.Order.FFT_ORDER_ID + @"', ' ', '') AND REPLACE(`GROUP`, ' ', '') = REPLACE('" + dataItem.Order.GROUP + @"', ' ', '');"; return(sql); }
public string UpdataPO(PurchaseOrderProperty dataItem) { sql = @"UPDATE `po` SET po = 'TEST' WHERE REPLACE(SERIAL_ID, ' ', '') = REPLACE('" + dataItem.Serial.ID + @"', ' ', '') AND REPLACE(FFT_ORDER_ID, ' ', '') = REPLACE('" + dataItem.Order.FFT_ORDER_ID + @"', ' ', '') AND REPLACE(`GROUP`, ' ', '') = REPLACE('" + dataItem.Order.GROUP + @"', ' ', '') AND REPLACE(`FLOW_ID`, ' ', '') = REPLACE('" + dataItem.Flow.ID + @"', ' ', ''); "; return(sql); }
public PurchaseOrderProperty SearchSerialUpdatePO(InputProperty dataItem) { PurchaseOrderProperty _result = new PurchaseOrderProperty(); try { _resultData = _models.SearchSerialUpdatePO(dataItem); if (_resultData.StatusOnDb == true) { if (_resultData.ResultOnDb.Rows.Count > 0) { _result.Serial = new SerialProperty { ID = _resultData.ResultOnDb.Rows[0]["ID_SERIAL"].ToString(), SERIAL = _resultData.ResultOnDb.Rows[0]["SERIAL"].ToString() }; _result.Order = new OrderProperty { FFT_ORDER_ID = _resultData.ResultOnDb.Rows[0]["FFT_ORDER_ID"].ToString(), GROUP = _resultData.ResultOnDb.Rows[0]["GROUP"].ToString() }; _result.Flow = new FlowProperty { ID = _resultData.ResultOnDb.Rows[0]["FLOW_ID"].ToString(), }; _result.Input = new InputtypeProperty { ORDER_TYPE_NAME = _resultData.ResultOnDb.Rows[0]["INPUT_TYPE"].ToString() }; _result.PO = _resultData.ResultOnDb.Rows[0]["PO"].ToString(); } } else { MessageBox.Show(_resultData.MessageOnDb, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(_result); } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return(_result); } }
public string InsertPO(PurchaseOrderProperty dataItem) { sql = @"INSERT INTO `po` ( SERIAL_ID ,FFT_ORDER_ID ,`GROUP` ,FLOW_ID ,PO ,EMP_ID ) ( SELECT '" + dataItem.Serial.ID + @"' AS SERIAL_ID ,'" + dataItem.Order.FFT_ORDER_ID + @"' AS FFT_ORDER_ID ,'" + dataItem.Order.GROUP + @"' AS `GROUP` ,'" + dataItem.Flow.ID + @"' AS FLOW_ID ,'" + dataItem.PO + @"' AS `PO` ,'" + dataItem.Order.EMP.code + @"' AS `EMP` );"; return(sql); }
public bool SearchPO(PurchaseOrderProperty dataItem) { bool _result = false; try { _resultData = _models.SearchPO(dataItem); if (_resultData.StatusOnDb == true) { MessageBox.Show(_resultData.MessageOnDb, "Success", MessageBoxButtons.OK, MessageBoxIcon.Information); _result = true; } else { MessageBox.Show(_resultData.MessageOnDb, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } return(_result); }
public OutputOnDbProperty SearchPO(PurchaseOrderProperty dataItem) { _resultData = _services.SearchPO(dataItem); return(_resultData); }
public OutputOnDbProperty UpdataPO(PurchaseOrderProperty dataItem) { sql = _sqlFactoryPO.UpdataPO(dataItem); resultData = base.UpdateBySql(sql); return(resultData); }
public OutputOnDbProperty CheckPo(PurchaseOrderProperty dataItem) { sql = _sqlFactoryPO.SearchPO(dataItem); resultData = base.SearchBySql(sql); return(resultData); }
private void btnSave_Click(object sender, EventArgs e) { PurchaseOrderProperty _insertPO = new PurchaseOrderProperty { PO = txtPO.Text.Trim() }; _insertPO.Order = new OrderProperty { FFT_ORDER_ID = lblFFT_OR.Text.Trim(), GROUP = lblGroup.Text.Trim() }; _insertPO.Order.EMP = new EmpProperty { code = frm._empLogin.code }; _insertPO.Flow = new FlowProperty { ID = _data.Flow.ID.ToString() }; _insertPO.Serial = new SerialProperty { ID = _data.Serial.ID.ToString() }; if (_insertPO.PO == "" || _insertPO.PO == null) { MessageBox.Show("Not found PO Please Check PO", "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); this.ClearPage(); return; } if (_insertPO.Order.FFT_ORDER_ID == "" || _insertPO.Order.FFT_ORDER_ID == null) { MessageBox.Show("Not found FFT_ORDER_ID Please Check FFT_ORDER_ID", "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); this.ClearPage(); return; } if (_insertPO.Order.GROUP == "" || _insertPO.Order.GROUP == null) { MessageBox.Show("Not found GROUP Please Check GROUP", "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); this.ClearPage(); return; } if (_insertPO.Order.EMP.code == "" || _insertPO.Order.EMP.code == null) { MessageBox.Show("Not found CODE_EMP Please Check CODE_EMP", "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); this.ClearPage(); return; } if (_insertPO.Flow.ID == "" || _insertPO.Flow.ID == null) { MessageBox.Show("Not found FLOW_ID Please Check FLOW_ID", "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); this.ClearPage(); return; } if (_insertPO.Serial.ID == "" || _insertPO.Serial.ID == null) { MessageBox.Show("Not found Serial_ID Please Check Serial_ID", "Stop", MessageBoxButtons.OK, MessageBoxIcon.Stop); this.ClearPage(); return; } //insert if (_controller.SearchPO(_insertPO)) { this.ClearPage(); } }