Ejemplo n.º 1
0
        private string SaveByMethod(string method)
        {
            if (ViewState["itemVS"] == null)
            {
                GetCompany();

                return("Please add some item.");
            }
            else
            {
                ItemViewModels = (List <ItemViewModel>)ViewState["itemVS"];

                foreach (ItemViewModel itemView in ItemViewModels)
                {
                    StockOut stockOut = new StockOut();
                    stockOut.ItemId   = itemView.ItemId;
                    stockOut.Quantity = itemView.Quantity;
                    stockOut.Method   = method;
                    stockOut.Date     = DateTime.Today;

                    StockOutManager.Save(stockOut);
                    StockOutManager.Update(stockOut.ItemId, stockOut.Quantity);
                }

                ViewState.Clear();

                GetCompany();

                return("Saved Into " + method);
            }
        }
Ejemplo n.º 2
0
 public StockOutUi()
 {
     InitializeComponent();
     _stockOutManager = new StockOutManager();
     item             = new Item();
     listStockOut     = new List <StockOut>();
 }
Ejemplo n.º 3
0
 public ItemController()
 {
     companyManager  = new CompanyManager();
     categoryManager = new CategoryManager();
     itemManager     = new ItemManager();
     stockInManager  = new StockInManager();
     stockOutManager = new StockOutManager();
 }
Ejemplo n.º 4
0
        protected void itemDropDownList_OnSelectedIndexChanged(object sender, EventArgs e)
        {
            itemDropDownList.Items.Remove(itemDropDownList.Items.FindByText("Select Item"));
            Item = StockOutManager.GetItemById(Convert.ToInt32(itemDropDownList.SelectedValue));
            reorderLevelTextBox.Text      = Item.ReorderLevel.ToString();
            availableQuantityTextBox.Text = Item.Quantity.ToString();

            stockOutQuantityTextBox.Text = String.Empty;
        }
Ejemplo n.º 5
0
        private void GetCompany()
        {
            companyDropDownList.DataSource     = StockOutManager.GetAllCompanies();
            companyDropDownList.DataTextField  = "Name";
            companyDropDownList.DataValueField = "Id";
            companyDropDownList.DataBind();
            companyDropDownList.Items.Insert(0, new ListItem("Select Company", ""));

            itemDropDownList.Items.Clear();
            reorderLevelTextBox.Text      = String.Empty;
            availableQuantityTextBox.Text = String.Empty;
            stockOutQuantityTextBox.Text  = String.Empty;
        }
Ejemplo n.º 6
0
        protected void companyDropDownList_OnSelectedIndexChanged(object sender, EventArgs e)
        {
            companyDropDownList.Items.Remove(companyDropDownList.Items.FindByText("Select Company"));
            ItemViewModel.CompanyId         = Convert.ToInt32(companyDropDownList.SelectedValue);
            itemDropDownList.DataSource     = StockOutManager.GetItemsByCompany(ItemViewModel.CompanyId);
            itemDropDownList.DataTextField  = "Name";
            itemDropDownList.DataValueField = "Id";
            itemDropDownList.DataBind();
            itemDropDownList.Items.Insert(0, new ListItem("Select Item", ""));

            reorderLevelTextBox.Text      = String.Empty;
            availableQuantityTextBox.Text = String.Empty;
            stockOutQuantityTextBox.Text  = String.Empty;
        }
        protected void searchButton_OnClick(object sender, EventArgs e)
        {
            DateTime fromDate = Convert.ToDateTime(fromDateTextBox.Text);
            DateTime toDate   = Convert.ToDateTime(toDateTextBox.Text);

            if (fromDate <= toDate)
            {
                ItemViewModels = StockOutManager.GetItemByDate(fromDate, toDate);

                itemsGridView.DataSource = ItemViewModels;
                itemsGridView.DataBind();
            }
            else
            {
                outputLabel.Text = "From date can not be greter than To date.";
            }
        }
Ejemplo n.º 8
0
        protected void StockOut(string type)
        {
            if (ViewState["Data"] != null)
            {
                DataTable dttable = (DataTable)ViewState["Data"];
                for (int i = 0; i < dttable.Rows.Count; i++)
                {
                    //get data from gridview
                    Label  labelItem     = (Label)GridViewStockOutList.Rows[i].Cells[1].FindControl("ItemName");
                    string itemid        = ((Label)GridViewStockOutList.Rows[i].FindControl("idItemHiddenField")).Text;
                    string companyid     = ((Label)GridViewStockOutList.Rows[i].FindControl("idCompanyHiddenField")).Text;
                    Label  labelQuantity = (Label)GridViewStockOutList.Rows[i].Cells[4].FindControl("quantityName");

                    StockOut stockOutitem = new StockOut();
                    stockOutitem.Itemid   = Convert.ToInt32(itemid);
                    stockOutitem.Quantity = Convert.ToInt32(labelQuantity.Text);
                    stockOutitem.ItemType = type;

                    StockOutManager stockoutmanager = new StockOutManager();
                    stockoutmanager.SaveStockOutItem(stockOutitem);

                    Item updateItem = new Item();
                    updateItem.ItemName          = labelItem.Text;
                    updateItem.CompanyID         = Convert.ToInt32(companyid);
                    updateItem.AvailableQuantity = Convert.ToInt32(labelQuantity.Text);

                    ItemManager updatAvailablequantity = new ItemManager();
                    LabelMessage.Visible = true;

                    LabelMessage.Text = updatAvailablequantity.UpdateAvailablity(updateItem);
                }
                //clear gridview after inserting
                dttable.Clear();
                ViewState["Data"] = dttable;
                GridViewStockOutList.DataSource = dttable;
                GridViewStockOutList.DataBind();
            }
            GridViewStockOutList.DataSource = null;
            GridViewStockOutList.DataBind();

            ButtonSellId.Visible = false;
            DamageButton.Visible = false;
            LostButton.Visible   = false;
        }
