protected void RadScheduler1_AppointmentContextMenuItemClicked(object sender, AppointmentContextMenuItemClickedEventArgs e) { try { if ((e.MenuItem.Value == "Create") && (e.Appointment.Attributes["Annotations"] == "Appointment")) { if (DateTime.Now.Day < e.Appointment.Start.Day && DateTime.Now.Month <= int.Parse(Session["MonthID"].ToString())) { return; } Session["IsEditCall"] = 0; Session["PlannedVisitID"] = int.Parse(e.Appointment.ID.ToString()); Session["PlannedVisitDate"] = e.Appointment.Start; Session["IsDoubleVisit"] = -1; if (e.Appointment.Resources.GetResourceByType("Affiliation") == null || e.Appointment.Resources.GetResourceByType("Affiliation") != null) { con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["AmounCrmConnectionString"].ToString()); //string s = "Select Distinct AffiliationID, AreaRecID From View_ListOfAppointments_Admin WHERE AppointmentID = " + int.Parse(e.Appointment.ID.ToString()); string s = "Select Distinct AffiliationID, SpecialtyID From View_Appointments_Scheduler WHERE AppointmentID = " + int.Parse(e.Appointment.ID.ToString()); cmd = new SqlCommand(s, con); con.Open(); SqlDataReader dr = cmd.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { Session["ParticipantID"] = dr["AffiliationID"].ToString(); Session["SpecialtyID"] = dr["SpecialtyID"].ToString(); } } dr.Close(); } //else //{ // Session["ParticipantID"] = e.Appointment.Resources.GetResourceByType("Affiliation").Key.ToString(); //} int aaa = 1; int bbb = 0; if (aaa == bbb) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "OpenWindow", "window.open('CallsEntry.aspx');", true); } else { ScriptManager.RegisterStartupScript(Page, typeof(Page), "OpenWindow", "window.open('Calls2.aspx');", true); } } if ((e.MenuItem.Value == "Create") && (e.Appointment.Attributes["Annotations"] != "Appointment")) { Label1.Text = "Alert!" + "<br />" + "This Visit Already Created"; RadWindowManager1.RadAlert("Duplicate Visits <br /> This Appointment Has a Corresponding Visit", 400, 200, "Alert!", null, ""); } if (e.MenuItem.Value == "EditCall" && e.Appointment.Attributes["Annotations"] == "Created") { if (DateTime.Now.Day < e.Appointment.Start.Day) { return; } Session["IsEditCall"] = 1; Session["PlannedVisitID"] = int.Parse(e.Appointment.ID.ToString()); Session["PlannedVisitDate"] = e.Appointment.Start; Session["IsDoubleVisit"] = 0; if (e.Appointment.Resources.GetResourceByType("Affiliation") == null || e.Appointment.Resources.GetResourceByType("Affiliation") != null) { con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["AmounCrmConnectionString"].ToString()); //string s = "Select Distinct AffiliationID, AreaRecID From View_ListOfAppointments_Admin WHERE AppointmentID = " + int.Parse(e.Appointment.ID.ToString()); string s = "Select Distinct AffiliationID, SpecialtyID, IsDoubleVisit From View_Appointments_Scheduler WHERE AppointmentID = " + int.Parse(e.Appointment.ID.ToString()); cmd = new SqlCommand(s, con); con.Open(); SqlDataReader dr = cmd.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { Session["ParticipantID"] = dr["AffiliationID"].ToString(); Session["SpecialtyID"] = dr["SpecialtyID"].ToString(); Session["IsDoubleVisit"] = dr["IsDoubleVisit"].ToString(); } } dr.Close(); } //else //{ // Session["ParticipantID"] = e.Appointment.Resources.GetResourceByType("Affiliation").Key.ToString(); //} int aaa = 1; int bbb = 0; if (aaa == bbb) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "OpenWindow", "window.open('CallsEntry.aspx');", true); } else { ScriptManager.RegisterStartupScript(Page, typeof(Page), "OpenWindow", "window.open('Calls2.aspx');", true); } } if (e.MenuItem.Value == "EditCall" && e.Appointment.Attributes["Annotations"] != "Created") { Session["IsEditCall"] = 0; Label1.Text = "Alert!" + "<br />" + "This appointment was finally saved or you did not creat a call for it"; RadWindowManager1.RadAlert("This appointment was finally saved or you did not creat a call for it", 400, 200, "Alert!", null, ""); } if (e.MenuItem.Value == "DisplayCall" && e.Appointment.Attributes["Annotations"] != "Appointment") { Session["IsEditCall"] = 2; Session["IsFinal"] = e.Appointment.Attributes["Annotations"]; Session["PlannedVisitID"] = int.Parse(e.Appointment.ID.ToString()); Session["PlannedVisitDate"] = e.Appointment.Start; Session["IsDoubleVisit"] = 0; if (e.Appointment.Resources.GetResourceByType("Affiliation") == null || e.Appointment.Resources.GetResourceByType("Affiliation") != null) { con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["AmounCrmConnectionString"].ToString()); //string s = "Select Distinct AffiliationID, AreaRecID From View_ListOfAppointments_Admin WHERE AppointmentID = " + int.Parse(e.Appointment.ID.ToString()); string s = "Select Distinct AffiliationID, SpecialtyID, LineID, IsDoubleVisit From View_Appointments_Scheduler WHERE AppointmentID = " + int.Parse(e.Appointment.ID.ToString()); cmd = new SqlCommand(s, con); con.Open(); SqlDataReader dr = cmd.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { Session["ParticipantID"] = dr["AffiliationID"].ToString(); Session["SpecialtyID"] = dr["SpecialtyID"].ToString(); Session["LineID_Sch"] = dr["LineID"].ToString(); Session["IsDoubleVisit"] = dr["IsDoubleVisit"].ToString(); } } dr.Close(); } //else //{ // Session["ParticipantID"] = e.Appointment.Resources.GetResourceByType("Affiliation").Key.ToString(); //} int aaa = 1; int bbb = 0; if (aaa == bbb) { ScriptManager.RegisterStartupScript(Page, typeof(Page), "OpenWindow", "window.open('CallsEntry.aspx');", true); } else { ScriptManager.RegisterStartupScript(Page, typeof(Page), "OpenWindow", "window.open('Calls2.aspx');", true); } } if (e.MenuItem.Value == "DisplayCall" && e.Appointment.Attributes["Annotations"] == "Appointment") { Label1.Text = "Error" + "<br />" + "This appointment has no corresponding call"; RadWindowManager1.RadAlert("This appointment has no corresponding call", 400, 200, "Alert!", null, ""); } if ((e.MenuItem.Value == "CommandDelete" || e.MenuItem.Value == "CommandEdit") && e.Appointment.Attributes["Annotations"] != "Appointment") { return; } } catch (Exception ex) { Label1.Text = ex.Message; RadWindowManager1.RadAlert(ex.Source + "<br />" + ex.Message, 400, 200, "Alert!", null, ""); } }
protected void RadScheduler1_AppointmentContextMenuItemClicked(object sender, AppointmentContextMenuItemClickedEventArgs e) { }
protected void RadScheduler1_AppointmentContextMenuItemClicked(object sender, AppointmentContextMenuItemClickedEventArgs e) { try { if ((e.MenuItem.Value == "Create") && (e.Appointment.Attributes["Annotations"] == "Appointment")) { Session["repIDFromAdmin"] = ddlReps.SelectedValue; Session["IsEditCallFromAdmin"] = 0; Session["PlannedVisitIDFromAdmin"] = int.Parse(e.Appointment.ID.ToString()); Session["PlannedVisitDateFromAdmin"] = e.Appointment.Start; if (e.Appointment.Resources.GetResourceByType("Affiliation") == null) { con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["AmounCrmConnectionString"].ToString()); string s = "Select Distinct AffiliationID, AreaRecID From Appointments WHERE AppointmentID = " + int.Parse(e.Appointment.ID.ToString()); cmd = new SqlCommand(s, con); con.Open(); SqlDataReader dr = cmd.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { repAreaID = int.Parse(dr["AreaRecID"].ToString()); Session["RepAreaIDFromAdmin"] = repAreaID; Session["ParticipantIDFromAdmin"] = dr["AffiliationID"].ToString(); } } dr.Close(); } else { Session["ParticipantIDFromAdmin"] = e.Appointment.Resources.GetResourceByType("Affiliation").Key.ToString(); } Session["RepLineIDFromAdmin"] = int.Parse(ddlLines.SelectedValue); Session["RepCycleIDFromAdmin"] = Session["CycleIDFromAdmin"].ToString();//ddlCycles.SelectedValue; //Response.Redirect("~/Reps/CallsEntryFromAdmin.aspx"); ScriptManager.RegisterStartupScript(Page, typeof(Page), "OpenWindow", "window.open('CallsEntryFromAdmin.aspx');", true); } if ((e.MenuItem.Value == "Create") && (e.Appointment.Attributes["Annotations"] != "Appointment")) { Label1.Text = "Alert!" + "<br />" + "This Visit Already Created"; } if (e.MenuItem.Value == "EditCall" && e.Appointment.Attributes["Annotations"] == "Created") { Session["repIDFromAdmin"] = ddlReps.SelectedValue; Session["IsEditCallFromAdmin"] = 1; Session["PlannedVisitIDFromAdmin"] = int.Parse(e.Appointment.ID.ToString()); Session["PlannedVisitDateFromAdmin"] = e.Appointment.Start; if (e.Appointment.Resources.GetResourceByType("Affiliation") == null) { con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["AmounCrmConnectionString"].ToString()); string s = "Select Distinct AffiliationID, AreaRecID From Appointments WHERE AppointmentID = " + int.Parse(e.Appointment.ID.ToString()); cmd = new SqlCommand(s, con); con.Open(); SqlDataReader dr = cmd.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { repAreaID = int.Parse(dr["AreaRecID"].ToString()); Session["RepAreaIDFromAdmin"] = repAreaID; Session["ParticipantIDFromAdmin"] = dr["AffiliationID"].ToString(); } } dr.Close(); } else { Session["ParticipantIDFromAdmin"] = e.Appointment.Resources.GetResourceByType("Affiliation").Key.ToString(); } Session["RepLineIDFromAdmin"] = int.Parse(ddlLines.SelectedValue); Session["RepCycleIDFromAdmin"] = Session["CycleIDFromAdmin"].ToString();//ddlCycles.SelectedValue; //Response.Redirect("~/Reps/CallsEntryFromAdmin.aspx"); ScriptManager.RegisterStartupScript(Page, typeof(Page), "OpenWindow", "window.open('CallsEntryFromAdmin.aspx');", true); } if (e.MenuItem.Value == "EditCall" && e.Appointment.Attributes["Annotations"] != "Created") { Session["IsEditCallFromAdmin"] = 0; Label1.Text = "Alert!" + "<br />" + "This appointment was finally saved or you did not creat a call for it"; } if (e.MenuItem.Value == "DisplayCall" && e.Appointment.Attributes["Annotations"] != "Appointment") { Session["repIDFromAdmin"] = ddlReps.SelectedValue; Session["IsEditCallFromAdmin"] = 2; Session["IsFinal"] = e.Appointment.Attributes["Annotations"]; Session["PlannedVisitIDFromAdmin"] = int.Parse(e.Appointment.ID.ToString()); Session["PlannedVisitDateFromAdmin"] = e.Appointment.Start; if (e.Appointment.Resources.GetResourceByType("Affiliation") == null) { con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["AmounCrmConnectionString"].ToString()); string s = "Select Distinct AffiliationID, AreaRecID From Appointments WHERE AppointmentID = " + int.Parse(e.Appointment.ID.ToString()); cmd = new SqlCommand(s, con); con.Open(); SqlDataReader dr = cmd.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { repAreaID = int.Parse(dr["AreaRecID"].ToString()); Session["RepAreaIDFromAdmin"] = repAreaID; Session["ParticipantIDFromAdmin"] = dr["AffiliationID"].ToString(); } } dr.Close(); } else { Session["ParticipantIDFromAdmin"] = e.Appointment.Resources.GetResourceByType("Affiliation").Key.ToString(); } Session["RepLineIDFromAdmin"] = int.Parse(ddlLines.SelectedValue); Session["RepCycleIDFromAdmin"] = Session["CycleIDFromAdmin"].ToString();// ddlCycles.SelectedValue; //Response.Redirect("~/Reps/CallsEntryFromAdmin.aspx"); ScriptManager.RegisterStartupScript(Page, typeof(Page), "OpenWindow", "window.open('CallsEntryFromAdmin.aspx');", true); } if (e.MenuItem.Value == "DisplayCall" && e.Appointment.Attributes["Annotations"] == "Appointment") { //Session["IsEditCallFromAdmin"] = 0; Label1.Text = "Error" + "<br />" + "This appointment has no corresponding call"; } } catch (Exception ex) { lblCycle.Text = ex.Source + ": " + ex.Message; //MessageBox.Show(ex.Message); } }