private static PurchOrderLines LoadOneRecord(DataTable dt) { PurchOrderLines retVal = new PurchOrderLines(); if (dt != null) { foreach (DataRow dr in dt.Rows) { retVal = (Load(dr)); } } return(retVal); }
public void UpdatePOLines(PurchOrderLines _PurchOrderLines) { using (CustomSqlConnection connection = new CustomSqlConnection()) { using (SqlCommand cmd = new SqlCommand("sp_UpdateVendorPOLines", connection)) { cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add(new CustomSqlParameter("id_PurchLine", SqlDbType.UniqueIdentifier, _PurchOrderLines.id_PurchLine)); cmd.Parameters.Add(new CustomSqlParameter("UnitPrice", SqlDbType.Float, _PurchOrderLines.UnitPrice)); cmd.Parameters.Add(new CustomSqlParameter("Quantity", SqlDbType.Float, _PurchOrderLines.Quantity)); cmd.Parameters.Add(new CustomSqlParameter("Amount", SqlDbType.Float, _PurchOrderLines.Amount)); cmd.Parameters.Add(new CustomSqlParameter("ProdCode", SqlDbType.NVarChar, _PurchOrderLines.ProdCode)); cmd.ExecuteNonQuery(); } } }
private static PurchOrderLines Load(DataRow dr) { PurchOrderLines retVal = new PurchOrderLines { id_PurchOrder = dr["id_PurchOrder"].EnsureGuid(), id_PurchLine = dr["id_PurchLine"].EnsureGuid(), Amount = dr["Amount"].EnsureDouble(), PurchLineCode = dr["PurchLineCode"].EnsureString(), UnitPrice = dr["UnitPrice"].EnsureDouble(), Quantity = dr["Quantity"].EnsureDouble(), ProdCode = dr["ProdCode"].EnsureString(), ProdDesc = dr["ProdDesc"].EnsureString() }; return(retVal); }