Пример #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!User.Identity.IsAuthenticated)  //if not logged in
     {
         Response.Redirect("/");
     }
     if (String.IsNullOrEmpty(Request.QueryString["ID"]))
     {
         Response.Redirect("/Inventory");  //no id passed in
     }
     try
     {
         dsInventory.Clear();
         daInventory.Fill(dsInventory.Inventory);
         daInvLookUp.Fill(dsInventory.InventoryLookUp);
         int     id     = Convert.ToInt32(Request.QueryString["ID"]);
         DataRow record = dsInventory.InventoryLookUp.FindByid(id); // Find the requested record
         lblInvName.Text  = record[4].ToString();
         lblInvQty.Text   = record[1].ToString();
         lblInvSize.Text  = record[2].ToString();
         lblInvBrand.Text = record[5].ToString();
         lblInvPrice.Text = Convert.ToDecimal(record[3]).ToString("C2");
     }
     catch (Exception ex)
     {
         lblMessage.Text = "Failed to load data";
     }
 }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!User.Identity.IsAuthenticated)  //if not logged in
            {
                Response.Redirect("/");
            }

            if (String.IsNullOrEmpty(Request.QueryString["ID"]))
            {
                Response.Redirect("/Inventory");
            }

            try
            {
                dsInventory.Clear();
                daInventory.Fill(dsInventory.Inventory);
                daInvLookUp.Fill(dsInventory.InventoryLookUp);
                daProduct.Fill(dsInventory.Product);
            }
            catch { }

            if (IsPostBack)
            {
                return;
            }

            try
            {
                id = Convert.ToInt32(Request.QueryString["ID"]);
                DataRow ServiceOrder = dsInventory.InventoryLookUp.FindByid(id); // Find the related Record and fill the fields in the page with the data

                txtDescription.Text = ServiceOrder.ItemArray[6].ToString();
                txtQuantity.Text    = ServiceOrder.ItemArray[1].ToString();
                txtPrice.Text       = ServiceOrder.ItemArray[3].ToString();
                txtBrand.Text       = ServiceOrder.ItemArray[5].ToString();

                txtSize.Text = ServiceOrder.ItemArray[2].ToString();

                ddlMeasures.SelectedValue = ServiceOrder.ItemArray[8].ToString();
                ddlProducts.SelectedValue = ServiceOrder.ItemArray[0].ToString();
            }
            catch (Exception)
            {
                lblMessage.Text    = "Unable to load data";
                lblMessage.Visible = true;
            }
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!User.Identity.IsAuthenticated)  //if not logged in
            {
                Response.Redirect("/");
            }

            try
            {
                dsInventory.Clear();
                daInventory.Fill(dsInventory.Inventory);
                daInvLookUp.Fill(dsInventory.InventoryLookUp);
            }
            catch (Exception ex)
            {
                lblMessage.Text = "Failed to load data.";
                return;
            }

            rows = dsInventory.InventoryLookUp.Select();
            DisplayTable();
        }