protected void Page_Load(object sender, EventArgs e)
        {
            User u = (User)Session["UserEntity"];

            if (u == null || u.RoleId != 5)
            {
                Response.Redirect("../Security.aspx");
            }
            if (!IsPostBack)
            {
                //User userbean = (User)Session["UserEntity"];
                //Supervisor.Text = "Hello," + userbean.Name;

                List <Department> listDepartment = df.GetDepName();
                DropDownListDepartment.DataSource     = listDepartment;
                DropDownListDepartment.DataTextField  = "deptName";
                DropDownListDepartment.DataValueField = "deptName";
                DropDownListDepartment.DataBind();

                List <RequestItem> listCategary = rif.GetCategoryName();
                DropDownListCategory.DataSource     = listCategary;
                DropDownListCategory.DataTextField  = "CategoryName";
                DropDownListCategory.DataValueField = "CategoryName";
                DropDownListCategory.DataBind();
            }
        }
Example #2
0
        //Метод изменения настроек, вызывается при сменен значения в DropDownListMain события DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
        private void SelectedIndexChanged()
        {
            int.TryParse(DropDownListMain.SelectedValue, out ItemSelected);
            LabelInfo.Text         = "";
            LabelStatus.Text       = "";
            ButtonGetDataList.Text = buttonget + DropDownListMain.SelectedItem + ")";

            switch (ItemSelected)
            {
            case 0:
                LabelFromCategory.Visible = false;
                LabelFromCategory.Enabled = false;

                DropDownListCategory.Visible = false;
                DropDownListCategory.Enabled = false;
                break;

            case 1:
                LabelFromCategory.Visible = true;
                LabelFromCategory.Enabled = true;

                DropDownListCategory.Visible = true;
                DropDownListCategory.Enabled = true;
                DropDownListCategory.DataBind();
                break;
            }
        }
        public void retrievedata()
        {
            DropDownListsupplier1.DataSource     = maintainCatalogueController.GetSupplierList();
            DropDownListsupplier1.DataTextField  = "SupplierName";
            DropDownListsupplier1.DataValueField = "SupplierId";
            DropDownListsupplier1.DataBind();

            DropDownListsupplier2.DataSource     = maintainCatalogueController.GetSupplierList();
            DropDownListsupplier2.DataTextField  = "SupplierName";
            DropDownListsupplier2.DataValueField = "SupplierId";
            DropDownListsupplier2.DataBind();

            DropDownListsupplier3.DataSource     = maintainCatalogueController.GetSupplierList();
            DropDownListsupplier3.DataTextField  = "SupplierName";
            DropDownListsupplier3.DataValueField = "SupplierId";
            DropDownListsupplier3.DataBind();

            DropDownListCategory.DataSource     = maintainCatalogueController.GetCategoryList();
            DropDownListCategory.DataTextField  = "CategoryName";
            DropDownListCategory.DataValueField = "CategoryId";
            DropDownListCategory.DataBind();

            DropDownListuom.DataSource = maintainCatalogueController.GetUomList();
            DropDownListuom.DataBind();
        }
 private void BindClaimSkuCategory()
 {
     DropDownListCategory.DataSource     = ClaimSku.GetClaimSkuCategoryList();
     DropDownListCategory.DataTextField  = "Description";
     DropDownListCategory.DataValueField = "ClaimSkuCategoryId";
     DropDownListCategory.DataBind();
     DropDownListCategory.Items.Insert(0, new ListItem("Please select", "0"));
 }
Example #5
0
 private void ShowCategory()
 {
     if (!IsPostBack)
     {
         KategoriDb db = new KategoriDb();
         DropDownListCategory.DataSource     = db.CategoriesShow();
         DropDownListCategory.DataValueField = "Kategori_ID";
         DropDownListCategory.DataTextField  = "Kategori_Ad";
         DropDownListCategory.DataBind();
     }
 }
