protected void SortDDL_SelectedIndexChanged(object sender, EventArgs e) { //init the visible of the gridview and the close button ClosePrescription.Visible = false; ShowPrescription.Visible = false; int x = SortDDL.SelectedIndex; DataSet ds; PrescriptioService ps = new PrescriptioService(); //create the SQL query string whereclout = " WHERE DoctorId=PrescriptionDoctorId and UserId=PrescriptionUserId"; switch (x) { case 1: { whereclout += " ORDER BY PrescriptionDoctorId"; break; } case 2: { whereclout += " ORDER BY PrescriptionUserId"; break; } case 3: { whereclout += " ORDER BY PrescriptionMedicineId"; break; } case 4: { whereclout += " ORDER BY PrescriptionDate"; break; } } ds = ps.SortPrescriptionManager(whereclout); if (ds.Tables[0].Rows.Count != 0) { ClosePrescription.Visible = true; ShowPrescription.Visible = true; ShowPrescription.DataSource = ds; ShowPrescription.DataBind(); } else { Response.Write("<script>alert('לא נמצאו מרשמים')</script>"); } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { Manager m = (Manager)Session["manager"]; HelloLabel.Text = m.CManagerName; string whereclout = " where DoctorId=PrescriptionDoctorId and UserId=PrescriptionUserId"; PrescriptioService ps = new PrescriptioService(); DataSet ds = ps.SortPrescriptionManager(whereclout); ShowPrescription.Visible = false; if (ds.Tables[0].Rows.Count != 0) { ClosePrescription.Visible = true; ShowPrescription.Visible = true; ShowPrescription.DataSource = ds; ShowPrescription.DataBind(); } else { Response.Write("<script>alert('לא נמצאו מרשמים')</script>"); } } }