public JsonResult GetAllPatient(string date) { List <AppointmentView> pt = new List <AppointmentView>(); int doc = Convert.ToInt32(Session["DoctorId"]); using (var ctx = new MedicalContext()) { var data = from a in ctx.Appointment join p in ctx.Registers on a.PatientId equals p.Id where a.DoctorId == doc && a.Date == date select new { pappointmentId = a.Id, patientName = p.Name, patientAge = p.Age, }; foreach (var dc in data) { AppointmentView p = new AppointmentView(); p.AppointmentId = dc.pappointmentId; p.PatientName = privacy.Decrypt(dc.patientName); p.Age = dc.patientAge; pt.Add(p); } } return(Json(pt)); }
private void BtnSaveAppointment_Click(object sender, RoutedEventArgs e) { try { int appoId = int.Parse(lblHiddenId.Content.ToString()); string selectedTime = cmbbAppointmentTime.SelectedValue.ToString(); string selectedHour = selectedTime.Substring(0, 2); if (dpAppointmentDate.SelectedDate != null) { DateTime dateTime = new DateTime(dpAppointmentDate.SelectedDate.Value.Year, dpAppointmentDate.SelectedDate.Value.Month, dpAppointmentDate.SelectedDate.Value.Day, int.Parse(selectedHour), 00, 00); AppointmentTypeView typeView = _controller.GetAppointmentTypeByName(cmbbAppointmentType.SelectedValue.ToString(), cmbbPractitioner.SelectedValue.ToString()); RoomView roomview = _controller.GetRoomByAppointmentId(appoId, cmbbDepartment.SelectedValue.ToString()); AppointmentView tempAppoView = _controller.GetAppointmentById(appoId); TimeSpan time = TimeSpan.Parse(cmbbNotificationTime.SelectedValue.ToString()); AppointmentView appoView = new AppointmentView(appoId, dateTime, tempAppoView.Users, typeView, roomview, txtNotes.Text, tempAppoView.Price, time, (bool)cbEmail.IsChecked, (bool)cbSMS.IsChecked); _controller.EditAppointment(appoView); } } catch (SqlException) { MessageBox.Show("Kunne ikke oprette forbindlse til databasen.\nPrøv at checke din internet forbindelse", "Fejl!!!", MessageBoxButton.OK, MessageBoxImage.Error); } Close(); }
public ActionResult Apointment(string id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } else { try { int doc = Convert.ToInt32(id); var doctor = this._contex.Doctorses.Single(d => d.Id == doc); var appoint = new AppointmentView { Doctorses = doctor, Patient = CurrentUser(), Appointment = new Appointment() }; return(this.View(appoint)); } catch (Exception) { return(new HttpStatusCodeResult(HttpStatusCode.NotFound)); } } }
public async Task <IActionResult> UpdateAppointment(int id, AppointmentView appointmentView) { // if (id != businessView.BusinessId) // { // return BadRequest(); // } var appointment = await _context.Appointments.FindAsync(id); if (appointment == null) { return(NotFound()); } appointment.Price = appointmentView.Price; appointment.Total = appointmentView.Total; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { return(NotFound()); } return(Ok()); }
private void biEliminar_Click(object sender, EventArgs e) { ButtonItem mi = sender as ButtonItem; AppointmentView view = mi.Parent.Tag as AppointmentView; if (view != null) { if (view.Appointment.Id < 0) { for (int i = 0; i < lstDetalleDisponibilidad.Count; i++) { if (lstDetalleDisponibilidad[i]._IdDetalleDisponibilidad == view.Appointment.Id) { lstDetalleDisponibilidad.RemoveAt(i); break; } } cvCalendario.CalendarModel.Appointments.Remove(view.Appointment); } else { if (MessageBox.Show("¿Está seguro(a) de que desea eliminar esta disponibilidad?", "Mensaje", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { strListaEliminados = strListaEliminados + "," + view.Appointment.Id; cvCalendario.CalendarModel.Appointments.Remove(view.Appointment); } } } }
private void calendarView1_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Delete && calendarView1.SelectedAppointments.Count > 0) { AppointmentView view = calendarView1.SelectedAppointments[0]; calendarView1.CalendarModel.Appointments.Remove(view.Appointment); } }
void miDelete_Click(object sender, EventArgs e) { ButtonItem bi = sender as ButtonItem; AppointmentView view = bi.Parent.Tag as AppointmentView; if (view != null) { calendarView1.CalendarModel.Appointments.Remove(view.Appointment); } }
public async Task <IActionResult> Create(AppointmentView appointmentView) { if (ModelState.IsValid) { var schedule = await unitOfWork.Schedules.Find(s => s.id == appointmentView.ScheduleId && s.isEmpty == true); if (!schedule.Any()) { return(BadRequest("Randevu almak istediğiniz tarih dolu ve ScheduleId göndermediniz!")); } var appointment = new Appointment() { Name = appointmentView.Name, Phone = appointmentView.Phone, Email = appointmentView.Email, Message = appointmentView.Message, AppointmentDateStart = schedule.First().start, AppointmentDateEnd = schedule.First().end, CreatedAt = DateTime.Now, IsApproved = 0, ShootTypeId = appointmentView.ShootTypeId, ScheduleId = appointmentView.ScheduleId }; if (!await UpdateScheduleIsEmptyField(appointmentView.ScheduleId, false)) { return(NotFound("Schedule Bulunamadı")); } await unitOfWork.Appointments.Add(appointment); await unitOfWork.Complete(); var url = Url.Action("Index", "Home", new { }, protocol: HttpContext.Request.Scheme); var resultMail = await emailSender .SendNotifyEmail(url, TemplateNames.AppointmentRequest, "Randevunuz Talebiniz Oluşturuldu", new MailReceiverInfo() { FullName = appointment.Name, Email = appointment.Email, Date = appointment.AppointmentDateStart }); return(Ok("Randevu talebiniz başarıyla eklendi. Talebiniz onaylandığında mail ile bilgilendirileceksiniz.")); } else { return(BadRequest("hata")); } }
private void AppointmentViewMouseUp(object sender) { AppointmentView view = sender as AppointmentView; // Select the appointment view.IsSelected = true; // Let the user delete the appointment //ShowContextMenu(AppointmentContextMenu); }
private void AppointmentViewMouseUp(object sender) { AppointmentView view = sender as AppointmentView; // Select the appointment view.IsSelected = true; // Let the user delete the appointment AppDeleteContextItem.Enabled = (view.Appointment.IsRecurringInstance == false); AppointmentContextMenu.Tag = view; ShowContextMenu(AppointmentContextMenu); }
public void UpdateEditWpf(AppointmentView appoView) { List <UserView> clients = _controller.GetClientsFromAppointmentView(appoView); List <UserView> practitioners = _controller.GetPractitionerFromAppointmentView(appoView); if (clients.Count >= 2) { cmbbClient.Items.Add(clients[0].Name + " & " + clients[1].Name); cmbbClient.SelectedIndex = cmbbClient.Items.IndexOf(clients[0].Name + " & " + clients[1].Name); cmbbClient.IsEnabled = false; } else if (clients.Count == 1) { cmbbClient.Items.Add(clients[0].Name); cmbbClient.SelectedIndex = cmbbClient.Items.IndexOf(clients[0].Name); cmbbClient.IsEnabled = false; } foreach (UserView prac in practitioners) { cmbbPractitioner.Items.Add(prac.Name); cmbbPractitioner.SelectedIndex = cmbbPractitioner.Items.IndexOf(prac.Name); } cmbbPractitioner.IsEnabled = false; DepartmentView departmentView = _controller.GetDepartmentViewFromRoomId(appoView.RoomView.Id); cmbbDepartment.SelectedIndex = cmbbDepartment.Items.IndexOf(departmentView.Name); cmbbDepartment.IsEnabled = false; dpAppointmentDate.SelectedDate = appoView.DateAndTime.Date; cmbbAppointmentTime.SelectedIndex = cmbbAppointmentTime.Items.IndexOf(appoView.DateAndTime.ToString("H:mm")); cmbbNotificationTime.SelectedIndex = cmbbNotificationTime.Items.IndexOf(appoView.NotificationTime.Days.ToString()); txtNotes.Text = appoView.Note; cmbbAppointmentType.IsEnabled = false; lblHiddenId.Content = appoView.Id; if (appoView.EmailNotification == true) { cbEmail.IsChecked = true; } else if (appoView.EmailNotification == false) { cbEmail.IsChecked = false; } if (appoView.SMSNotification == true) { cbSMS.IsChecked = true; } else if (appoView.SMSNotification == false) { cbSMS.IsChecked = false; } }
public async Task <ActionResult <AppointmentView> > CreateAppointment(AppointmentView appointmentView) { var appointment = new Appointment { AppointmentId = appointmentView.AppointmentId, Price = appointmentView.Price, Total = appointmentView.Total, }; _context.Appointments.Add(appointment); await _context.SaveChangesAsync(); return(Ok(appointment)); }
private void AppointmentViewMouseUp(object sender) { AppointmentView view = sender as AppointmentView; view.IsSelected = true; biEliminar.Enabled = (view.Appointment.IsRecurringInstance == false); if (view.Appointment.StartTime >= DateTime.Now.Date) { biRegistro.Tag = view; ShowContextMenu(biRegistro); } }
public ActionResult MakeAnAppointment(AppointmentView appoitment) { var idTime = Convert.ToInt32(Request.Form["time"]); var idDate = Convert.ToInt32(Request.Form["date"]); var email = HttpContext.User.Identity.Name; Models.UserContext db = new Models.UserContext(); db.Appoitments.Add(new Models.Appoitment { EmailUser = email, DateId = idDate, TimeId = idTime, IdDoctorSpecialty = appoitment.IdDoctorSpecialty }); db.SaveChanges(); db.Receptions.FirstOrDefault(x => x.Id == idTime).IsUse = true; db.SaveChanges(); return(RedirectToAction("Index", "User")); }
private void calendarView1_ItemDoubleClick(object sender, MouseEventArgs e) { using (var dialog = new ManageTrips()) { AppointmentView item = sender as AppointmentView; if (item != null) { Appointment ap = item.Appointment; dialog.trip_id = ap.Subject; dialog.ShowDialog(); } } }
public EditAppointment(int appointmentId) { InitializeComponent(); _controller = Controller.GetInstance(); UpdateDepartmentComboBox(); AppointmentView appoView = GetAppointmentById(appointmentId); UpdateNotificationTimeComboBox(); UpdateEditWpf(appoView); if (cmbbAppointmentTime.SelectedValue == null) { btnSaveAppointment.IsEnabled = false; } cbSMS.IsEnabled = false; }
private void AppManageContextItem_Click(object sender, EventArgs e) { ButtonItem mi = sender as ButtonItem; if (mi != null) { AppointmentView view = mi.Parent.Tag as AppointmentView; using (var dialog = new ManageTrips()) { Appointment ap = view.Appointment; dialog.trip_id = ap.Subject; dialog.ShowDialog(); } } }
private void calendarView1_ItemDoubleClick(object sender, MouseEventArgs e) { AppointmentView item = sender as AppointmentView; if (item != null) { Appointment ap = item.Appointment; string s = string.Format( "会议室: {0}\n会议室主题: {1}\n参与人员: {2}\n\n" + "开始时间: {3}\n结束时间: {4}", ap.Subject, ap.Tooltip, ap.Description, ap.StartTime, ap.EndTime); MessageBox.Show(s); } }
// Perform actions for both move and resize events void calendarView1_AppointmentViewChanged(object sender, AppointmentViewChangedEventArgs e) { AppointmentView current = e.CalendarItem as AppointmentView; // check whether this appointment overlaps another one foreach (var app in calendarView1.CalendarModel.Appointments) { if (!app.IsSelected && app.OwnerKey == current.Appointment.OwnerKey) { if (arePeriodsOverlapping(app.StartTime, app.EndTime, current.StartTime, current.EndTime)) { current.StartTime = e.OldStartTime; current.EndTime = e.OldEndTime; } } } updateAppointmentTooltip(current.ModelItem as Appointment); }
public ActionResult Appointment() { var doctor = this.GetCurrentDoctor(); if (doctor != null) { var appointment = this._contex.Appointments.Include("Patient").OrderByDescending(a => a.Id) .Where(a => a.DoctorsId == doctor.Id).Take(10); var appointmentView = new AppointmentView { Appointments = appointment }; return(this.PartialView(appointmentView)); } else { return(RedirectToAction("Login", "Doctor")); } }
private void DrawAppointments(PaintEventArgs e, Rectangle rect, DateTime time) { DateTime timeStart = time.Date; DateTime timeEnd = timeStart.AddHours(24); timeEnd = timeEnd.AddSeconds(-1); AppointmentList appointments = (AppointmentList)cachedAppointments[time.Day]; if (appointments != null) { HalfHourLayout[] layout = GetMaxParalelAppointments(appointments); List <Appointment> drawnItems = new List <Appointment>(); for (int halfHour = 0; halfHour < 24 * 4; halfHour++)//2 { HalfHourLayout hourLayout = layout[halfHour]; if ((hourLayout != null) && (hourLayout.Count > 0)) { for (int appIndex = 0; appIndex < hourLayout.Count; appIndex++) { Appointment appointment = hourLayout.Appointments[appIndex]; if (drawnItems.IndexOf(appointment) < 0) { Rectangle appRect = rect; int appointmentWidth; AppointmentView view; appointmentWidth = rect.Width / appointment.m_ConflictCount; int lastX = 0; foreach (Appointment app in hourLayout.Appointments) { if ((app != null) && (appointmentViews.ContainsKey(app))) { view = appointmentViews[app]; if (lastX < view.Rectangle.X) { lastX = view.Rectangle.X; } } } if ((lastX + (appointmentWidth * 2)) > (rect.X + rect.Width)) { lastX = 0; } appRect.Width = appointmentWidth; if (lastX > 0) { appRect.X = lastX + appointmentWidth; } appRect = GetHourRangeRectangle(appointment.StartDate, appointment.EndDate, appRect); view = new AppointmentView(); view.Rectangle = appRect; view.Appointment = appointment; appointmentViews[appointment] = view; e.Graphics.SetClip(rect); renderer.DrawAppointment(e.Graphics, appRect, appointment, appointment == selectedAppointment, appointmentGripWidth); e.Graphics.ResetClip(); drawnItems.Add(appointment); } } } } } }
public async Task GetHistoryData() { var username = Application.Current.Properties["USER_NAME"] as string; if (username != null && username != "") { List <AppointmentView> listAppr = new List <AppointmentView>(); RootAppointmentObject appointmentData = await apiRequestHelper.RequestAllAppointmentAsync(username); if (appointmentData != null) { List <AppointmentJson> Data = appointmentData.Data; if (Data != null) { foreach (var data in Data) { if (data.IsApprove == "Y" || data.IsCancel == "Y" || data.IsTreat == "Y") { } else { AppointmentView view = new AppointmentView(); view.HN = "หมายเลข HN: " + data.HN; view.AppointmentDate = data.AppointmentDate; view.AppointmentTime = data.AppointmentTime; view.Subject = data.Subject; view.CustomerName = data.CustomerName; view.Status = data.Status; if (data.IsApprove == "" && data.IsCancel == "" && data.IsPostpone == "" && data.IsTreat == "") { view.ImgAcceptReject = "waiting"; } else if (data.IsApprove == "Y") { view.ImgAcceptReject = "accept"; } else if (data.IsPostpone == "Y") { view.CustomerName = "เลื่อนเป็นวันที่ " + data.PostponeDate + " " + data.PostponeTime; view.Subject = data.PostponeReason; view.ImgAcceptReject = "waiting"; } else if (data.IsCancel == "Y") { view.CustomerName = "ยกเลิกนัด"; view.Subject = data.CancelReason; view.ImgAcceptReject = "waiting"; } listAppr.Add(view); } } } } listApprove.ItemsSource = listAppr; } Device.StartTimer(TimeSpan.FromSeconds(1), () => { popupLoadingView.IsVisible = false; activityIndicator.IsRunning = false; return(true); }); }
public async Task GetHistoryData() { var username = Application.Current.Properties["USER_NAME"] as string; if (username != null && username != "") { List <AppointmentView> listAppr = new List <AppointmentView>(); List <AppointmentView> listHist = new List <AppointmentView>(); RootAppointmentObject appointmentData = await apiRequestHelper.RequestAllAppointmentAsync(username); if (appointmentData != null) { List <AppointmentJson> Data = appointmentData.Data; if (Data != null) { foreach (var data in Data) { if (data.IsApprove == "Y" && (data.IsCancel == "Y" || data.IsTreat == "Y")) { AppointmentView view = new AppointmentView(); view.HN = "หมายเลข HN: " + data.HN; view.AppointmentDate = data.AppointmentDate; view.AppointmentTime = data.AppointmentTime; view.Subject = data.Subject; view.CustomerName = data.CustomerName; view.Reason = "หมายเหตุ : " + data.TreatDetail; view.Status = data.Status; view.ImgAcceptReject = "accept"; listHist.Add(view); } else { AppointmentView view = new AppointmentView(); view.HN = "หมายเลข HN: " + data.HN; view.AppointmentDate = data.AppointmentDate; view.AppointmentTime = data.AppointmentTime; view.Subject = data.Subject; view.CustomerName = data.CustomerName; view.Status = data.Status; view.ImgAcceptReject = "waiting"; if (data.IsApprove == "Y") { view.ImgAcceptReject = "accept"; } else if (data.IsPostpone == "Y") { view.CustomerName = "เลื่อนเป็นวันที่ " + data.PostponeDate + " " + data.PostponeTime; view.Subject = data.PostponeReason; view.ImgAcceptReject = "waiting"; } else if (data.IsCancel == "Y") { view.CustomerName = "ยกเลิกนัด"; view.Subject = data.CancelReason; view.ImgAcceptReject = "waiting"; } listAppr.Add(view); } } } } /* * view = new AppointmentView(); * view.HN = "หมายเลข HN: " + "25630023"; * view.AppointmentDate = DateTime.Now.ToString("dd/MM/yyyy"); * view.AppointmentTime = DateTime.Now.ToString("hh:mm tt"); * view.Subject = "เลื่อน " + view.AppointmentDate + " เวลา " + view.AppointmentTime; * view.CustomerName = "คุณสมชาย ใจดี"; * view.Reason = "หมายเหตุ : ไม่สบาย"; * view.Status = "ดำเนินการแล้ว"; * * list.Add(view); * * view = new AppointmentView(); * view.HN = "หมายเลข HN: " + "25630023"; * view.AppointmentDate = DateTime.Now.ToString("dd/MM/yyyy"); * view.AppointmentTime = DateTime.Now.ToString("hh:mm tt"); * view.Subject = "เลื่อน " + view.AppointmentDate + " เวลา " + view.AppointmentTime; * view.CustomerName = "คุณสมชาย ใจดี"; * view.Reason = "หมายเหตุ : ไม่สบาย"; * view.Status = "ดำเนินการแล้ว"; * * list.Add(view); * * view = new AppointmentView(); * view.HN = "หมายเลข HN: " + "25630023"; * view.AppointmentDate = DateTime.Now.ToString("dd/MM/yyyy"); * view.AppointmentTime = DateTime.Now.ToString("hh:mm tt"); * view.Subject = "เลื่อน " + view.AppointmentDate + " เวลา " + view.AppointmentTime; * view.CustomerName = "คุณสมชาย ใจดี"; * view.Reason = "หมายเหตุ : ไม่สบาย"; * view.Status = "ดำเนินการแล้ว"; * * list.Add(view); * * view = new AppointmentView(); * view.HN = "หมายเลข HN: " + "25630023"; * view.AppointmentDate = DateTime.Now.ToString("dd/MM/yyyy"); * view.AppointmentTime = DateTime.Now.ToString("hh:mm tt"); * view.Subject = "เลื่อน " + view.AppointmentDate + " เวลา " + view.AppointmentTime; * view.CustomerName = "คุณสมชาย ใจดี"; * view.Reason = "หมายเหตุ : ไม่สบาย"; * view.Status = "ดำเนินการแล้ว"; * * list.Add(view); * * view = new AppointmentView(); * view.HN = "หมายเลข HN: " + "25630023"; * view.AppointmentDate = DateTime.Now.ToString("dd/MM/yyyy"); * view.AppointmentTime = DateTime.Now.ToString("hh:mm tt"); * view.Subject = "เลื่อน " + view.AppointmentDate + " เวลา " + view.AppointmentTime; * view.CustomerName = "คุณสมชาย ใจดี"; * view.Reason = "หมายเหตุ : ไม่สบาย"; * view.Status = "ดำเนินการแล้ว"; * * list.Add(view); * * view = new AppointmentView(); * view.HN = "หมายเลข HN: " + "25630023"; * view.AppointmentDate = DateTime.Now.ToString("dd/MM/yyyy"); * view.AppointmentTime = DateTime.Now.ToString("hh:mm tt"); * view.Subject = "เลื่อน " + view.AppointmentDate + " เวลา " + view.AppointmentTime; * view.CustomerName = "คุณสมชาย ใจดี"; * view.Reason = "หมายเหตุ : ไม่สบาย"; * view.Status = "ดำเนินการแล้ว"; * * list.Add(view); */ listHistory.ItemsSource = listHist; listApprove.ItemsSource = listAppr; } Device.StartTimer(TimeSpan.FromSeconds(1), () => { popupLoadingView.IsVisible = false; activityIndicator.IsRunning = false; return(true); }); }
public dynamic UpdateExceldata([FromBody] AppointmentView UpdateExceldatas) { return(_repoWrapper.Exceluploadreposs.UpdateExceldata(UpdateExceldatas)); }
public async Task <IActionResult> Update(UpdateAppointmentCommand command) { AppointmentView appointment = await mediator.Dispatch <UpdateAppointmentCommand, AppointmentView>(command, User.GetUserId()); return(Ok(appointment)); }
public async Task <ActionResult <Appointment> > AddAppointmentRequest([FromForm] AppointmentView appointmentView) { if (ModelState.IsValid) { var schedule = await unitOfWork.Schedules.Find(s => s.id == appointmentView.ScheduleId && s.isEmpty == true); if (!schedule.Any()) { return(BadRequest("Randevu almak istediğiniz tarih dolu ve ScheduleId göndermediniz!")); } var appointment = new Appointment() { Name = appointmentView.Name, Phone = appointmentView.Phone, Email = appointmentView.Email, Message = appointmentView.Message, AppointmentDateStart = schedule.First().start, AppointmentDateEnd = schedule.First().end, CreatedAt = DateTime.Now, IsApproved = 0, ShootTypeId = appointmentView.ShootTypeId, ScheduleId = appointmentView.ScheduleId }; try { if (!await UpdateScheduleIsEmptyField(appointmentView.ScheduleId, false)) { return(NotFound("Schedule Bulunamadı")); } await unitOfWork.Appointments.Add(appointment); await unitOfWork.Complete(); var url = Url.Action("Index", "Home", new { }, protocol: HttpContext.Request.Scheme); var resultMail = await emailSender .SendNotifyEmail(url, TemplateNames.AppointmentRequest, "Randevunuz Talebiniz İletildi", new MailReceiverInfo() { FullName = appointment.Name, Email = appointment.Email, Date = appointment.AppointmentDateStart }); return(CreatedAtAction("GetAppointment", new { id = appointment.Id }, appointment)); } catch (Exception) { return(StatusCode(StatusCodes.Status500InternalServerError, "Hata tekrar deneyiniz.")); } } else { return(UnprocessableEntity("Data uygun formatta değil.")); } }
public static Appointment ToAppointment(this AppointmentView model) { return(Mapper.Map <Appointment>(model)); }
private void DrawAppointments(PaintEventArgs e, Rectangle rect, int groupId) { DateTime timeStart = this.startTime; DateTime timeEnd = this.startTime.AddHours(this.totalHour).AddSeconds(-1); AppointmentGroup appointmentgroup = cachedAppointmentGroups[groupId]; int realAppHeight = this.AppointmentHeight; if (true) { int maxconfs = 0; List<Appointment> checkedItems = new List<Appointment>(); foreach (Appointment appItem in appointmentgroup) { var confs = checkedItems.Where(a => (this.IsTimeCrossing(appItem.StartTime, appItem.EndTime, a.StartTime, a.EndTime))); if (confs.Count() > maxconfs) { maxconfs = confs.Count(); } checkedItems.Add(appItem); } if ((maxconfs + 1) > this.AppointmentParallel) { realAppHeight = (this.rowHeight / (maxconfs + 1)) - this.appointmentGripHeight; } } if (appointmentgroup != null) { List<Appointment> drawnItems = new List<Appointment>(); foreach (Appointment appItem in appointmentgroup) { var confs= drawnItems.Where(a => (this.IsTimeCrossing(appItem.StartTime, appItem.EndTime, a.StartTime, a.EndTime))); int lastBottom = rect.Top; if (confs.Count() > 0) { int minTop = confs.Min(a => appointmentViews[a].Rectangle.Top); if (minTop != (rect.Top + appointmentGripHeight)) { lastBottom = rect.Top; } else { //lastBottom = confs.Max(a => appointmentViews[a].Rectangle.Bottom); Rectangle tempRect; var orderedconfs = confs.OrderBy(conf => appointmentViews[conf].Rectangle.Bottom).ToList(); foreach (var conf in orderedconfs) { lastBottom = appointmentViews[conf].Rectangle.Bottom; tempRect = GetHourRangeRectangle(appItem.StartTime, appItem.EndTime, rect, lastBottom, realAppHeight); int x1 = tempRect.Left; int x2 = tempRect.Right;//GetAppointmentAt int y = appointmentViews[conf].Rectangle.Bottom + realAppHeight / 2; if (GetAppointmentAt(x1, y) == null && GetAppointmentAt(x2, y) == null && GetAppointmentAt(tempRect) == null) { break; } } } } Rectangle appRect = rect; appRect = GetHourRangeRectangle(appItem.StartTime, appItem.EndTime, appRect, lastBottom,realAppHeight); var view = new AppointmentView(); view.Rectangle = appRect; view.Appointment = appItem; appointmentViews[appItem] = view; //Roger //e.Graphics.SetClip(rect); double tempHeight = appRect.Height * 0.8; appRect.Height = (int)tempHeight; renderer.DrawAppointment(e.Graphics, appRect, appItem, appItem == SelectedAppointment, appointmentGripHeight,this.ShowPercent); //e.Graphics.ResetClip(); drawnItems.Add(appItem); } } }
public AppointmentView GetAppointmentById(int appoId) { AppointmentView view = _controller.GetAppointmentById(appoId); return(view); }
private void DrawAppointments(PaintEventArgs e, Rectangle rect, int groupId) { DateTime timeStart = this.startTime; DateTime timeEnd = this.startTime.AddHours(this.totalHour).AddSeconds(-1); AppointmentGroup appointmentgroup = cachedAppointmentGroups[groupId]; int realAppHeight = this.AppointmentHeight; if (true) { int maxconfs = 0; List <Appointment> checkedItems = new List <Appointment>(); foreach (Appointment appItem in appointmentgroup) { var confs = checkedItems.Where(a => (this.IsTimeCrossing(appItem.StartTime, appItem.EndTime, a.StartTime, a.EndTime))); if (confs.Count() > maxconfs) { maxconfs = confs.Count(); } checkedItems.Add(appItem); } if ((maxconfs + 1) > this.AppointmentParallel) { realAppHeight = (this.rowHeight / (maxconfs + 1)) - this.appointmentGripHeight; } } if (appointmentgroup != null) { List <Appointment> drawnItems = new List <Appointment>(); foreach (Appointment appItem in appointmentgroup) { var confs = drawnItems.Where(a => (this.IsTimeCrossing(appItem.StartTime, appItem.EndTime, a.StartTime, a.EndTime))); int lastBottom = rect.Top; if (confs.Count() > 0) { int minTop = confs.Min(a => appointmentViews[a].Rectangle.Top); if (minTop != (rect.Top + appointmentGripHeight)) { lastBottom = rect.Top; } else { //lastBottom = confs.Max(a => appointmentViews[a].Rectangle.Bottom); Rectangle tempRect; var orderedconfs = confs.OrderBy(conf => appointmentViews[conf].Rectangle.Bottom).ToList(); foreach (var conf in orderedconfs) { lastBottom = appointmentViews[conf].Rectangle.Bottom; tempRect = GetHourRangeRectangle(appItem.StartTime, appItem.EndTime, rect, lastBottom, realAppHeight); int x1 = tempRect.Left; int x2 = tempRect.Right;//GetAppointmentAt int y = appointmentViews[conf].Rectangle.Bottom + realAppHeight / 2; if (GetAppointmentAt(x1, y) == null && GetAppointmentAt(x2, y) == null && GetAppointmentAt(tempRect) == null) { break; } } } } Rectangle appRect = rect; appRect = GetHourRangeRectangle(appItem.StartTime, appItem.EndTime, appRect, lastBottom, realAppHeight); var view = new AppointmentView(); view.Rectangle = appRect; view.Appointment = appItem; appointmentViews[appItem] = view; //Roger //e.Graphics.SetClip(rect); double tempHeight = appRect.Height * 0.8; appRect.Height = (int)tempHeight; renderer.DrawAppointment(e.Graphics, appRect, appItem, appItem == SelectedAppointment, appointmentGripHeight, this.ShowPercent); //e.Graphics.ResetClip(); drawnItems.Add(appItem); } } }