protected void Page_Load(object sender, EventArgs e) { User u = (User)Session["user"]; HelloLabel.Text = u.CUserName; GetAllData.VacationsForDoctor(); GetAllData.Appointment(); AppointmentService appser = new AppointmentService(); string s = "", tables = "Apointment,Doctors,Speciality,Hours,Days"; s = "SELECT ApointmentId,ApointmentDate,ApointmentHour,DoctorName,HourStartTime,HourEndTime,SpecialityName,DayName FROM " + tables; s += " WHERE ApointmentHour=HourNumber and ApointmentDoctorId=DoctorId and SpecialityId=DoctorSpecailty and ApointmentDay=DayId and ApointmentUserId='" + u.CUserId + "'"; Session["s"] = s; Session["tabels"] = tables; DataSet ds = appser.GetApointmentAndSort(s, tables, ""); if (ds.Tables[0].Rows.Count != 0) { CloseApointment.Visible = true; SortDDL.Visible = true; ApointmentGrid.Visible = true; ApointmentGrid.DataSource = ds; ApointmentGrid.DataBind(); } else { Response.Write("<script>alert('לא נמצאו תורים')</script>"); } }
protected void SortDDL_SelectedIndexChanged(object sender, EventArgs e) { int x = SortDDL.SelectedIndex; string s = (string)Session["s"], tabels = (string)Session["tabels"]; string order = ""; switch (x) { case 0: { Response.Write("<script>alert('עליך לבחור דרך סינון')</script>"); break; } case 1: { order = " ORDER BY DoctorName"; break; } case 2: { order = " ORDER BY SpecialityName"; break; } case 3: { order = " ORDER BY ApointmentDate"; break; } case 4: { order = " ORDER BY ApointmentHour,ApointmentDate"; break; } } AppointmentService appser = new AppointmentService(); DataSet ds = appser.GetApointmentAndSort(s, tabels, order); ApointmentGrid.DataSource = ds; ApointmentGrid.DataBind(); }