Example #6
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         //Populate categories dropdown list
         Category        cat        = new Category();
         List <Category> categories = cat.GetAllCategories(true);
         DropDownListCategory.DataSource     = categories;
         DropDownListCategory.DataTextField  = "Name";
         DropDownListCategory.DataValueField = "CategoryID";
         DropDownListCategory.DataBind();
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //Obtain product code from query string
                string prodcd = Request.QueryString["prodcd"].ToString();

                //Get product by its code
                Product prod = new Product();
                prod.GetProductByCode(prodcd);

                //Populate categories dropdown list
                Category        cat        = new Category();
                List <Category> categories = cat.GetAllCategories(true);
                DropDownListCategory.DataSource     = categories;
                DropDownListCategory.DataTextField  = "Name";
                DropDownListCategory.DataValueField = "CategoryID";
                DropDownListCategory.DataBind();

                //Put product details into fields
                LabelProductCode.Text              = Request.QueryString["prodcd"].ToString();
                TextBoxName.Text                   = prod.Name.ToString();
                TextBoxBrand.Text                  = prod.Brand.ToString();
                TextBoxDescription.Text            = prod.Description.ToString();
                DropDownListCategory.SelectedValue = prod.CategoryID.ToString();
                TextBoxMSRP.Text                   = prod.Msrp.ToString();
                CheckBoxFreeShipping.Checked       = Convert.ToBoolean(prod.IsFreeShipping);
                CheckBoxTaxFree.Checked            = Convert.ToBoolean(prod.IsTaxFree);
                TextBoxQtyInStock.Text             = prod.QuantityInStock.ToString();
                CheckBoxQtyUnlimited.Checked       = Convert.ToBoolean(prod.IsQuantityUnlimited);
                LabelCreated.Text                  = Convert.ToDateTime(prod.Created).ToShortDateString();
                if (Convert.ToDateTime(prod.Modified) > DateTime.MinValue)
                {
                    LabelModified.Text = Convert.ToDateTime(prod.Modified).ToShortDateString();
                }
                else
                {
                    LabelModified.Text = "N/A";
                }

                //Attempt to display image (if it is found)
                try
                {
                    Image1.ImageUrl = "~/Images/Product_Images/" + LabelProductCode.Text + ".jpg";
                }
                catch (Exception)
                {
                    Image1.ImageUrl = "";
                }
            }
        }
Example #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                txtStartDate.Text = System.DateTime.Now.ToString("MM/dd/yyyy");


                // Categories
                List <JsonCintGeneral> categories;

                if (Session["ListCategories"] == null)
                {
                    categories = JsonConvert.DeserializeObject <List <JsonCintGeneral> >(jsonGET("https://api.cintworks.net/ordering/reference/survey/categories"));
                    Session["ListCategories"] = categories;
                }
                else
                {
                    categories = (List <JsonCintGeneral>)Session["ListCategories"];
                }

                List <JsonCintGeneral> categoriesSortedList = categories.OrderBy(o => o.name).ToList();

                DropDownListCategory.DataSource     = categoriesSortedList;
                DropDownListCategory.DataTextField  = "name";
                DropDownListCategory.DataValueField = "id";
                DropDownListCategory.DataBind();

                List <JsonCintGeneral> countries;


                if (Session["ListCountries"] == null)
                {
                    countries = JsonConvert.DeserializeObject <List <JsonCintGeneral> >(jsonGET("https://api.cintworks.net/ordering/reference/countries"));
                    Session["ListCountries"] = countries;
                }
                else
                {
                    countries = (List <JsonCintGeneral>)Session["ListCountries"];
                }

                List <JsonCintGeneral> countriesSortedList = countries.OrderBy(o => o.name).ToList();
                DropDownListCountry.DataSource     = countriesSortedList;
                DropDownListCountry.DataTextField  = "name";
                DropDownListCountry.DataValueField = "id";
                DropDownListCountry.DataBind();

                DropDownListCountry.SelectedValue = "22";
            }
        }
Example #9
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         string        constr = ConfigurationManager.ConnectionStrings["Registration"].ConnectionString;
         SqlConnection connec = new SqlConnection(constr);
         string        S      = "spselect";
         SqlCommand    com    = new SqlCommand(S, connec);
         connec.Open();
         com.CommandType = CommandType.StoredProcedure;
         DropDownListCategory.DataSource     = com.ExecuteReader();
         DropDownListCategory.DataTextField  = "Category Name";
         DropDownListCategory.DataValueField = "Cat ID";
         DropDownListCategory.DataBind();
         connec.Close();
     }
 }
Example #10
0
    protected void newCategoryConfirmButton_Click(object sender, EventArgs e)
    {
        // Create connnection to RB_RecipeBook database
        SqlConnection conn;
        SqlCommand    comm;
        SqlDataReader reader;
        // Read the connection string from Web.config
        string connectionString =
            ConfigurationManager.ConnectionStrings["RB_RecipeBook"].ConnectionString;

        conn = new SqlConnection(connectionString);

        // Create sql command with insert statement
        comm = new SqlCommand("INSERT RB_Category (CategoryName) " +
                              "VALUES(@CategoryName);", conn);

        // Create parameters
        comm.Parameters.Add("@CategoryName", System.Data.SqlDbType.NVarChar);
        comm.Parameters["@CategoryName"].Value = newCategoryTextBox.Text;

        try
        {
            conn.Open();
            comm.ExecuteNonQuery();
        }
        catch
        {
            MessageLabel.Text = "Error while adding the new category. Try again!";
        }
        finally
        {
            conn.Close();
        }

        // Hyde new category objects
        newCategoryTextBox.Visible       = false;
        newCategoryTextBox.Enabled       = false;
        newCategoryConfirmButton.Visible = false;

        // Bind drop down list category again to refresh
        DropDownListCategory.DataBind();

        // Select the new added category
        DropDownListCategory.SelectedIndex = DropDownListCategory.Items.Count - 1;
    }
