//---------- FORM CONSTRUCTOR ----------// public Form_Accountant() { //--- Initialize ----// InitializeComponent(); qLInvoiceBLL = new QLInvoiceBLL(); cbb_InvoiceSort.SelectedIndex = 0; calendarVM = new CalendarVM(); tp = STATAB_USE; if (tabControl_Accountant.TabPages.Contains(tp)) { tabControl_Accountant.TabPages.Remove(tp); } listButton = new List <Button>() { INVO_VIEW, INVO_DELETE }; //--- Set GUI ----// dtp_From.Enabled = false; dtp_To.Enabled = false; grbx_StatisticOptions.Enabled = false; grbx_AnalyzeOptions.Enabled = false; Authorization(); }
public IEnumerable <AppointmentsVM> GetAppointmentsByWeek(CalendarVM selection) { FillDB(); List <AppointmentsVM> result = new List <AppointmentsVM>(); int dayTotalCapacity = (selection.DoctorID != 0) ? 16 : db.Doctors.Count() * 16; DateTime monday = selection.Date.AddDays(-(int)selection.Date.DayOfWeek + (int)DayOfWeek.Monday); DateTime sunday = monday.AddDays(6); List <Appointment> apps = null; if (selection.DoctorID == 0) { apps = db.Appointments.Where(a => DbFunctions.TruncateTime(a.Date) >= monday.Date && DbFunctions.TruncateTime(a.Date) <= sunday.Date).ToList(); } else { apps = db.Appointments.Where(a => DbFunctions.TruncateTime(a.Date) >= monday.Date && DbFunctions.TruncateTime(a.Date) <= sunday.Date && a.DoctorID == selection.DoctorID).ToList(); } AppointmentsVM app; DateTime day; for (int i = 0; i < 7; i++) { app = new AppointmentsVM(); day = monday.AddDays(i); app.Period = day.DayOfWeek.ToString() + ", " + day.ToString("MM/dd/yyy"); app.TotalCapacity = dayTotalCapacity; app.Appointments = apps.Where(a => a.Date.Date == day.Date).Count(); result.Add(app); } return(result); }
private CalendarVM CreateCalendarFromDate(int year, int month) { string dateString = month.ToString("##") + "/01/" + year.ToString("##"); DateTime date = Convert.ToDateTime(dateString); CalendarVM calendar = new CalendarVM(); calendar.Month.Num = month; calendar.Year = year; calendar.Month.DaysInMonth = DateTime.DaysInMonth(year, month); calendar.Month.Name = GetMonthName(month); int count = 0; while (date.Month == month) { Day newDay = new Day(); newDay.Date = date; newDay.Events = (from e in db.Events where e.EventDate == date select e).OrderBy(thisEvent => thisEvent.StartTime).ToList(); calendar.Month.Days.Add(newDay); count++; date = date.AddDays(1.0); } return(calendar); }
public ActionResult Index(DateTime?date) { // to disable migration Database.SetInitializer <StorageContext>(null); // so far String userID = "adama"; Session["userID"] = userID; var today = DateTime.Today; var firstDate = date ?? CalendarService.GetFirstDateOfWeek(today); Session["firstDate"] = firstDate; var weeks = GetWeeks(firstDate); var model = new CalendarVM { FirstDay = firstDate, Today = today, Weeks = weeks, UserID = userID }; if (Session["errorText"] != null) { ViewBag.errorText = Session["errorText"].ToString(); } Session["errorText"] = ""; return(View(model)); }
public int GetTotalRow(CalendarVM searchByDate, string search, string status) { int totalrows = 0; var predicate = PredicateBuilder.True <Booking>(); if (search != "") { predicate = predicate.And(x => x.BookCode.Contains(search) || x.BookIdclientNavigation.CliCode.Contains(search) || x.BookIduserNavigation.UserCode.Contains(search)); } if (searchByDate.type.Equals("Booked Date")) { predicate = predicate.And(x => x.BookBookdate >= searchByDate.fromDate && x.BookBookdate <= searchByDate.toDate); } if (searchByDate.type.Equals("Due Date")) { predicate = predicate.And(x => x.BookDuedate >= searchByDate.fromDate && x.BookDuedate <= searchByDate.toDate); } if (searchByDate.type.Equals("Checkin Date")) { predicate = predicate.And(x => x.BookCheckindate >= searchByDate.fromDate && x.BookCheckindate <= searchByDate.toDate); } if (searchByDate.type.Equals("Checkout Date")) { predicate = predicate.And(x => x.BookCheckoutdate >= searchByDate.fromDate && x.BookCheckoutdate <= searchByDate.toDate); } if (status != "All") { predicate = predicate.And(x => x.BookStatus == status); } totalrows = AppDbContext.Instance.Bookings .Where(predicate).Count(); return(totalrows); }
public IEnumerable <AppointmentsVM> GetAppointmentsByDay(CalendarVM selection) { List <AppointmentsVM> result = new List <AppointmentsVM>(); int slotTotalCapacity = (selection.DoctorID != 0) ? 1 : db.Doctors.Count(); List <Appointment> apps = null; if (selection.DoctorID == 0) { apps = db.Appointments.Where(a => DbFunctions.TruncateTime(a.Date) == selection.Date.Date && a.Status != (int)AppointmentStatus.Canceled).ToList(); } else { apps = db.Appointments.Where(a => DbFunctions.TruncateTime(a.Date) == selection.Date.Date && a.DoctorID == selection.DoctorID && a.Status != (int)AppointmentStatus.Canceled).ToList(); } AppointmentsVM app; for (int i = 0; i < 12; i++) { app = new AppointmentsVM(); app.Period = GetAppointmentSlotByClinic(1, i); app.TotalCapacity = slotTotalCapacity; app.Appointments = apps.Where(a => a.TimeSlot == i).Count(); result.Add(app); } return(result); }
// GET: /Calendar/NextMonth/5 public ActionResult NextMonth(int?year, int?month) { if (month == null || year == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CalendarVM calendarVM = CreateNextCalendarFromDate((int)year, (int)month); return(View("Index", calendarVM)); }
public bool Insert(CalendarVM calendarVM) { if (string.IsNullOrWhiteSpace(calendarVM.Name.ToString()) || string.IsNullOrWhiteSpace(calendarVM.National_Date.ToString())) { return(false); } else { return(iCalendarRepository.Insert(calendarVM)); } }
public bool Update(int id, CalendarVM calendarVM) { if (string.IsNullOrWhiteSpace(calendarVM.Name.ToString()) || string.IsNullOrWhiteSpace(calendarVM.National_Date.ToString())) { return(false); } else { return(iCalendarRepository.Update(id, calendarVM)); } }
public int GetTotalRow(string code, CalendarVM searchByDate) { var predicate = PredicateBuilder.True <Invoice>(); if (!string.IsNullOrEmpty(code)) { predicate = predicate.And(x => x.InvCode.Contains(code)); } predicate = predicate.And(x => x.InvCreatedate >= searchByDate.fromDate && x.InvCreatedate <= searchByDate.toDate); int result = AppDbContext.Instance.Invoices.Where(predicate).Count(); return(result); }
public List <Booking> FindByProperties(int start, int length, CalendarVM searchByDate, string search, string orderby, string status) { var predicate = PredicateBuilder.True <Booking>(); if (search != "") { predicate = predicate.And(x => x.BookCode.Contains(search) || x.BookIdclientNavigation.CliCode.Contains(search) || x.BookIduserNavigation.UserCode.Contains(search)); } if (searchByDate.type.Equals("Booked Date")) { predicate = predicate.And(x => x.BookBookdate >= searchByDate.fromDate && x.BookBookdate <= searchByDate.toDate); } if (searchByDate.type.Equals("Due Date")) { predicate = predicate.And(x => x.BookDuedate >= searchByDate.fromDate && x.BookDuedate <= searchByDate.toDate); } if (searchByDate.type.Equals("Checkin Date")) { predicate = predicate.And(x => x.BookCheckindate >= searchByDate.fromDate && x.BookCheckindate <= searchByDate.toDate); } if (searchByDate.type.Equals("Checkout Date")) { predicate = predicate.And(x => x.BookCheckoutdate >= searchByDate.fromDate && x.BookCheckoutdate <= searchByDate.toDate); } if (status != "All") { predicate = predicate.And(x => x.BookStatus == status); } IQueryable <Booking> query = AppDbContext.Instance.Bookings .Include(x => x.BookIdclientNavigation) .Include(x => x.BookIduserNavigation) .Where(predicate); switch (orderby) { case "None": break; case "Total Price Asc": query = query.OrderBy(x => x.BookTotalprice); break; case "Total Price Desc": query = query.OrderByDescending(x => x.BookTotalprice); break; default: break; } List <Booking> result = query.Skip(start).Take(length).AsNoTracking().ToList(); return(result); }
public int GetPagination(int rows, string code, CalendarVM searchByDate) { int totalRows = _invoiceDALManageFacade.GetInvoiceTotalRow(code, searchByDate); int totalpage; if (totalRows % rows == 0) { totalpage = totalRows / rows; } else { totalpage = totalRows / rows + 1; } return(totalpage); }
public int GetPagination(int rows, CalendarVM searchByDate, string search, string status) { int totalRows = _bookingDALManageFacade.GetBookingTotalRow(searchByDate, search, status); int totalpage; if (totalRows % rows == 0) { totalpage = totalRows / rows; } else { totalpage = totalRows / rows + 1; } return(totalpage); }
public bool Update(int id, CalendarVM calendarVM) { var get = Get(id); if (get != null) { get.Update(calendarVM); myContext.Entry(get).State = EntityState.Modified; var result = myContext.SaveChanges(); return(result > 0); } else { return(false); } }
public bool Insert(CalendarVM calendarVM) { var push = new Calendar(calendarVM); myContext.Calendars.Add(push); var result = myContext.SaveChanges(); if (result > 0) { return(true); } else { return(false); } }
public List <BookingVM> FindByProperty(int pages, int rows, CalendarVM searchDate, string search, string orderBy, string status) { int start = (pages - 1) * rows; int length = rows; List <BookingVM> listVM = new List <BookingVM>(); foreach (Booking val in _bookingDALManageFacade.FindBooking(start, length, searchDate, search, orderBy, status)) { BookingVM bookingVm = mapper.Map <BookingVM>(val); bookingVm.Index = ++start; bookingVm.CliCode = val.BookIdclientNavigation.CliCode; bookingVm.UserCode = val.BookIduserNavigation.UserCode; listVM.Add(bookingVm); } return(listVM); }
// POST: api/Calendars public HttpResponseMessage InsertCalendar(CalendarVM calendarVM) { try { var message = Request.CreateErrorResponse(HttpStatusCode.NotFound, "404 : Data Not Found"); var result = iCalendarService.Insert(calendarVM); if (result) { message = Request.CreateResponse(HttpStatusCode.OK, calendarVM); } return(message); } catch (Exception e) { return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "500 : Internal Server Error")); } }
public async Task <IActionResult> Index(int employeeId) { var employee = await db.Employes.FirstOrDefaultAsync(e => e.Id == employeeId); if (employee == null) { return(NotFound()); } var viewModel = new CalendarVM { EmployeeId = employeeId, EmployeeName = employee.Name, EmployeeSurname = employee.Surname }; return(View(viewModel)); }
public void InsertOrUpdate(CalendarVM calendarVM) { var client = new HttpClient(); client.BaseAddress = new Uri(get.link); var myContent = JsonConvert.SerializeObject(calendarVM); var buffer = System.Text.Encoding.UTF8.GetBytes(myContent); var byteContent = new ByteArrayContent(buffer); byteContent.Headers.ContentType = new MediaTypeHeaderValue("application/json"); if (calendarVM.Id.Equals(0)) { var result = client.PostAsync("Calendars", byteContent).Result; } else { var result = client.PutAsync("Calendars/" + calendarVM.Id, byteContent).Result; } }
public JsonResult GetById(int id) { CalendarVM calendarVM = null; var client = new HttpClient(); client.BaseAddress = new Uri(get.link); var responseTask = client.GetAsync("Calendars/" + id); responseTask.Wait(); var result = responseTask.Result; if (result.IsSuccessStatusCode) { var readTask = result.Content.ReadAsAsync <CalendarVM>(); readTask.Wait(); calendarVM = readTask.Result; } else { } return(Json(calendarVM, JsonRequestBehavior.AllowGet)); }
public Form_Receptionist(int LoggedID, string LoggedRole) { InitializeComponent(); /*** Initialize Parameter ***/ _receiptionistManage = new ReceiptionistManageFacade(); //-> Booking Parameters searchByDate = new CalendarVM(); //-> Room Parameters tb_RoomPageNumber.Text = ""; //-> Room Type Parameters cbb_RoomTypeStatus.SelectedIndex = 0; /*** Load Data & Set GUI ***/ //-> Tab Page Booking cbb_BookingSearchFilter.SelectedIndex = 0; cbb_BookingSort.SelectedIndex = 0; cbb_BookingStatus.SelectedIndex = 0; tb_BookingPageNumber.Text = "0/0"; //-> Tab Page Room AddCbbRoomFilter(); addCbbRoomTypeOrder(); AddCbbActive(); //-> Tab Page Room Type listButton = new List <Button>() { ROOM_VIEW, ROOM_ADD, ROOM_UPDATE, ROOM_INACTIVE, ROOM_ACTIVE, TYPE_ACTIVE, TYPE_ADD, TYPE_INACTIVE, TYPE_UPDATE, TYPE_VIEW, BOOK_ADD, BOOK_DELETE, BOOK_UPDATE, BOOK_EXPORTINVOICE, BOOK_VIEW }; Authorization(); }
// GET: Calendar public ActionResult Index(DateTime?startDate) { Person user = stateManager.load("user"); if (user is null) { return(RedirectToAction("Index", "Home")); } DateTime startDay = startDate ?? DateTime.Today; while (startDay.DayOfWeek != DayOfWeek.Monday) { startDay = startDay.AddDays(-1); } DateTime endDay = startDay.AddDays(27); var appointments = context.Attendances.Where( a => a.PersonID == user.PersonID && a.Appointment.AppointmentDate >= startDay && a.Appointment.AppointmentDate <= endDay) .Select(a => a.Appointment); CalendarVM cal = new CalendarVM(startDay, DateTime.Today, user); foreach (WeekVM week in cal.Weeks) { foreach (DayVM d in week.Days) { var aps = appointments.Where(a => a.AppointmentDate == d.Date).OrderBy(a => a.StartTime); d.Appointments = aps.ToList(); } } return(View(cal)); }
public List <InvoiceVM> FindByProperties(int pages, int rows, string bookCode, string invCode, string orderBy, CalendarVM searchByDate) { int start = (pages - 1) * rows; int length = rows; List <InvoiceVM> listVm = new List <InvoiceVM>(); foreach (var value in _invoiceDALManageFacade.FindInvoice(start, length, bookCode, invCode, searchByDate, orderBy)) { InvoiceVM invoiceVM = mapper.Map <InvoiceVM>(value); invoiceVM.Index = ++start; listVm.Add(invoiceVM); } return(listVm); }
public List <Invoice> FindByProperties(int start, int length, string bookCode, string invCode, CalendarVM searchByDate, string orderBy) { var predicate = PredicateBuilder.True <Invoice>(); if (!string.IsNullOrEmpty(invCode)) { predicate = predicate.And(x => x.InvCode.Contains(invCode)); } if (!string.IsNullOrEmpty(bookCode)) { predicate = predicate.And(x => x.InvIdbookNavigation.BookCode.Contains(bookCode)); } if (searchByDate != null) { predicate = predicate.And(x => x.InvCreatedate >= searchByDate.fromDate && x.InvCreatedate <= searchByDate.toDate); } IQueryable <Invoice> query = AppDbContext.Instance.Invoices .Where(predicate); switch (orderBy) { case "None": break; case "Total Price Asc": query = query.OrderBy(x => x.TotalPrice); break; case "Total Price Desc": query = query.OrderByDescending(x => x.TotalPrice); break; default: break; } List <Invoice> list = query.Skip(start).Take(length).AsNoTracking().ToList(); return(list); }
public Calendar(CalendarVM calendarVM) { this.Name = calendarVM.Name; this.National_Date = calendarVM.National_Date; this.CreateDate = DateTimeOffset.Now.ToLocalTime(); }
public void Update(CalendarVM calendarVM) { this.Name = calendarVM.Name; this.National_Date = calendarVM.National_Date; this.UpdateDate = DateTimeOffset.Now.ToLocalTime(); }
public CalendarWidget() { InitializeComponent(); ViewModel = new CalendarVM(); }
public List <InvoiceVM> FindInvoice(int pages, int rows, string bookCode, string invCode, string orderBy, CalendarVM searchByDate) { return(_qLInvoiceBLLProvider.FindByProperties(pages, rows, bookCode, invCode, orderBy, searchByDate)); }
public int GetBookingPagination(int ROWS, CalendarVM searchByDate, string bookingSearch, string bookStatus) { return(_qlbookingBLLProvider.GetPagination(ROWS, searchByDate, bookingSearch, bookStatus)); }
public List <BookingVM> FindBooking(int BookingCurrentPage, int ROWS, CalendarVM searchByDate, string bookingSearch, string bookOrderBy, string bookStatus) { return(_qlbookingBLLProvider.FindByProperty(BookingCurrentPage, ROWS, searchByDate, bookingSearch, bookOrderBy, bookStatus)); }