Ejemplo n.º 9
0
 public StockOutUI()
 {
     StockOutManager = new StockOutManager();
     ItemViewModels  = new List <ItemViewModel>();
     ItemViewModel   = new ItemViewModel();
 }
Ejemplo n.º 10
0
 public SearchBetweenDateUI()
 {
     stockInfoView   = new GetStockInfoView();
     stockOutManager = new StockOutManager();
 }
 public HomeController()
 {
     stockOutManager = new StockOutManager();
     itemManager     = new ItemManager();
     homeManager     = new HomeManager();
 }
 public ViewSellsBetweenDatesController()
 {
     stockOutManager = new StockOutManager();
 }
Ejemplo n.º 13
0
 public StockOutUI()
 {
     itemManager     = new ItemManager();
     dictionary      = new Dictionary <int, string>();
     stockOutManager = new StockOutManager();
 }
Ejemplo n.º 14
0
 public StockOutController()
 {
     CompanyManager  = new CompanyManager();
     ItemManager     = new ItemManager();
     StockOutManager = new StockOutManager();
 }
Ejemplo n.º 15
0
 public StockOutUI()
 {
     stockInManager  = new StockInManager();
     companyManager  = new CompanyManager();
     stockOutManager = new StockOutManager();
 }
Ejemplo n.º 16
0
 public StockOutSetupUI()
 {
     stockOutManager = new StockOutManager();
     itemManager     = new ItemManager();
     baseGetway      = new BaseGetway();
 }
 public SearchByDateUI()
 {
     StockOutManager = new StockOutManager();
 }
        private void addButton_Click(object sender, EventArgs e)
        {
            try
            {
                stockOutObj.Company           = companyStockOutComboBox.Text;
                stockOutObj.Category          = categoryStockOutComboBox.Text;
                stockOutObj.Item              = itemStockOutComboBox.Text;
                stockOutObj.ReorderLabel      = Convert.ToInt32(reorderStockOutLavelTextBox.Text);
                stockOutObj.AvailableQuantity = Convert.ToInt32(availableQuantityStockOutTextBox.Text);
                stockOutObj.StockOutQuantity  = Convert.ToInt32(stockOutQuantityTextBox.Text);
            }
            catch (Exception exception)
            {
                MessageBox.Show(exception.Message);
                return;
            }

            StockOutManager stoutMangObj = new StockOutManager();
            string          stockOutInfo = stoutMangObj.StockOutInfo(stockOutObj);

            if (stockOutInfo != "")
            {
                MessageBox.Show(stockOutInfo);
                return;
            }



            for (int i = 0; i < stockOutDataGridView.Rows.Count; i++)
            {
                if (Convert.ToString(stockOutDataGridView.Rows[i].Cells[1].Value) == stockOutObj.Item)
                {
                    if (stockOutObj.AvailableQuantity == 10)
                    {
                        MessageBox.Show("Your current amount is " + stockOutObj.AvailableQuantity + " stock in fast!");
                    }
                    if (stockOutObj.AvailableQuantity >= stockOutObj.StockOutQuantity)
                    {
                        stockOutDataGridView.Rows[i].Cells[4].Value = (Convert.ToInt32(stockOutDataGridView.Rows[i].Cells[4].Value.ToString()) + stockOutObj.StockOutQuantity);
                        availableQuantityStockOutTextBox.Text       = (stockOutObj.AvailableQuantity - stockOutObj.StockOutQuantity).ToString();
                    }
                    else
                    {
                        MessageBox.Show("No sufficient amount. Your current amount is " + stockOutObj.AvailableQuantity);
                    }
                    return;
                }
            }

            if (stockOutObj.AvailableQuantity == 10)
            {
                MessageBox.Show("Your current amount is " + stockOutObj.AvailableQuantity + " stock in fast!");
            }
            if (stockOutObj.AvailableQuantity >= stockOutObj.StockOutQuantity)
            {
                stockOutDataGridView.Rows.Add();
                int row = stockOutDataGridView.Rows.Count - 2;
                stockOutDataGridView["sl", row].Value       = row + 1;
                stockOutDataGridView["item", row].Value     = stockOutObj.Item;
                stockOutDataGridView["category", row].Value = stockOutObj.Category;
                stockOutDataGridView["company", row].Value  = stockOutObj.Company;
                stockOutDataGridView["quantity", row].Value = stockOutObj.StockOutQuantity;

                availableQuantityStockOutTextBox.Text = (stockOutObj.AvailableQuantity - stockOutObj.StockOutQuantity).ToString();
            }
            else
            {
                MessageBox.Show("No sufficient amount. Your current amount is " + stockOutObj.AvailableQuantity);
            }
        }
 public StockOutUI()
 {
     stockOutManager = new StockOutManager();
 }