protected void Page_Load(object sender, EventArgs e)
        {
            StationeryController stationeryController = new StationeryController();

            ui_category_gridview.DataSource = stationeryController.actionGetStationeryCategories();
            ui_category_gridview.GridLines  = GridLines.None;
            ui_category_gridview.DataBind();
        }
Exemple #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            StationeryController stationeryController = new StationeryController();

            List <Supplier> suppliers = new SupplierController().actionGetSuppliers();



            int stationery_id;

            if (int.TryParse(Request.QueryString["id"], out stationery_id))
            {
                stationery_id = Convert.ToInt16(Request.QueryString["id"].ToString());
                if (stationery_id < 1)
                {
                    Response.Redirect("~/StoreClerk/StationeryList.aspx");
                }

                if (!Page.IsPostBack)
                {
                    Stationery stationery = stationeryController.actionGetStationeryByID(stationery_id);

                    ui_id_hiddenfield.Value = stationery.id.ToString();
                    ui_code_textbox.Text    = stationery.code.ToString();
                    ui_name_textbox.Text    = stationery.stationery_name;

                    ui_category_dropdown.DataSource     = stationeryController.actionGetStationeryCategories();
                    ui_category_dropdown.DataTextField  = "category_name";
                    ui_category_dropdown.DataValueField = "id";
                    ui_category_dropdown.DataBind();
                    ui_category_dropdown.SelectedValue = stationery.category.ToString();


                    ui_price_textbox.Text           = stationery.price.ToString();
                    ui_reorderlevel_textbox.Text    = stationery.reorder_level.ToString();;
                    ui_reorderquantity_textbox.Text = stationery.reorder_quantity.ToString();
                    ui_quantityinstock_label.Text   = stationery.quantity_in_stock.ToString();
                    ui_pendingquantity_label.Text   = stationery.pending_quantity_to_distribute.ToString();
                    ui_uom_textbox.Text             = stationery.unit_of_measure.ToString();
                    ui_binnum_textbox.Text          = stationery.bin.ToString();

                    ui_firstsupplier_dropdown.DataSource      = suppliers;
                    ui_secondsupplier_dropdown.DataSource     = suppliers;
                    ui_thirdsupplier_dropdown.DataSource      = suppliers;
                    ui_firstsupplier_dropdown.DataTextField   = "supplier_name";
                    ui_firstsupplier_dropdown.DataValueField  = "id";
                    ui_secondsupplier_dropdown.DataTextField  = "supplier_name";
                    ui_secondsupplier_dropdown.DataValueField = "id";
                    ui_thirdsupplier_dropdown.DataTextField   = "supplier_name";
                    ui_thirdsupplier_dropdown.DataValueField  = "id";

                    ui_firstsupplier_dropdown.DataBind();
                    ui_secondsupplier_dropdown.DataBind();
                    ui_thirdsupplier_dropdown.DataBind();
                    ui_firstsupplier_dropdown.SelectedValue  = stationery.first_supplier.ToString();
                    ui_secondsupplier_dropdown.SelectedValue = stationery.second_supplier.ToString();
                    ui_thirdsupplier_dropdown.SelectedValue  = stationery.third_supplier.ToString();

                    ui_content_title_label.Text = stationery.stationery_name.ToString();
                }
            }
            else
            {
                String tmp_s1   = ui_firstsupplier_dropdown.SelectedValue;
                String tmp_s2   = ui_secondsupplier_dropdown.SelectedValue;
                String tmp_s3   = ui_thirdsupplier_dropdown.SelectedValue;
                String tmp_cate = ui_category_dropdown.SelectedValue;

                ui_category_dropdown.DataSource     = stationeryController.actionGetStationeryCategories();
                ui_category_dropdown.DataTextField  = "category_name";
                ui_category_dropdown.DataValueField = "id";
                ui_category_dropdown.DataBind();

                ui_firstsupplier_dropdown.DataSource      = suppliers;
                ui_secondsupplier_dropdown.DataSource     = suppliers;
                ui_thirdsupplier_dropdown.DataSource      = suppliers;
                ui_firstsupplier_dropdown.DataTextField   = "supplier_name";
                ui_firstsupplier_dropdown.DataValueField  = "id";
                ui_secondsupplier_dropdown.DataTextField  = "supplier_name";
                ui_secondsupplier_dropdown.DataValueField = "id";
                ui_thirdsupplier_dropdown.DataTextField   = "supplier_name";
                ui_thirdsupplier_dropdown.DataValueField  = "id";

                ui_firstsupplier_dropdown.DataBind();
                ui_secondsupplier_dropdown.DataBind();
                ui_thirdsupplier_dropdown.DataBind();

                ui_category_dropdown.SelectedValue       = tmp_cate;
                ui_firstsupplier_dropdown.SelectedValue  = tmp_s1;
                ui_secondsupplier_dropdown.SelectedValue = tmp_s2;
                ui_thirdsupplier_dropdown.SelectedValue  = tmp_s3;
            }
        }