コード例 #1
0
ファイル: StockOutUI.aspx.cs プロジェクト: SMXeem/supershop
        protected void Page_Load(object sender, EventArgs e)
        {
            date = DateTime.Now.ToString("yyyy/MM/dd");

            if (!IsPostBack)
            {
                List <Company> companies = aShopManager.GetAllCompanies();
                companyDropDownList.DataSource     = companies;
                companyDropDownList.DataTextField  = "Name";
                companyDropDownList.DataValueField = "SL";
                companyDropDownList.DataBind();

                companyId = Convert.ToInt32(companyDropDownList.SelectedValue);
                List <Item> item = aShopManager.GetAllItem(companyId);
                itemDropDownList.DataSource     = item;
                itemDropDownList.DataTextField  = "ItemName";
                itemDropDownList.DataValueField = "ID";
                itemDropDownList.DataBind();

                aItem  = new Item();
                itemID = Convert.ToInt32(itemDropDownList.SelectedValue);
                aItem  = aShopManager.GetItemDetails(itemID);
                availableQTextBox.Text = aItem.AvilableQuantity.ToString();
                reorderTextBox.Text    = aItem.ReorderLevel.ToString();

                sellButton.Enabled   = false;
                damageButton.Enabled = false;
                lostButton.Enabled   = false;

                List <StockOutItem> stockOutItems = new List <StockOutItem>();
                Session["items"]            = stockOutItems;
                StockOutGridView.DataSource = stockOutItems;
                StockOutGridView.DataBind();
            }
        }
コード例 #2
0
ファイル: StockOutUI.aspx.cs プロジェクト: SMXeem/supershop
 protected void damageButton_Click(object sender, EventArgs e)
 {
     if (StockOutGridView != null)
     {
         List <StockOutItem> stockOutItems = (List <StockOutItem>)Session["items"];
         foreach (StockOutItem items in stockOutItems)
         {
             aStockOut                  = new StockOut();
             aStockOut.ItemName         = items.ItemName;
             aStockOut.companyName      = items.companyName;
             aStockOut.Quantity         = Convert.ToInt32(items.Quantity);
             aStockOut.StockOutCategory = "damage";
             aStockOut.Date             = date;
             aShopManager.StockOutData(aStockOut);
         }
         stockOutQTextBox.Text       = "0";
         StockOutGridView.DataSource = null;
         StockOutGridView.DataBind();
     }
 }
コード例 #3
0
ファイル: StockOutUI.aspx.cs プロジェクト: SMXeem/supershop
        //add button to insert into gridview
        protected void addButton_Click(object sender, EventArgs e)
        {
            List <StockOutItem> stockOutItems = new List <StockOutItem>();

            if (Session["items"] != null)
            {
                stockOutItems = (List <StockOutItem>)Session["items"];
            }
            StockOutItem stockItem = new StockOutItem();

            stockItem.ItemName    = itemDropDownList.SelectedItem.Text;
            stockItem.companyName = companyDropDownList.SelectedItem.Text;
            stockItem.Quantity    = Convert.ToInt32(stockOutQTextBox.Text);
            stockOutItems.Add(stockItem);
            StockOutGridView.DataSource = stockOutItems;
            StockOutGridView.DataBind();
            Session["items"] = stockOutItems;

            stockOutQTextBox.Text = "";
            sellButton.Enabled    = true;
            damageButton.Enabled  = true;
            lostButton.Enabled    = true;
        }