public void DeleteServiceUsed(int IDBookingHallService) { DatabaseDA aDatabaseDA = new DatabaseDA(); BookingHalls_Services aBookingHalls_Services = aDatabaseDA.BookingHalls_Services.Where(a => a.ID == IDBookingHallService).ToList()[0]; if (aBookingHalls_Services != null) { aDatabaseDA.BookingHalls_Services.Remove(aBookingHalls_Services); aDatabaseDA.SaveChanges(); } }
public int Save() { try { DatabaseDA aDatabaseDA = new DatabaseDA(); BookingRooms aTemp = aDatabaseDA.BookingRooms.Where(a => a.ID == this.ID).ToList()[0]; aTemp.ID = this.ID; aTemp.IDBookingR = this.IDBookingR; aTemp.CodeRoom = this.CodeRoom; aTemp.Cost = this.Cost; aTemp.PercentTax = this.PercentTax; aTemp.CostRef_Rooms = this.CostRef_Rooms; aTemp.Note = this.Note; aTemp.CheckInPlan = this.CheckInPlan; aTemp.CheckInActual = this.CheckInActual; aTemp.CheckOutPlan = this.CheckOutPlan; aTemp.CheckOutActual = this.CheckOutActual; aTemp.BookingStatus = this.BookingStatus; aTemp.Status = this.Status; aTemp.StartTime = this.StartTime; aTemp.EndTime = this.EndTime; aTemp.IsAllDayEvent = this.IsAllDayEvent; aTemp.Color = this.Color; aTemp.IsRecurring = this.IsRecurring; aTemp.IsEditable = this.IsEditable; aTemp.AdditionalColumn1 = this.AdditionalColumn1; aTemp.CostPendingRoom = this.CostPendingRoom; aTemp.TimeInUse = this.TimeInUse; aTemp.AddTimeStart = this.AddTimeStart; aTemp.AddTimeEnd = this.AddTimeEnd; aTemp.Type = this.Type; //aTemp.Type = this.SetBookingRoomType(this.IsCheckInEarly, this.IsCheckOutLate); aTemp.Disable = this.Disable; aTemp.IndexSubPayment = this.IndexSubPayment; aTemp.AcceptDate = this.AcceptDate; aTemp.InvoiceDate = this.InvoiceDate; aTemp.InvoiceNumber = this.InvoiceNumber; foreach (ServiceUsedEN item in this.ListServiceUsed) { item.Save(1); } aTemp.PriceType = this.PriceType; aDatabaseDA.BookingRooms.AddOrUpdate(aTemp); aDatabaseDA.SaveChanges(); return 0; } catch (Exception e) { return 1; //throw new Exception("Lỗi khi insert..."); } }
public void Save() { try { DatabaseDA aDatabaseDA = new DatabaseDA(); BookingHalls aTemp = aDatabaseDA.BookingHalls.Where(a => a.ID == this.ID).ToList()[0]; if (aTemp != null) { aTemp.ID = this.ID; aTemp.CodeHall = this.CodeHall; aTemp.Cost = this.Cost; aTemp.PercentTax = this.PercentTax; aTemp.CostRef_Halls = this.CostRef_Halls; aTemp.Date = this.Date; aTemp.LunarDate = this.LunarDate; aTemp.BookingStatus = this.BookingStatus; aTemp.Unit = this.Unit; aTemp.TableOrPerson = this.TableOrPerson; aTemp.Note = this.Note; aTemp.Status = this.Status; aTemp.Location = this.Location; aTemp.StartTime = this.StartTime; aTemp.EndTime = this.EndTime; aTemp.IsAllDayEvent = this.IsAllDayEvent; aTemp.Color = this.Color; aTemp.IsRecurring = this.IsRecurring; aTemp.IsEditable = this.IsEditable; aTemp.AdditionalColumn1 = this.AdditionalColumn1; aTemp.IDBookingH = this.IDBookingH; aTemp.IndexSubPayment = this.IndexSubPayment; aTemp.AcceptDate = this.AcceptDate; aTemp.InvoiceDate = this.InvoiceDate ; aTemp.InvoiceNumber = this.InvoiceNumber; foreach (ServiceUsedEN item in this.aListServiceUsed) { item.Save(2); } aDatabaseDA.BookingHalls.AddOrUpdate(aTemp); aDatabaseDA.SaveChanges(); } } catch (Exception ex) { throw new Exception(string.Format("BookingHallUsedEN.Save :" + ex.Message.ToString())); } }
public void PaymentHall() { DatabaseDA aDatabaseDA = new DatabaseDA(); if (aDatabaseDA.BookingHs.Where(a => a.ID == IDBookingH).ToList().Count > 0) { BookingHs aTemp = aDatabaseDA.BookingHs.Where(a => a.ID == IDBookingH).ToList()[0]; aTemp.CreatedDate = this.CreatedDate_BookingH; aTemp.Status = 8; aTemp.BookingMoney = this.BookingHMoney; aTemp.InvoiceDate = this.InvoiceDate; aTemp.InvoiceNumber = this.InvoiceNumber; aTemp.DatePay = DateTime.Now; aDatabaseDA.BookingHs.AddOrUpdate(aTemp); aDatabaseDA.SaveChanges(); foreach (BookingHallUsedEN item in this.aListBookingHallUsed) { foreach (ServiceUsedEN item1 in item.aListServiceUsed) { item1.StatusPay = 8; } item.Status = 8; item.Save(); } } }
public void Save(int ServiceType) { try { DatabaseDA aDatabaseDA = new DatabaseDA(); if (ServiceType == 1) { if (aDatabaseDA.BookingRooms_Services.Where(b => b.ID == this.IDBookingService).ToList().Count > 0 ) { BookingRooms_Services aTemp = aDatabaseDA.BookingRooms_Services.Where(b => b.ID == this.IDBookingService).ToList()[0]; aTemp.Cost = this.Cost; aTemp.CostRef_Services = this.CostRef_Service; aTemp.Date = this.DateUsed; aTemp.PercentTax = this.Tax; aTemp.Quantity = this.Quantity; aTemp.Status = this.StatusPay; aTemp.ID = this.IDBookingService; aTemp.IndexSubPayment = this.IndexSubPayment; aTemp.AcceptDate = this.AcceptDate; aTemp.InvoiceDate = this.InvoiceDate; aTemp.InvoiceNumber = this.InvoiceNumber; aDatabaseDA.BookingRooms_Services.AddOrUpdate(aTemp); aDatabaseDA.SaveChanges(); } } else if (ServiceType == 2) { if (aDatabaseDA.BookingHalls_Services.Where(b => b.ID == this.IDBookingService).ToList().Count > 0) { BookingHalls_Services aTemp = aDatabaseDA.BookingHalls_Services.Where(b => b.ID == this.IDBookingService).ToList()[0]; aTemp.Cost = this.Cost; aTemp.CostRef_Services = this.CostRef_Service; aTemp.Date = this.DateUsed; aTemp.PercentTax = this.Tax; aTemp.Quantity = this.Quantity; aTemp.Status = this.StatusPay; aTemp.ID = this.IDBookingService; aTemp.IndexSubPayment = this.IndexSubPayment; aTemp.AcceptDate = this.AcceptDate; aTemp.InvoiceDate = this.InvoiceDate; aTemp.InvoiceNumber = this.InvoiceNumber; aDatabaseDA.BookingHalls_Services.AddOrUpdate(aTemp); aDatabaseDA.SaveChanges(); } } } catch (Exception ex) { throw new Exception(string.Format("ServiceUsedEN.Save :" + ex.Message.ToString())); } }
public void Save() { try { DatabaseDA aDatabaseDA = new DatabaseDA(); if (IDBookingR != null) { BookingRs aTemp = aDatabaseDA.BookingRs.Where(a => a.ID == IDBookingR).ToList()[0]; if (aTemp != null) { aTemp.CreatedDate = this.CreatedDate_BookingR; aTemp.ID = Convert.ToInt32(this.IDBookingR); aTemp.Status = this.Status_BookingR; aTemp.InvoiceNumber = this.InvoiceNumber; aTemp.AcceptDate = this.AcceptDate.GetValueOrDefault(Convert.ToDateTime("01/01/1900")); aTemp.InvoiceDate = this.InvoiceDate.GetValueOrDefault(Convert.ToDateTime("01/01/1900")); aTemp.BookingMoney = this.BookingRMoney; aTemp.PayMenthod = this.PayMenthodR; aDatabaseDA.BookingRs.AddOrUpdate(aTemp); aDatabaseDA.SaveChanges(); } foreach (BookingRoomUsedEN item in this.aListBookingRoomUsed) { item.Save(); } } if (IDBookingH != null) { BookingHs aTemp = aDatabaseDA.BookingHs.Where(a => a.ID == IDBookingH).ToList()[0]; if (aTemp != null) { aTemp.CreatedDate = this.CreatedDate_BookingH; aTemp.ID = Convert.ToInt32(this.IDBookingH); aTemp.Status = this.Status_BookingH; aTemp.BookingMoney = this.BookingHMoney; aTemp.InvoiceNumber = this.InvoiceNumber; aTemp.AcceptDate = this.AcceptDate; aTemp.InvoiceDate = this.InvoiceDate; aTemp.PayMenthod = this.PayMenthodH; aDatabaseDA.BookingHs.AddOrUpdate(aTemp); aDatabaseDA.SaveChanges(); } foreach (BookingHallUsedEN item in this.aListBookingHallUsed) { item.Save(); } } // Luu thong tin cong ty Companies aCompany = aDatabaseDA.Companies.Where(a => a.ID == this.IDCompany).ToList()[0]; aCompany.TaxNumberCode = this.TaxNumberCodeCompany; aCompany.Address = this.AddressCompany; aCompany.ID = Convert.ToInt32(this.IDCompany); aDatabaseDA.Companies.AddOrUpdate(aCompany); aDatabaseDA.SaveChanges(); // Luu thong tin bookingRoom + Hall } catch (Exception ex) { throw new Exception(string.Format("BookingRoomUsedEN.Save :" + ex.Message.ToString())); } }
public void PaymentTotal() { if (this.aListBookingHallUsed.Count > 0) { this.PaymentHall(); DatabaseDA aDatabaseDA = new DatabaseDA(); if (aDatabaseDA.BookingRs.Where(a => a.ID == IDBookingR).ToList().Count > 0) { BookingRs aTemp = aDatabaseDA.BookingRs.Where(a => a.ID == IDBookingR).ToList()[0]; aTemp.DatePay = DateTime.Now; aTemp.Status = 8; aTemp.InvoiceDate = this.InvoiceDate; aTemp.InvoiceNumber = this.InvoiceNumber; aTemp.BookingMoney = this.BookingRMoney; aDatabaseDA.BookingRs.AddOrUpdate(aTemp); aDatabaseDA.SaveChanges(); foreach (BookingRoomUsedEN item in this.aListBookingRoomUsed) { foreach (ServiceUsedEN item1 in item.ListServiceUsed) { item1.StatusPay = 8; } item.Status = 8; item.CheckOutActual = DateTime.Now; item.Save(); } } } else { DatabaseDA aDatabaseDA = new DatabaseDA(); if (aDatabaseDA.BookingRs.Where(a => a.ID == IDBookingR).ToList().Count > 0) { BookingRs aTemp = aDatabaseDA.BookingRs.Where(a => a.ID == IDBookingR).ToList()[0]; aTemp.DatePay = DateTime.Now; aTemp.Status = 8; aTemp.InvoiceDate = this.InvoiceDate; aTemp.InvoiceNumber = this.InvoiceNumber; aTemp.BookingMoney = this.BookingRMoney; aDatabaseDA.BookingRs.AddOrUpdate(aTemp); aDatabaseDA.SaveChanges(); foreach (BookingRoomUsedEN item in this.aListBookingRoomUsed) { foreach (ServiceUsedEN item1 in item.ListServiceUsed) { item1.StatusPay = 8; } item.Status = 8; item.CheckOutActual = DateTime.Now; item.Save(); } } } }
public int SaveBookingRoom(BookingRoomUsedEN aBookingRoomUsedEN) { DatabaseDA aDatabaseDA = new DatabaseDA(); BookingRooms aTemp = aDatabaseDA.BookingRooms.Where(a => a.ID == aBookingRoomUsedEN.ID).ToList()[0]; aTemp.ID = aBookingRoomUsedEN.ID; aTemp.IDBookingR = aBookingRoomUsedEN.IDBookingR; aTemp.CodeRoom = aBookingRoomUsedEN.CodeRoom; aTemp.Cost = aBookingRoomUsedEN.Cost; aTemp.PercentTax = aBookingRoomUsedEN.PercentTax; aTemp.CostRef_Rooms = aBookingRoomUsedEN.CostRef_Rooms; aTemp.Note = aBookingRoomUsedEN.Note; aTemp.CheckInPlan = aBookingRoomUsedEN.CheckInPlan; aTemp.CheckInActual = aBookingRoomUsedEN.CheckInActual; aTemp.CheckOutPlan = aBookingRoomUsedEN.CheckOutPlan; aTemp.CheckOutActual = aBookingRoomUsedEN.CheckOutActual; aTemp.BookingStatus = aBookingRoomUsedEN.BookingStatus; aTemp.Status = aBookingRoomUsedEN.Status; aTemp.StartTime = aBookingRoomUsedEN.StartTime; aTemp.EndTime = aBookingRoomUsedEN.EndTime; aTemp.IsAllDayEvent = aBookingRoomUsedEN.IsAllDayEvent; aTemp.Color = aBookingRoomUsedEN.Color; aTemp.IsRecurring = aBookingRoomUsedEN.IsRecurring; aTemp.IsEditable = aBookingRoomUsedEN.IsEditable; aTemp.AdditionalColumn1 = aBookingRoomUsedEN.AdditionalColumn1; aTemp.CostPendingRoom = aBookingRoomUsedEN.CostPendingRoom; aTemp.TimeInUse = aBookingRoomUsedEN.TimeInUse; aTemp.AddTimeStart = aBookingRoomUsedEN.AddTimeStart; aTemp.AddTimeEnd = aBookingRoomUsedEN.AddTimeEnd; aTemp.Type = aBookingRoomUsedEN.Type; aTemp.Disable = aBookingRoomUsedEN.Disable; aTemp.IndexSubPayment = aBookingRoomUsedEN.IndexSubPayment; aTemp.AcceptDate = aBookingRoomUsedEN.AcceptDate; aTemp.InvoiceDate = aBookingRoomUsedEN.InvoiceDate; aTemp.InvoiceNumber = aBookingRoomUsedEN.InvoiceNumber; foreach (ServiceUsedEN item in aBookingRoomUsedEN.ListServiceUsed) { this.SaveServiceUsed(item, 1); } aTemp.PriceType = aBookingRoomUsedEN.PriceType; aDatabaseDA.BookingRooms.AddOrUpdate(aTemp); return aDatabaseDA.SaveChanges(); }
public void Save(NewPaymentHEN aNewPaymentHEN) { try { DatabaseDA aDatabaseDA = new DatabaseDA(); if (aNewPaymentHEN.IDBookingH != null) { BookingHs aTemp = aDatabaseDA.BookingHs.Where(a => a.ID == aNewPaymentHEN.IDBookingH).ToList()[0]; if (aTemp != null) { aTemp.CreatedDate = aNewPaymentHEN.CreatedDate_BookingH; aTemp.ID = Convert.ToInt32(aNewPaymentHEN.IDBookingH); aTemp.Status = aNewPaymentHEN.Status_BookingH; aTemp.BookingMoney = aNewPaymentHEN.BookingHMoney; aTemp.InvoiceNumber = aNewPaymentHEN.InvoiceNumber; aTemp.AcceptDate = aNewPaymentHEN.AcceptDate; aTemp.InvoiceDate = aNewPaymentHEN.InvoiceDate; aTemp.PayMenthod = aNewPaymentHEN.PayMenthodH; aDatabaseDA.BookingHs.AddOrUpdate(aTemp); aDatabaseDA.SaveChanges(); } foreach (BookingHallUsedEN item in aNewPaymentHEN.aListBookingHallUsed) { this.SaveBookingHall(item); } } // Luu thong tin cong ty Companies aCompany = aDatabaseDA.Companies.Where(a => a.ID == aNewPaymentHEN.IDCompany).ToList()[0]; aCompany.TaxNumberCode = aNewPaymentHEN.TaxNumberCodeCompany; aCompany.Address = aNewPaymentHEN.AddressCompany; aCompany.ID = Convert.ToInt32(aNewPaymentHEN.IDCompany); aDatabaseDA.Companies.AddOrUpdate(aCompany); aDatabaseDA.SaveChanges(); } catch (Exception ex) { throw new Exception(string.Format("AccountancyBO.Save :" + ex.Message.ToString())); } }
public void PaymentRoom(NewPaymentEN aNewPaymentEN) { if (aNewPaymentEN.IDBookingH != null) { foreach (BookingRoomUsedEN item in aNewPaymentEN.aListBookingRoomUsed) { if (item.Status == 7) { item.Status = 8; } else { item.Status = 8; item.CheckOutActual = DateTime.Now; } foreach (ServiceUsedEN item1 in item.ListServiceUsed) { item1.StatusPay = 8; } this.SaveBookingRoom(item); } } else { DatabaseDA aDatabaseDA = new DatabaseDA(); if (aDatabaseDA.BookingRs.Where(a => a.ID == aNewPaymentEN.IDBookingR).ToList().Count > 0) { BookingRs aTemp = aDatabaseDA.BookingRs.Where(a => a.ID == aNewPaymentEN.IDBookingR).ToList()[0]; aTemp.DatePay = DateTime.Now; aTemp.Status = 8; aTemp.InvoiceDate = aNewPaymentEN.InvoiceDate; aTemp.InvoiceNumber = aNewPaymentEN.InvoiceNumber; aTemp.BookingMoney = aNewPaymentEN.BookingRMoney; aTemp.AcceptDate = aNewPaymentEN.AcceptDate; aDatabaseDA.BookingRs.AddOrUpdate(aTemp); aDatabaseDA.SaveChanges(); foreach (BookingRoomUsedEN item in aNewPaymentEN.aListBookingRoomUsed) { if (item.Status == 7) { item.Status = 8; } else { item.Status = 8; item.CheckOutActual = DateTime.Now; } foreach (ServiceUsedEN item1 in item.ListServiceUsed) { item1.StatusPay = 8; } this.SaveBookingRoom(item); } } } }