protected void SortDDL_SelectedIndexChanged(object sender, EventArgs e) { int x = SortDDL.SelectedIndex; string order = ""; switch (x) { case 1: { order = " ORDER BY OrderTotalMoney DESC"; break; } case 3: { order = " ORDER BY OrderIsSupplied"; break; } case 2: { order = " ORDER BY OrderDate"; break; } } Pharmcy.PharmcyWS webser = new Pharmcy.PharmcyWS(); DataSet ds = webser.GetUserOrders((string)Session["userId"], order); if (ds.Tables[0].Rows.Count != 0) { ShowOrder.Visible = true; ShowDetails.Visible = false; CloseOrders.Visible = true; ShowOrder.DataSource = ds; ShowOrder.DataBind(); } else { CloseOrders_Click(sender, e); 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; Pharmcy.PharmcyWS webser = new Pharmcy.PharmcyWS(); DataSet ds = webser.GetAllOrders(""); if (ds.Tables[0].Rows.Count != 0) { CloseOrders.Visible = true; ShowOrder.Visible = true; ShowOrder.DataSource = ds; ShowOrder.DataBind(); } else { Response.Write("<script>alert('לא נמצאו הזמנות')</script>"); } } }
protected void SortButton_Click(object sender, EventArgs e) { string order = " ORDER BY ", temp = order; if (HighToLow.Checked) { if (order.Equals(temp)) { order += "OrderTotalMoney DESC"; } else { order += ",OrderTotalMoney DESC"; } } if (LowToHigh.Checked) { if (order.Equals(temp)) { order += "OrderTotalMoney ASC"; } else { order += ",OrderTotalMoney ASC"; } } if (SortUser.Checked) { if (order.Equals(temp)) { order += "OrderUserId ASC"; } else { order += ",OrderUserId ASC"; } } if (SortDate.Checked) { if (order.Equals(temp)) { order += "OrderDate"; } else { order += ",OrderDate"; } } if (IsSupplied.Checked) { if (order.Equals(temp)) { order += "OrderIsSupplied"; } else { order += ",OrderIsSupplied"; } } if (order.Equals(temp)) { order = ""; } Pharmcy.PharmcyWS webser = new Pharmcy.PharmcyWS(); //sort the orders DataSet ds = webser.GetAllOrders(order); if (ds.Tables[0].Rows.Count != 0) { ShowOrder.Visible = true; ShowDetails.Visible = false; CloseOrders.Visible = true; ShowOrder.DataSource = ds; ShowOrder.DataBind(); } else { CloseOrders_Click(sender, e); Response.Write("<script>alert('לא נמצאו הזמנות')</script>"); } }