Example #11
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         List <string> dataSource = new List <string>();
         dataSource.Add("All Roles");
         dataSource.Add(Core.Models.User.Category.Admin.ToString());
         dataSource.Add(Core.Models.User.Category.Faculty.ToString());
         dataSource.Add(Core.Models.User.Category.Moderator.ToString());
         dataSource.Add(Core.Models.User.Category.Staff.ToString());
         dataSource.Add(Core.Models.User.Category.Student.ToString());
         DropDownListCategory.DataSource = dataSource;
         //DropDownListCategory.CssClass = "w3-dropdown-content w3-bar-block w3-border";
         DropDownListCategory.DataBind();
         //LoadTable("");
     }
     LoadTable(TextBoxSearchUserAccount.Text);
 }
Example #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //--------Testing with hard coded user id-------
                //Session["userId"] = new Guid();


                if (Session["userId"] == null)
                {
                    LinkButtonHistory.Visible = false;
                }

                // Dropdown box
                DataSet ds = client.SelectDistinctLocationFromBranch();
                DropDownListLocation.DataSource     = ds;
                DropDownListLocation.DataTextField  = "city";
                DropDownListLocation.DataValueField = "city";
                DropDownListLocation.DataBind();
                DropDownListLocation.Items.Insert(0, new ListItem("All", "All"));

                ds = client.SelectDistinctCategoryFromBranch();
                DropDownListCategory.DataSource     = ds;
                DropDownListCategory.DataTextField  = "category";
                DropDownListCategory.DataValueField = "category";
                DropDownListCategory.DataBind();
                DropDownListCategory.Items.Insert(0, new ListItem("All", "All"));

                Session["search"] = "";


                // Display search Result
                BindListView();
            }

            // Autofill for search

            Names = client.SelectDistinctShopNameFromBranch().ToList <String>();
        }
Example #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            DataTable oDT_Category   = DBService.GetCategory();
            DataTable oDT_SubmitDate = DBService.GetSubmitDates();

            DropDownListCategory.DataSource     = oDT_Category;
            DropDownListCategory.DataValueField = "CategoryId";
            DropDownListCategory.DataTextField  = "CategoryName";
            DropDownListCategory.DataBind();
            DropDownListCategory.AutoPostBack = true;

            DropDownListSubmitDate.DataSource     = oDT_SubmitDate;
            DropDownListSubmitDate.DataValueField = "SubmitDate";
            DropDownListSubmitDate.DataTextField  = "SubmitDateText";
            DropDownListSubmitDate.DataBind();
            DropDownListSubmitDate.AutoPostBack = true;

            LoadContent();
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (HttpContext.Current.User.Identity.IsAuthenticated)
        {
            if (!IsPostBack)
            {
                DropDownListCategory.DataSource = getData("getCategoriesNameAndId", null);
                DropDownListCategory.DataBind();

                ListItem liCategory = new ListItem("اختر تصنيف", "-1");
                DropDownListCategory.Items.Insert(0, liCategory);

                ListItem liFood = new ListItem("اختر الطعام", "-1");
                DropDownListFood.Items.Insert(0, liFood);

                DropDownListFood.Enabled = false;
            }
        }
        else
        {
            Response.Redirect("Account//Login.aspx");
        }
    }
        protected void Page_Load(object sender, EventArgs e)
        {
            User user = null;

            if (!IsPostBack)
            {
                if (Session["UserAccountId"] != null)
                {
                    int id = Int16.Parse((string)Session["UserAccountId"]);
                    user = UserController.GetInstance().Recover(id);

                    HiddenFieldId.Value = id.ToString();
                    textboxEmail.Text   = user.Email.Trim();

                    textboxFirstName.Text = user.FirstName;
                    textboxLastName.Text  = user.LastName;

                    HiddenFieldPW.Value       = user.Password;
                    HiddenFieldVerified.Value = user.Verified.ToString();
                }
                else
                {
                    Account.Visible    = false;
                    buttonSave.Visible = false;
                }
            }

            if (user != null)
            {
                List <string> dataSource = new List <string>();
                dataSource.Add(Core.Models.User.Category.Admin.ToString());
                dataSource.Add(Core.Models.User.Category.Faculty.ToString());
                dataSource.Add(Core.Models.User.Category.Moderator.ToString());
                dataSource.Add(Core.Models.User.Category.Staff.ToString());
                dataSource.Add(Core.Models.User.Category.Student.ToString());
                DropDownListCategory.DataSource = dataSource;
                switch (user.category)
                {
                case Core.Models.User.Category.Admin:
                    DropDownListCategory.SelectedIndex = 0;
                    break;

                case Core.Models.User.Category.Faculty:
                    DropDownListCategory.SelectedIndex = 1;
                    break;

                case Core.Models.User.Category.Moderator:
                    DropDownListCategory.SelectedIndex = 2;
                    break;

                case Core.Models.User.Category.Staff:
                    DropDownListCategory.SelectedIndex = 3;
                    break;

                case Core.Models.User.Category.Student:
                    DropDownListCategory.SelectedIndex = 4;
                    break;
                }
                //DropDownListCategory.CssClass = "w3-dropdown-content w3-bar-block w3-border";
                DropDownListCategory.DataBind();
            }
        }