Exemplo n.º 1
0
        /*protected void loadEmpIDS()
        {
            this.cbManagerID.Items.Add("");
            object[] getIds = this.dataModel.getIDItemArray("HR.Products",0,1);
            foreach (object eachItem in getIds)
            {
                this.cbManagerID.Items.Add(eachItem.ToString());
            }
        }*/
        protected void loadSuppData()
        {
            try
            {
                List<Product> getFromDB = this.dataModel.getItems("productid=" + this.proID);

                Product dataObj = getFromDB[0];
                this.txtName.Text = dataObj.ProductName;
                this.txtUnitPrice.Text = dataObj.UnitPrice.ToString();
                this.checkDiscontinue.Checked = dataObj.Discontinued;

                ProductModel.IdItem tmp = new ProductModel.IdItem();
                tmp.Id = dataObj.SupplierID;
                int index = this.suppList.IndexOf(tmp);
                this.cbSupplierID.SelectedIndex = index;

                tmp.Id = dataObj.CategoryID;
                index = this.catList.IndexOf(tmp);
                this.cbCatID.SelectedIndex = index;
            }
            catch (Exception ex)
            {
                Session["current_error"] = ex.Message;
                Response.Redirect("serverError.aspx");
            }
        }
Exemplo n.º 2
0
        protected void doChangeSelectedItem()
        {
            if (this.gvProducts.SelectedRows.Count > 0)
            {
                Product get = new Product();
                get.ProductID = int.Parse(this.gvProducts.SelectedRows[0].Cells[0].Value.ToString());
                Product selectedItem = this.dataModel.Data[this.dataModel.Data.IndexOf(get)];
                this.txtproID.Text = selectedItem.ProductID.ToString();

                this.txtproID.Text = selectedItem.ProductID.ToString();
                this.txtproName.Text = selectedItem.ProductName;
                ProductModel.IdItem tmp = new ProductModel.IdItem();
                tmp.Id = selectedItem.CategoryID;
                this.cbxCaID.SelectedIndex = this.cbxCaID.Items.IndexOf(tmp);
                tmp.Id = selectedItem.SupplierID;
                this.cbxSupID.SelectedIndex = this.cbxSupID.Items.IndexOf(tmp);

                this.txtUnitprice.Text = selectedItem.UnitPrice.ToString();
                this.cbDiscontinued.Checked = selectedItem.Discontinued;

            }
            else
            {
                this.txtproID.Text = "";
            }
        }