protected void Page_Load(object sender, EventArgs e) { if (Session["UserType"].ToString() != "admin") { if (Session["UserType"].ToString() != "stock") { Response.Redirect("home.aspx");; } } Pclient = new ProductService.ProductServiceClient(); }
protected void Page_Load(object sender, EventArgs e) { client = new UserServiceClient(); pClient = new ProductServiceClient(); users = client.GetAllUsers(); products = pClient.GetAllProducts(); if (!IsPostBack) { List <ListItem> items = new List <ListItem>(); List <ListItem> prods = new List <ListItem>(); foreach (User u in users) { if (!u.User_Type.Equals("admin")) { ListItem li = new ListItem(); li.Text = u.UserID + " " + u.Name.ToString() + "(" + u.User_Type + ")"; li.Value = u.UserID + " " + u.Name.ToString() + "(" + u.User_Type + ")"; items.Add(li); } } Towner.DataSource = items; Towner.DataBind(); foreach (Product p in products) { ListItem x = new ListItem(); x.Text = p.P_ID + " " + p.P_Name + " " + "Current Quantity=" + " " + p.P_Quantity.ToString(); x.Value = p.P_ID.ToString(); prods.Add(x); } ListItem newProd = new ListItem(); newProd.Text = "New Incoming Product!!!"; newProd.Text = "New Incoming Product!!!"; prods.Add(newProd); ProList.DataSource = prods; ProList.DataBind(); } }