Beispiel #1
0
        public List<OrderSummary> getOrders(string email)
        {
            DB db = new DB();

            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "GetOrders";

            cmd.Parameters.AddWithValue("@email", email);

            DataTable dt = db.Execute(cmd);

            List<OrderSummary> orders = new List<OrderSummary>();

            foreach (DataRow dr in dt.Rows)
            {
                OrderSummary ordersummary = new OrderSummary
                {
                    OrderID = Int32.Parse(dr["OrderNo"].ToString()),
                    OrderDate = DateTime.Parse(dr["OrderDate"].ToString()),
                    ShipDate = DateTime.Parse(dr["ShipDate"].ToString()).Date,
                    OrderStatus = dr["OrderStatus"].ToString(),
                    BillingStatus = dr["BillingStatus"].ToString(),
                    OrderType = dr["OrderType"].ToString(),
                    OrderAmount = double.Parse(dr["OrderAmount"].ToString())
                };

                orders.Add(ordersummary);

            }
            return orders;
        }
Beispiel #2
0
        public OrderSummary getOrder(int OrderID)
        {
            DB db = new DB();

            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.CommandText = "GetOrder";

            cmd.Parameters.AddWithValue("@OrderNo", OrderID);

            DataTable dt = db.Execute(cmd);

            DataRow dr = dt.Rows[0];

            OrderSummary ordersummary = new OrderSummary
            {
                OrderID = Int32.Parse(dr["OrderNo"].ToString()),
                OrderDate = DateTime.Parse(dr["OrderDate"].ToString()),
                ShipDate = DateTime.Parse(dr["ShipDate"].ToString()).Date,
                OrderStatus = dr["OrderStatus"].ToString(),
                BillingStatus = dr["BillingStatus"].ToString(),
                OrderType = dr["OrderType"].ToString(),
                OrderAmount = double.Parse(dr["OrderAmount"].ToString())
            };

            return ordersummary;
        }