/// <summary> /// Handles the OnAppointmentUpdate event of the rScheduler control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Telerik.Web.UI.AppointmentUpdateEventArgs"/> instance containing the event data.</param> protected void rScheduler_OnAppointmentUpdate(object sender, AppointmentUpdateEventArgs e) { var actualTime = ((List <TaskDurationMap>)ViewState["TaskDurations"]).Sum(tdp => tdp.ActualDurationHours * 60 + tdp.ActualDurationMinutes); actualTime = actualTime + (e.ModifiedAppointment.End - e.ModifiedAppointment.Start).Hours + (e.ModifiedAppointment.End - e.ModifiedAppointment.Start).Minutes; if (actualTime <= (Task.PlanDurationHours * 60 + Task.PlanDurationMinutes)) { var taskDuration = ((List <TaskDurationMap>)ViewState["TaskDurations"]).Where(tdm => tdm.ID == (Guid)e.ModifiedAppointment.ID).SingleOrDefault(); if (taskDuration != null) { taskDuration.Comment = e.ModifiedAppointment.Subject; taskDuration.SectionDateStart = e.ModifiedAppointment.Start; taskDuration.SectionDateEnd = e.ModifiedAppointment.End; taskDuration.ActualDurationHours = (e.ModifiedAppointment.End - e.ModifiedAppointment.Start).Hours; taskDuration.ActualDurationMinutes = (e.ModifiedAppointment.End - e.ModifiedAppointment.Start).Minutes; } } else { if (!Page.ClientScript.IsStartupScriptRegistered("UpdateAlert")) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "UpdateAlert", "alert('Указан не правильный промежуток');", true); } } BindData(); }
/// <summary> /// Handles the OnAppointmentUpdate event of the rScheduler control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Telerik.Web.UI.AppointmentUpdateEventArgs"/> instance containing the event data.</param> protected void rScheduler_OnAppointmentUpdate(object sender, AppointmentUpdateEventArgs e) { if (e.ModifiedAppointment.Start >= Task.StartDate && e.ModifiedAppointment.End <= Task.EndDate) { var taskDuration = ((List <TaskDurationMap>)ViewState["TaskDurations"]).Where(tdm => tdm.ID == (Guid)e.ModifiedAppointment.ID).SingleOrDefault(); if (taskDuration != null) { taskDuration.Comment = e.ModifiedAppointment.Subject; taskDuration.SectionDateStart = e.ModifiedAppointment.Start; taskDuration.SectionDateEnd = e.ModifiedAppointment.End; taskDuration.ActualDurationHours = (e.ModifiedAppointment.End - e.ModifiedAppointment.Start).Hours; taskDuration.ActualDurationMinutes = (e.ModifiedAppointment.End - e.ModifiedAppointment.Start).Minutes; if (!string.IsNullOrEmpty(e.ModifiedAppointment.Attributes["ResponsibleID"])) { taskDuration.ResponsibleID = Guid.Parse(e.ModifiedAppointment.Attributes["ResponsibleID"]); } } } else { if (!Page.ClientScript.IsStartupScriptRegistered("UpdateAlert")) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "UpdateAlert", "alert('Указан не правильный промежуток');", true); } } BindData(); }
protected void radAppointment_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e) { var taskManager = new TaskManager(this); Task task = taskManager.GetTask((int)e.Appointment.ID); task.StartDate = e.ModifiedAppointment.Start; task.FinishDate = e.ModifiedAppointment.End; taskManager.SaveTask(task, task, null); }
/// <summary> /// Handles the OnAppointmentUpdate event of the rScheduler control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Telerik.Web.UI.AppointmentUpdateEventArgs"/> instance containing the event data.</param> protected void rScheduler_OnAppointmentUpdate(object sender, AppointmentUpdateEventArgs e) { var task = DataManager.Task.SelectById(SiteId, (Guid)e.ModifiedAppointment.ID); if (task != null) { task.StartDate = e.ModifiedAppointment.Start; task.EndDate = e.ModifiedAppointment.End; task.PlanDurationHours = (e.ModifiedAppointment.End - e.ModifiedAppointment.Start).Hours; task.PlanDurationMinutes = (e.ModifiedAppointment.End - e.ModifiedAppointment.Start).Minutes; DataManager.Task.Update(task); gridTasks.Rebind(); } else { var taskDuration = DataManager.TaskDuration.SelectById((Guid)e.ModifiedAppointment.ID); if (taskDuration != null) { taskDuration.SectionDateStart = e.ModifiedAppointment.Start; taskDuration.SectionDateEnd = e.ModifiedAppointment.End; taskDuration.ActualDurationHours = (e.ModifiedAppointment.End - e.ModifiedAppointment.Start).Hours; taskDuration.ActualDurationMinutes = (e.ModifiedAppointment.End - e.ModifiedAppointment.Start).Minutes; DataManager.TaskDuration.Update(taskDuration); var taskDurations = DataManager.TaskDuration.SelectAll(taskDuration.TaskID); task = DataManager.Task.SelectById(SiteId, taskDuration.TaskID); if (task != null) { task.ActualDurationHours = taskDurations.Sum(td => td.ActualDurationHours); task.ActualDurationMinutes = taskDurations.Sum(td => td.ActualDurationMinutes); var completePecent = 0; var taskDurationActual = taskDurations.Sum(td => td.ActualDurationHours * 60 + td.ActualDurationMinutes); var taskDurationPlanned = task.PlanDurationHours * 60 + task.PlanDurationMinutes; if (taskDurationActual >= taskDurationPlanned) { completePecent = 100; } else { completePecent = (int)(((taskDurationActual * 100) / taskDurationPlanned)); } task.CompletePercentage = completePecent; DataManager.Task.Update(task); } } } }
protected void radcalendar_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e) { Int32 _hdrid = 0; Int32 _dtlid = 0; string _swapaction = this.hdnapptaction.Value; swapaction _sa = (swapaction)System.Enum.Parse(typeof(swapaction), _swapaction); string _slotappt = this.hdnexistingappt.Value; switch (_sa) { case swapaction.replace: /*Int32 dragtalk = Convert.ToInt32(_dragappt.Attributes["TalkID"].ToString()); * Int32 slottalk = Convert.ToInt32(_slotappt.Attributes["TalkID"].ToString()); * _dragappt.Attributes["TalkID"] = dragtalk.ToString(); * _slotappt.Attributes["TalkID"] = slottalk.ToString();*/ break; case swapaction.swap: break; } _hdrid = String.IsNullOrEmpty(e.Appointment.Attributes["HeaderID"].ToString()) ? 0: Int32.Equals(Convert.ToInt32(e.Appointment.Attributes["HeaderID"].ToString()), 0) ? 0 : Convert.ToInt32(e.Appointment.Attributes["HeaderID"].ToString()); if (_hdrid > 0) { _dtlid = String.IsNullOrEmpty(e.Appointment.Attributes["DetailID"].ToString()) ? 0 : Int32.Equals(Convert.ToInt32(e.Appointment.Attributes["DetailID"].ToString()), 0) ? 0 : Convert.ToInt32(e.Appointment.Attributes["DetailID"].ToString()); } else { throw new MissingMemberException(@"Header record is missing for this Detail item"); } /*switch (e.ModifiedAppointment.Attributes["EventTypeID"].ToString()) * { * case "999": * ach.UpdateActivity(ref _eid, e.ModifiedAppointment.Subject, Convert.ToInt32(e.ModifiedAppointment.Attributes["VenueID"].ToString()), e.ModifiedAppointment.Description, e.ModifiedAppointment.Start, e.ModifiedAppointment.End, Convert.ToInt32(e.ModifiedAppointment.Attributes["EventTypeID"].ToString()), "UPDATE", e.ModifiedAppointment.RecurrenceRule); * break; * case "7": * case "8": * Application_Database_Helper.InsertEventRecurrence(_eid, null, e.ModifiedAppointment.RecurrenceRule); * break; * }*/ telerik_scheduler_sandbox.dL.Schedule.AppointmentInfo ai = FindById(e.ModifiedAppointment.ID.ToString()); ai.CopyInfo(e.ModifiedAppointment); this.radcalendar.Rebind(); }
protected void RadScheduler1_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e) { using (var context = new UzoneEntities()) { Scheduler _scheduler; _scheduler = context.Schedulers.Find(e.Appointment.ID); if (_scheduler != null) { _scheduler.EventStart = e.ModifiedAppointment.Start; _scheduler.EventEnd = e.ModifiedAppointment.End; _scheduler.EventDescription = e.ModifiedAppointment.Description; _scheduler.EventSubject = e.ModifiedAppointment.Subject; _scheduler.SchoolID = (long)Session["currentSchoolID"]; if (e.Appointment.Resources.FirstOrDefault() != null) _scheduler.EventLocationID = (int)e.Appointment.Resources.First().Key; context.SaveChanges(); LoadScheduler(); } } }
protected void EventScheduler_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e) { if (Session["User"] != null) { var aptStartTime = e.Appointment.Start.TimeOfDay; var aptEndTime = e.Appointment.End.TimeOfDay; var resource = e.Appointment.Resources.GetResourceByType("Room"); // Do not allow for blocked timeslot to anyone Utility.GetHours(resource.Text, out _resStartTime, out _resEndTime); if (Utility.IsBlockedTimeSlot(aptStartTime, aptEndTime, _resStartTime, _resEndTime)) { e.Cancel = true; ShowErrorMessage("Updating events in blocked timeslot is not allowed."); } // If it is not user's created event if (Utility.LoggedUserRole == "User" && !e.Appointment.Attributes["BookedBy"].Equals(Utility.LoggedUserEmp)) { e.Cancel = true; ShowErrorMessage("You cannot modify other user's created events."); } // If appointment overlaps if (Utility.AppointmentsOverlap(e.ModifiedAppointment, EventScheduler)) { e.Cancel = true; ShowErrorMessage("Updating events in occupied timeslot is not allowed."); } } else { e.Cancel = true; ShowErrorMessage("Only logged in user can modify events."); } }
protected void RadScheduler1_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e) { RadCalendar1.SpecialDays.Clear(); RadCalendar2.SpecialDays.Clear(); }
/// <summary> /// Handles the AppointmentUpdate event of the RadScheduler1 control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Telerik.Web.UI.AppointmentUpdateEventArgs"/> instance containing the event data.</param> protected void RadScheduler1_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e) { var ai = FindById(e.ModifiedAppointment.ID); ai.CopyInfo(e.ModifiedAppointment); }
protected void tkrsNonWorkingDays_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e) { Page.Validate(); if (Page.IsValid) { int nonWorkingDayId = Convert.ToInt32(e.ModifiedAppointment.ID); VacationsNonWorkingDaysInformation vacationsNonWorkingDaysInformation = new VacationsNonWorkingDaysInformation(vacationsNonWorkingDaysInformationTDS); vacationsNonWorkingDaysInformation.Update(nonWorkingDayId, e.ModifiedAppointment.Subject); // Store dataset Session["vacationsNonWorkingDaysInformationTDS"] = vacationsNonWorkingDaysInformationTDS; Session["nonWorkingDaysInformation"] = vacationsNonWorkingDaysInformationTDS.NonWorkingDaysInformation; tkrsNonWorkingDays.DataBind(); } else { e.Cancel = true; } }
protected void RadScheduler1_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e) { }
/// <summary> /// Handles the AppointmentUpdate event of the _rsReservations control. /// </summary> /// <param name = "sender">The source of the event.</param> /// <param name = "e">The <see cref = "Telerik.Web.UI.AppointmentUpdateEventArgs" /> instance containing the event data.</param> protected void _rsReservations_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e) { var ai = FindById(e.ModifiedAppointment.ID); ai.CopyInfo(e.ModifiedAppointment); }
/// <summary> /// Handles the AppointmentUpdate event of the RadScheduler1 control. /// </summary> /// <param name = "sender">The source of the event.</param> /// <param name = "e">The <see cref = "Telerik.Web.UI.AppointmentUpdateEventArgs" /> instance containing the event data.</param> protected void _rsReservations_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e) { var ai = FindById(e.ModifiedAppointment.ID); ai.CopyInfo(e.ModifiedAppointment); }
protected void radAppointment_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e) { var taskManager = new TaskManager(this); Task task = taskManager.GetTask((int)e.Appointment.ID); task.StartDate = e.ModifiedAppointment.Start; task.FinishDate = e.ModifiedAppointment.End; taskManager.SaveTask(task, task, null); }
protected void RadScheduler1_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e) { if (e.ModifiedAppointment.Start < DateTime.Parse(Session["StartDateFromAdmin"].ToString()) || e.ModifiedAppointment.Start > DateTime.Parse(Session["EndDateFromAdmin"].ToString())) { Label1.Text = "Date Range Is Wrong, It Must Be Within a Current Cycle"; //RegisterScript(); //MessageBox.Show("Date Range Is Wrong, It Must Be Within a Current Cycle", "Overlapped Appointment", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification); e.Cancel = true; } e.ModifiedAppointment.Attributes["LastModified"] = DateTime.Now.ToString(); con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["AmounCrmConnectionString"].ToString()); affiliation = new SqlParameter(); //entity = new SqlParameter(); //physician = new SqlParameter(); syear = new SqlParameter(); smonth = new SqlParameter(); sday = new SqlParameter(); cmd = new SqlCommand(); cmd.Parameters.Add("affiliation", SqlDbType.Int); //cmd.Parameters.Add("entity", SqlDbType.Int); //cmd.Parameters.Add("physician", SqlDbType.Int); cmd.Parameters.Add("syear", SqlDbType.Int); cmd.Parameters.Add("smonth", SqlDbType.Int); cmd.Parameters.Add("sday", SqlDbType.Int); cmd.Parameters.Add("curPlannedVisitID", SqlDbType.Int); cmd.Parameters.Add("curPlannedRepID", SqlDbType.Int); cmd.Parameters["affiliation"].Value = e.Appointment.Resources.GetResourceByType("Affiliation").Key.ToString(); //cmd.Parameters["entity"].Value = e.Appointment.Resources.GetResourceByType("Entity").Key.ToString(); //cmd.Parameters["physician"].Value = e.Appointment.Resources.GetResourceByType("Physician").Key.ToString(); cmd.Parameters["syear"].Value = e.ModifiedAppointment.Start.Year; cmd.Parameters["smonth"].Value = e.ModifiedAppointment.Start.Month; cmd.Parameters["sday"].Value = e.ModifiedAppointment.Start.Day; cmd.Parameters["curPlannedVisitID"].Value = e.ModifiedAppointment.ID; cmd.Parameters["curPlannedRepID"].Value = int.Parse(ddlReps.SelectedValue); cmd.CommandText = "SELECT COUNT(*) FROM Appointments WHERE ( AffiliationID = " + cmd.Parameters["affiliation"].Value + " AND YEAR([StartDate]) = " + cmd.Parameters["syear"].Value + " AND MONTH([StartDate]) = " + cmd.Parameters["smonth"].Value + " AND Day([StartDate]) = " + cmd.Parameters["sday"].Value + " AND [AppointmentID] <> " + cmd.Parameters["curPlannedVisitID"].Value + " AND [EmployeeID] <> " + cmd.Parameters["curPlannedRepID"].Value + " )"; //cmd.CommandText = "SELECT COUNT(*) FROM Appointments WHERE ( PhysicianID = " + cmd.Parameters["physician"].Value + // " AND EntityID = " + cmd.Parameters["entity"].Value + // " AND YEAR([StartDate]) = " + cmd.Parameters["syear"].Value + // " AND MONTH([StartDate]) = " + cmd.Parameters["smonth"].Value + // " AND Day([StartDate]) = " + cmd.Parameters["sday"].Value + // " AND [AppointmentID] <> " + cmd.Parameters["curPlannedVisitID"].Value + // " )"; //cmd.CommandText = "SELECT COUNT(*) FROM Appointments WHERE ( UserID = " + cmd.Parameters[1].Value + " AND RoomID = " + cmd.Parameters[0].Value + ")"; cmd.Connection = con; con.Open(); plannedPhVisits = 0; dr = cmd.ExecuteReader(); if (dr.HasRows == true) { while (dr.Read()) { plannedPhVisits = int.Parse(dr[0].ToString()); } } if (plannedPhVisits == 0) { /* * appointmentsDS.InsertParameters["RepID"].DefaultValue = Session["EmployeeID"].ToString(); * appointmentsDS.InsertParameters["GroupID"].DefaultValue = Session["LineID"].ToString(); * appointmentsDS.InsertParameters["AreaID"].DefaultValue = One of Amoun Team will visit this physician in this daySession["AreaID"].ToString(); * appointmentsDS.InsertParameters["CycleID"].DefaultValue = Session["CycleID"].ToString(); * */ } else { e.Appointment.Description = "One of Amoun Team will visit this physician in this day"; Label1.Text = "One of Amoun Team will visit this physician in this day"; //RegisterScript(); Label1.Text = "Overlapped Appointment" + "<br />" + "One of Amoun team has a visit to this physician in this day"; e.Cancel = true; } con.Close(); }
protected void RadScheduler1_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e) { e.Cancel = true; }
protected void RadScheduler1_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e) { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "toastr.success('Event Updated', 'Success');", true); }
protected void RadScheduler1_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e) { try { if (e.ModifiedAppointment.Start.DayOfWeek == DayOfWeek.Friday) { Label1.Text = "You can not set an appointment in Friday"; //RegisterScript(); //MessageBox.Show("Date Range Is Wrong, It Must Be Within a Current Cycle", "Overlapped Appointment", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification); RadWindowManager1.RadAlert("You can not set an appointment in Friday", 400, 200, "Error", null, ""); e.Cancel = true; return; } if (e.ModifiedAppointment.End.DayOfWeek == DayOfWeek.Friday) { Label1.Text = "You can not set an appointment in Friday"; //RegisterScript(); //MessageBox.Show("Date Range Is Wrong, It Must Be Within a Current Cycle", "Overlapped Appointment", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification); RadWindowManager1.RadAlert("You can not set an appointment in Friday", 400, 200, "Error", null, ""); e.Cancel = true; return; } if (e.ModifiedAppointment.Attributes["Annotations"] == "Appointment") { if (DateTime.Now.Day > int.Parse(Session["AllowedDaysForPlanning"].ToString())) { //Label1.Text = "You can not change a plan after a seventh day in month"; //e.Cancel = true; } if (e.ModifiedAppointment.Start < DateTime.Parse(Session["StartDate"].ToString()) || e.ModifiedAppointment.Start > DateTime.Parse(Session["EndDate"].ToString())) { Label1.Text = "Date Range Is Wrong, It Must Be Within a Current Cycle"; //RegisterScript(); //MessageBox.Show("Date Range Is Wrong, It Must Be Within a Current Cycle", "Overlapped Appointment", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification); RadWindowManager1.RadAlert("Date Range Is Wrong, It Must Be Within a Current Cycle", 400, 200, "Error", null, ""); e.Cancel = true; return; } if (e.ModifiedAppointment.Start.Day != e.ModifiedAppointment.End.Day) { Label1.Text = "Start Day and End Day Must be The Same"; RadWindowManager1.RadAlert("Start Day and End Day Must be The Same", 400, 200, "Error", null, ""); e.Cancel = true; return; } con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["AmounCrmConnectionString"].ToString()); con.Open(); string querySt2 = @"Select DISTINCT App1.AppointmentID, App1.AffiliationID, App1.StartDate, AffSch.PhysicianClass From Appointments AS App1 Inner Join View_Affiliations_Scheduler AS AffSch ON AffSch.AffiliationID = App1.AffiliationID AND AffSch.EmployeeID = App1.EmployeeID WHERE App1.AffiliationID = " + int.Parse(e.ModifiedAppointment.Resources.GetResourceByType("Affiliation").Key.ToString()) + " AND App1.EmployeeID = " + int.Parse(Session["EmployeeID"].ToString()) + " AND App1.CycleID = " + int.Parse(Session["CycleID"].ToString()) + " AND (App1.DeletedAppointment IS NULL OR App1.DeletedAppointment = 0)" ; DataTable dt1 = new DataTable(); SqlDataAdapter da = new SqlDataAdapter(querySt2, con); da.Fill(dt1); string s = "StartDate = '" + e.ModifiedAppointment.Start.ToShortDateString() + "'"; int countByDate = dt1.Select(s).Count(); if (countByDate > 0) { Label1.Text = "You Cannot Add Two or More Appointments To The Same Doctor In The Same Day"; RadWindowManager1.RadAlert("You Cannot Add Two or More Appointments To The Same Doctor In The Same Day", 400, 200, "Exceeding Visits!", null, ""); e.Cancel = true; return; } string s2 = "AffiliationID = " + int.Parse(e.ModifiedAppointment.Resources.GetResourceByType("Affiliation").Key.ToString()); int countByAff = dt1.Select(s2).Count(); string phClass = dt1.Rows.Count == 0 ? "" : dt1.Rows[0][3].ToString(); if (int.Parse(e.Appointment.Resources.GetResourceByType("Affiliation").Key.ToString()) == int.Parse(e.ModifiedAppointment.Resources.GetResourceByType("Affiliation").Key.ToString())) { if ((countByAff >= 3) && (phClass.Equals("A+"))) { Label1.Text = "You Cannot Add More Appointments To This Doctor"; RadWindowManager1.RadAlert("You Cannot Add More Appointments To This Doctor", 400, 200, "Exceeding Visits!", null, ""); e.Cancel = true; return; } if ((countByAff >= 2) && (phClass.Equals("A"))) { Label1.Text = "You Cannot Add More Appointments To This Doctor"; RadWindowManager1.RadAlert("You Cannot Add More Appointments To This Doctor", 400, 200, "Exceeding Visits!", null, ""); e.Cancel = true; return; } } else { if ((countByAff >= 2) && (phClass == "A+")) { Label1.Text = "You Cannot Add More Appointments To This Doctor"; RadWindowManager1.RadAlert("You Cannot Add More Appointments To This Doctor", 400, 200, "Exceeding Visits!", null, ""); e.Cancel = true; return; } if ((countByAff >= 1) && (phClass == "A"))//A Instead of B { Label1.Text = "You Cannot Add More Appointments To This Doctor"; RadWindowManager1.RadAlert("You Cannot Add More Appointments To This Doctor", 400, 200, "Exceeding Visits!", null, ""); e.Cancel = true; return; } } //SqlCommand queryCom2 = new SqlCommand(querySt2, con); //SqlDataReader queryReader2 = queryCom2.ExecuteReader(); //int i = 0; //while (queryReader2.Read()) //{ // if (e.ModifiedAppointment.Start.ToShortDateString() == (DateTime.Parse(queryReader2[2].ToString())).Date.ToShortDateString() && int.Parse(e.ModifiedAppointment.Resources.GetResourceByType("Affiliation").Key.ToString()) == int.Parse(queryReader2[1].ToString())) // { // Label1.Text = "You Cannot Add Two or More Appointments To The Same Doctor In The Same Day"; // RadWindowManager1.RadAlert("You Cannot Add Two or More Appointments To The Same Doctor In The Same Day", 400, 200, "Exceeding Visits!", null, ""); // e.Cancel = true; // return; // } // if (int.Parse(e.ModifiedAppointment.ID.ToString()) != int.Parse(queryReader2[0].ToString())) // { // i++; // } //} //if ((((i >= 2) && (queryReader2[3].ToString().Equals('A')))) || (((i >= 1) && (queryReader2[3].ToString().Equals('B'))))) //{ // Label1.Text = "You Cannot Add More Appointments To This Doctor"; // RadWindowManager1.RadAlert("You Cannot Add More Appointments To This Doctor", 400, 200, "Exceeding Visits!", null, ""); // e.Cancel = true; // return; //} e.ModifiedAppointment.Attributes["LastModified"] = DateTime.Now.ToString(); RadWindowManager1.RadAlert("Appointment Changed Successfully", 400, 200, "Saved!", null, ""); return; } else { e.Cancel = true; return; } } catch (Exception ex) { Label1.Text = ex.Message; //RegisterScript(); //MessageBox.Show("Date Range Is Wrong, It Must Be Within a Current Cycle", "Overlapped Appointment", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1, MessageBoxOptions.ServiceNotification); e.Cancel = true; } }
public void VaaScheduler_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e) { try { string assignedTo; List <string> users = new List <string>(); foreach (Resource user in e.ModifiedAppointment.Resources.GetResourcesByType("User")) { users.Add(user.Key.ToString()); } if (users.Count > 0) { assignedTo = string.Join(", ", users.ToArray()); } else { assignedTo = users.ToString(); } var appointmentId = Convert.ToInt16(e.Appointment.ID); var appointmentdata = _scheduleManagement.GetScheduleById(appointmentId); if (appointmentdata != null) { Resource color = e.ModifiedAppointment.Resources.GetResourceByType("Colors"); Schedules newSchedules = new Schedules() { ID = appointmentId, Subject = e.ModifiedAppointment.Subject, Start = e.ModifiedAppointment.Start, End = e.ModifiedAppointment.End, UserID = assignedTo, RecurrenceRule = e.ModifiedAppointment.RecurrenceRule, RecurrenceParentID = Convert.ToInt16(e.ModifiedAppointment.RecurrenceParentID), Description = e.ModifiedAppointment.Description, Remainder = Convert.ToString(e.ModifiedAppointment.Reminders), Completed = false, ColorID = Convert.ToInt16(color.Key) }; var newScheduleID = _scheduleManagement.UpdateSchedules(newSchedules); //send email notification if (newScheduleID != 0) { var schedule = _scheduleManagement.GetScheduleById(Convert.ToInt16(newScheduleID)); if (schedule != null) { var userIds = schedule.UserID; if (userIds != null) { var usersArray = userIds.Split(new char[] { ',' }); for (int i = 0; i < usersArray.Length; i++) { var user = _accountManagement.GetUserById(Convert.ToInt32(usersArray[i].Trim())); var email = user.Username; var firstname = user.FirstName; var subject = schedule.Subject; var description = schedule.Description; var startdatetime = Convert.ToString(schedule.Start); var enddatetime = Convert.ToString(schedule.End); EmailHelper.SendUpdateAppointmentNotification(email, firstname, subject, description, startdatetime, enddatetime); } } } } } BindSchedules(); } catch (Exception ex) { //write to Elma ErrorSignal.FromCurrentContext().Raise(ex); } }
protected void tkrsVacations_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e) { Page.Validate(); if (Page.IsValid) { int vacationId = Convert.ToInt32(e.ModifiedAppointment.ID); double takenDay = 0; VacationsAddDaysInformationGateway vacationsAddDaysInformationGateway = new VacationsAddDaysInformationGateway(vacationsAddTDS); string oldPaymentType = vacationsAddDaysInformationGateway.GetPaymentType(vacationId); switch (e.ModifiedAppointment.Subject) { case "Half Vacation Day": if (oldPaymentType == "Full Vacation Day") { takenDay = -0.5; } else { if (oldPaymentType == "Unpaid Leave Full Day") { takenDay = 0.5; } } break; case "Full Vacation Day": if (oldPaymentType == "Half Vacation Day") { takenDay = 0.5; } else { if (oldPaymentType == "Unpaid Leave Full Day") { takenDay = 1; } } break; case "Unpaid Leave Full Day": if (oldPaymentType == "Full Vacation Day") { takenDay = -1; } else { if (oldPaymentType == "Half Vacation Day") { takenDay = -0.5; } } break; case "Unpaid Leave Half Day": if (oldPaymentType == "Full Vacation Day") { takenDay = -1; } else { if (oldPaymentType == "Half Vacation Day") { takenDay = -0.5; } } break; } VacationsAddDaysInformation vacationsAddDaysInformation = new VacationsAddDaysInformation(vacationsAddTDS); vacationsAddDaysInformation.Update(vacationId, e.ModifiedAppointment.Subject); // Store dataset Session["vacationsAddTDS"] = vacationsAddTDS; Session["vacationDaysInformation"] = vacationsAddTDS.DaysInformation; tkrsVacations.DataBind(); double newRemainingVacationDays = double.Parse(tbxRemaining.Text) - takenDay; tbxRemaining.Text = newRemainingVacationDays.ToString(); if (double.Parse(tbxRemaining.Text) < 0) { ScriptManager.RegisterStartupScript(Page, GetType(), "alert", "alert('You are requesting more vacation than the entitlement. If you continue these days will be discounted from next years total .');", true); } } else { e.Cancel = true; } }
/// <summary> /// Handles the AppointmentUpdate event of the RadScheduler1 control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="Telerik.Web.UI.AppointmentUpdateEventArgs"/> instance containing the event data.</param> protected void RadScheduler1_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e) { var ai = FindById(e.ModifiedAppointment.ID); ai.CopyInfo(e.ModifiedAppointment); }
protected void tkrsVacations_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e) { Page.Validate(); if (Page.IsValid) { // Validate if the user can delete older vacations if (!(Convert.ToBoolean(Session["sgLFS_LABOUR_HOURS_VACATIONS_FULL_EDITING"])) && (e.Appointment.Start < DateTime.Now)) { e.Appointment.AllowEdit = false; ScriptManager.RegisterStartupScript(Page, GetType(), "alert", "alert('You can not edit older vacations. Please contact your system adminitrator.');", true); e.Cancel = true; } else { Page.Validate(); if (Page.IsValid) { if (e.Cancel == false) { // Edit information int vacationId = Convert.ToInt32(e.ModifiedAppointment.ID); double takenDay = 0; VacationsInformationDaysInformationGateway vacationsInformationDaysInformationGateway = new VacationsInformationDaysInformationGateway(vacationsInformationTDS); string oldPaymentType = vacationsInformationDaysInformationGateway.GetPaymentType(vacationId); switch (e.ModifiedAppointment.Subject) { case "Half Vacation Day": if (oldPaymentType == "Full Vacation Day") { takenDay = -0.5; } else { if (oldPaymentType == "Unpaid Leave Full Day") { takenDay = 0.5; } else { if (oldPaymentType == "Unpaid Leave Half Day") { takenDay = 0.0; } } } break; case "Full Vacation Day": if (oldPaymentType == "Half Vacation Day") { takenDay = 0.5; } else { if (oldPaymentType == "Unpaid Leave Full Day") { takenDay = 1; } else { if (oldPaymentType == "Unpaid Leave Half Day") { takenDay = 1; } } } break; case "Unpaid Leave Full Day": if (oldPaymentType == "Full Vacation Day") { takenDay = -1; } else { if (oldPaymentType == "Half Vacation Day") { takenDay = -0.5; } else { if (oldPaymentType == "Unpaid Leave Half Day") { takenDay = 0.0; } } } break; case "Unpaid Leave Half Day": if (oldPaymentType == "Full Vacation Day") { takenDay = -1; } else { if (oldPaymentType == "Half Vacation Day") { takenDay = -0.5; } else { if (oldPaymentType == "Unpaid Leave Full Day") { takenDay = 0.0; } } } break; } VacationsInformationDaysInformation vacationsInformationDaysInformation = new VacationsInformationDaysInformation(vacationsInformationTDS); vacationsInformationDaysInformation.Update(vacationId, e.ModifiedAppointment.Subject); // Store dataset Session["vacationsInformationTDS"] = vacationsInformationTDS; Session["vacationDaysInformation"] = vacationsInformationTDS.DaysInformation; tkrsVacations.DataBind(); double newRemainingVacationDays = double.Parse(tbxRemaining.Text) - takenDay; tbxRemaining.Text = newRemainingVacationDays.ToString(); if (double.Parse(tbxRemaining.Text) < 0) { ScriptManager.RegisterStartupScript(Page, GetType(), "alert", "alert('You are requesting more vacation than the assigned. If you continue this will be discounted the next year. Please review your information.');", true); } } } else { e.Cancel = true; } } } else { e.Cancel = true; } }
protected void InstructionalPlanScheduler_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e) { _selectedPlan.UpdateCalendarEvent(DataIntegrity.ConvertToInt(e.ModifiedAppointment.ID), e.ModifiedAppointment.Start, e.ModifiedAppointment.End, e.ModifiedAppointment.Subject); }
protected void RadScheduler1_AppointmentUpdate(object sender, AppointmentUpdateEventArgs e) { RadCalendar1.SpecialDays.Clear(); RadCalendar2.SpecialDays.Clear(); }