Example #1
0
    protected void SortPrescription_SelectedIndexChanged(object sender, EventArgs e)
    {
        //init the visible of the gridview and the close button
        ShowPrescriptionGrid.Visible = false;
        ClosePrescription.Visible    = false;
        int                x = SortPrescription.SelectedIndex;
        DataSet            ds;
        PrescriptioService ps         = new PrescriptioService();
        User               u          = (User)Session["user"];
        string             whereClout = " where PrescriptionUserId='" + u.CUserId + "'";

        //write every thing is 1 query
        //in the query put the PrescriptionId in cell 0 because this cell is visiable in the gridview
        if (x == 1)
        {
            whereClout += " ORDER BY PrescriptionDate";
            //use query that sort by PrescriptionDate, show all the data
        }
        else if (x == 2)
        {
            whereClout += " ORDER BY PrescriptionDoctorId";
            //use query that sort by PrescriptionDoctorId, show all the data
        }
        ds = ps.SortPrescription(whereClout);


        //DataSet temp = webser.GetCatagoryName()
        //check if ds is empty
        //if he is empty send popup that there is no prescription
        //else, shoe the date in the grid view

        if (ds.Tables[0].Rows.Count != 0)
        {
            ClosePrescription.Visible       = true;
            ShowPrescriptionGrid.Visible    = true;
            ShowPrescriptionGrid.DataSource = ds;
            ShowPrescriptionGrid.DataBind();
        }
        else
        {
            Response.Write("<script>alert('לא נמצאו מרשמים')</script>");
        }
    }
Example #2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!Page.IsPostBack)
     {
         User u = (User)Session["user"];
         HelloLabel.Text = u.CUserName;
         PrescriptioService ps         = new PrescriptioService();
         string             whereClout = " where PrescriptionUserId='" + u.CUserId + "'";
         DataSet            ds         = ps.SortPrescription(whereClout);
         if (ds.Tables[0].Rows.Count != 0)
         {
             ClosePrescription.Visible       = true;
             ShowPrescriptionGrid.Visible    = true;
             ShowPrescriptionGrid.DataSource = ds;
             ShowPrescriptionGrid.DataBind();
         }
         else
         {
             Response.Write("<script>alert('לא נמצאו מרשמים')</script>");
         }
     }
 }