private void GetUsers()
        {
            string userId = null;

            if (!bool.Parse(Session["isPortalAdmin"].ToString()) == true)
            {
                userId = Session["UserID"].ToString();
            }
            SqlDataReader drUsers = DataProvider.GetUsers(userId);

            if (drUsers != null)
            {
                DropDownListUsers.DataSource     = drUsers;
                DropDownListUsers.DataTextField  = "USR_ID_NAME";
                DropDownListUsers.DataValueField = "USR_ID";
                DropDownListUsers.DataBind();
                DataController.SetAsSeletedValue(DropDownListUsers, Session["UserID"].ToString(), true);
            }
            drUsers.Close();
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //Obtain Order ID from query string
                int orderid = Convert.ToInt32(Request.QueryString["orderid"]);

                //Get Order by its orderid
                Order order = new Order();
                order.GetOrderByID(orderid);

                //Populate Delivery Types dropdown list
                DeliveryType        dt     = new DeliveryType();
                List <DeliveryType> dtypes = dt.GetAllDeliveryTypes();
                DropDownListDeliveryType.DataSource     = dtypes;
                DropDownListDeliveryType.DataTextField  = "Name";
                DropDownListDeliveryType.DataValueField = "DeliveryTypeID";
                DropDownListDeliveryType.DataBind();

                //Populate Users dropdown list
                User        user  = new User();
                List <User> users = user.GetAllUsers();
                DropDownListUsers.DataSource     = users;
                DropDownListUsers.DataTextField  = "Username";
                DropDownListUsers.DataValueField = "UserID";
                DropDownListUsers.DataBind();

                //Put order details into fields
                LabelOrderID.Text = Request.QueryString["orderid"].ToString();
                DropDownListUsers.SelectedValue = Convert.ToString(order.UserID);
                TextBoxSubtotal.Text            = Convert.ToString(order.Subtotal);
                TextBoxTaxes.Text        = Convert.ToString(order.Taxes);
                TextBoxDeliveryCost.Text = Convert.ToString(order.DeliveryCost);
                DropDownListDeliveryType.SelectedValue = Convert.ToString(order.DeliveryTypeID);
                TextBoxGrandTotal.Text = Convert.ToString(order.GrandTotal);
            }
        }