コード例 #1
0
ファイル: DeliveryHandler.cs プロジェクト: Gcobani/urbanbooks
 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);
 }
コード例 #2
0
ファイル: DeliveryHandler.cs プロジェクト: Gcobani/urbanbooks
        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;
        }
コード例 #3
0
ファイル: DeliveryHandler.cs プロジェクト: Gcobani/urbanbooks
        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;
            }
        }
コード例 #4
0
 public bool UpdateDeliveryServiceID(Delivery delivery)
 {
     DeliveryHandler myHandler = new DeliveryHandler(); return myHandler.UpdateDelivery(delivery);
 }
コード例 #5
0
 public bool AddDeliveryService(Delivery deliveryService)
 {
     DeliveryHandler myHandler = new DeliveryHandler(); return myHandler.InsertDelivery(deliveryService);
 }