/// <summary> /// Constractor setting up some test data. /// </summary> public ListOrderViewModel() { // TestData for (int i = 0; i < 50; i++) { ListOrders.Add(new OrderModel { CustomerModel = new CustomerModel { FirstName = "Son", LastName = "Goku" }, InvoiceNumber = new InvoiceGenerator().GenerateInvoice(), Id = 1, OrderTime = DateTime.Now, TaxAble = false, ServiceModels = new List <ServiceModel> { new ServiceModel { Cost = 25 + i, Description = "TestRecord" + i }, new ServiceModel { Cost = 25 + i * 2, Description = "TestRecord" + i * 3 } } }); } // FListOrders = ListOrders; }
public void Update() { ListOrders.Clear(); foreach (var item in _storage.Orders) { ListOrders.Add(_storage.GetOrder(item.OrderNumer)); } MinTime = !ListPosts.Any() ? 8 : ListPosts.Min(o => o.TimeFrom).Hours; MaxTime = !ListPosts.Any() ? 18 : (int)Math.Ceiling(ListPosts.Max(o => o.TimeTo).TotalHours); Columns.Clear(); for (var i = MinTime; i < MaxTime; i++) { Columns.Add(Date + new TimeSpan(i, 0, 0)); Columns.Add(Date + new TimeSpan(i, 30, 0)); } Columns.Add(Date + new TimeSpan(MaxTime, 0, 0)); }
public static ListOrders GetParkingOrderDet(int userID) { ListOrders lst = new ListOrders(); using (SqlConnection Conn = new SqlConnection("server=SURESHJALAJA-PC;database=Parking;uid=sa;password=suresh;")) { using (SqlCommand Cmd = new SqlCommand(Constants.Proc.USP_GET_ORDERDETAILS, Conn)) { Cmd.CommandType = CommandType.StoredProcedure; Cmd.Parameters.Add("@UserID", SqlDbType.Int).Value = userID; Conn.Open(); using (SqlDataReader dr = Cmd.ExecuteReader()) { while (dr.Read()) { OrderBO Obj = new OrderBO(); Obj.OrderID = Convert.ToInt32(dr["OrderID"]); Obj.FullName = Convert.ToString(dr["FullName"]); Obj.ParkingAvalabilityID = Convert.ToInt32(dr["ParkingAvalabilityID"]); Obj.UserID = Convert.ToInt32(dr["UserID"]); Obj.Price = Convert.ToDecimal(dr["Price"]); Obj.ParkingIDs = Convert.ToString(dr["ParkingIDs"]); Obj.FromDateTime = dr["DateTimeFrom"]!=DBNull.Value? Convert.ToDateTime(dr["DateTimeFrom"]):DateTime.MinValue; Obj.ToDateTime = dr["DateTimeTo"] != DBNull.Value ? Convert.ToDateTime(dr["DateTimeTo"]) : DateTime.MinValue; Obj.BuildingName = Convert.ToString(dr["BuildingName"]); Obj.TowerName = Convert.ToString(dr["TowerName"]); lst.Add(Obj); } } } } return lst; }