public bool InsertDelivery(Delivery delivery) { SqlParameter[] Params = new SqlParameter[] { new SqlParameter("@DeliveryName", delivery.ServiceName ), new SqlParameter("@DeliveryType", delivery.ServiceType), new SqlParameter("@Price", delivery.Price) }; return DataProvider.ExecuteNonQuery("sp_InsertDelivery", CommandType.StoredProcedure, Params); }
public Delivery GetDeliveryDetails(int deliveryId) { Delivery delivery = null; SqlParameter[] Params = { new SqlParameter("@DeliveryID", deliveryId) }; using (DataTable table = DataProvider.ExecuteParamatizedSelectCommand("sp_ViewSpecificDelivery", CommandType.StoredProcedure, Params)) { if (table.Rows.Count == 1) { DataRow row = table.Rows[0]; delivery = new Delivery(); delivery.DeliveryServiceID = Convert.ToInt32(row["DeliveryServiceID"]); delivery.ServiceName = row["ServiceName"].ToString(); delivery.ServiceType = row["ServiceType"].ToString(); delivery.Price = Convert.ToDecimal(row["Price"]); } } return delivery; }
public List<Delivery> GetDeliveryList() { List<Delivery> DeliveryList = null; using (DataTable table = DataProvider.ExecuteSelectCommand("sp_ViewDeliveries", CommandType.StoredProcedure)) { if (table.Rows.Count > 0) { DeliveryList = new List<Delivery>(); foreach (DataRow row in table.Rows) { Delivery delivery = new Delivery(); delivery.DeliveryServiceID = Convert.ToInt32(row["DeliveryServiceID"]); delivery.ServiceName = row["ServiceName"].ToString(); delivery.Price =Convert.ToDecimal(row["Price"]); DeliveryList.Add(delivery); } } return DeliveryList; } }
public bool UpdateDeliveryServiceID(Delivery delivery) { DeliveryHandler myHandler = new DeliveryHandler(); return myHandler.UpdateDelivery(delivery); }
public bool AddDeliveryService(Delivery deliveryService) { DeliveryHandler myHandler = new DeliveryHandler(); return myHandler.InsertDelivery(deliveryService); }