private void btnEdit_Click(object sender, EventArgs e) { try { PODeliveryShedule objPODeliveryShedule = new PODeliveryShedule(); objPODeliveryShedule.MaterialCode = cmbMaterials.SelectedValue.ToString(); objPODeliveryShedule.PONO = txtPONO.Text; objPODeliveryShedule.ExpectedDate = dtpDeliveryDate.Value; if (chkShipmentDate.Checked == false) { objPODeliveryShedule.ShipmentDate = Convert.ToDateTime("1900-01-01 00:00:00.000"); } else { objPODeliveryShedule.ShipmentDate = dtpShipmentDate.Value; } objPODeliveryShedule.Qty = Convert.ToDecimal(txtReqQty.Text); objPODeliveryShedules_DL.Update(objPODeliveryShedule); Load_DeliveryShedules(); } catch (Exception ex) { } }
public PODeliveryShedule Get(String ID) { try { DataTable dt = new DataTable(); PODeliveryShedule obj = new PODeliveryShedule(); SqlParameter[] paramList = new SqlParameter[] { new SqlParameter("@ID", ID) }; dt = Execute.RunSP_DataTable(Connection, "SPGET_PODeliverySchedule_By_ID", paramList); if (dt.Rows.Count > 0) { obj.ExpectedDate = Convert.ToDateTime(dt.Rows[0]["ExpectedDate"]); obj.ID = Convert.ToInt32(dt.Rows[0]["ID"]); obj.MaterialCode = Convert.ToString(dt.Rows[0]["MaterialCode"]); obj.PONO = Convert.ToString(dt.Rows[0]["PONO"]); obj.Qty = Convert.ToDecimal(dt.Rows[0]["Qty"]); obj.ShipmentDate = Convert.ToDateTime(dt.Rows[0]["ShipmentDate"]); } return(obj); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
private void gvPODeliveryShedule_CellClick(object sender, DataGridViewCellEventArgs e) { try { PODeliveryShedule obj = new PODeliveryShedule(); obj = objPODeliveryShedules_DL.Get(txtPONO.Text); txtReqQty.Text = obj.Qty.ToString(); dtpDeliveryDate.Value = obj.ExpectedDate; dtpShipmentDate.Value = obj.ShipmentDate; } catch (Exception ex) { } }
public int Update(PODeliveryShedule obj) { try { SqlParameter[] paramList = new SqlParameter[] { new SqlParameter("@MaterialCode", obj.MaterialCode), new SqlParameter("@Qty", obj.Qty), new SqlParameter("@ExpectedDate", obj.ExpectedDate), new SqlParameter("@ShipmentDate", obj.ShipmentDate), new SqlParameter("@ID", obj.ID) }; return(Execute.RunSP_RowsEffected(Connection, "SPUPDATE_PODeliveryShedule", paramList)); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }
public long Add(PODeliveryShedule obj) { try { SqlParameter[] paramList = new SqlParameter[] { new SqlParameter("@PONO", obj.PONO), new SqlParameter("@MaterialCode", obj.MaterialCode), new SqlParameter("@Qty", obj.Qty), new SqlParameter("@DeliveryOrder", obj.ID), new SqlParameter("@ExpectedDate", obj.ExpectedDate), new SqlParameter("@ShipmentDate", obj.ShipmentDate) }; return(Execute.RunSP_RowsEffected(Connection, "SPADD_PODeliverySchedule", paramList)); } catch (Exception ex) { throw new Exception(ex.Message, ex); } }