예제 #1
0
 private void UpdateStackOut(string action)
 {
     stockOut      = new StockOut();
     stockOut.Date = dateTimePicker.Value.ToString("yyyy-MM-dd");
     foreach (DataGridViewRow row in stockOutDataGridView.Rows)
     {
         stockOut.Quantity = Convert.ToInt32(row.Cells["quantityDataGridViewTextBoxColumn"].Value.ToString());
         stockOut.ItemID   = Convert.ToInt32(row.Cells["itemIDDataGridViewTextBoxColumn"].Value.ToString());
         stockOut.Action   = action;
         item.ID           = stockOut.ItemID;
         dataTable         = _stockOutManager.GetItem(item);
         int quantity = Convert.ToInt32(dataTable.Rows[0]["AvailableQuantity"]);
         quantity -= stockOut.Quantity;
         item.AvailableQuantity = quantity;
         _stockOutManager.UpdateItem(item);
         int isUpdated = 0;
         isUpdated = _stockOutManager.InsertStockOut(stockOut);
         if (isUpdated > 0)
         {
             messageLabel.Text = "Item: " + itemComboBox.Text + " Saved";
         }
     }
     listStockOut = new List <StockOut>();
     stockOutDataGridView.DataSource = null;
     stockOutDataGridView.DataSource = listStockOut;
 }
예제 #2
0
        private void stockOutToolStripMenuItem_Click(object sender, EventArgs e)
        {
            StockOut stockOut = new StockOut();

            stockOut.ShowDialog();
        }
예제 #3
0
        private void button5_Click(object sender, EventArgs e)
        {
            StockOut stockOut = new StockOut();

            stockOut.ShowDialog();
        }
예제 #4
0
        private void AddButton_Click(object sender, EventArgs e)
        {
            messageLabel.Text = "";
            if (companyComboBox.Text.Equals("-Select-") || companyComboBox.Text == "")
            {
                messageLabel.Text = "Select Company";
                return;
            }
            if (categoryComboBox.Text.Equals("-Select-") || categoryComboBox.Text == "")
            {
                messageLabel.Text = "Select Category";
                return;
            }
            if (itemComboBox.Text.Equals("-Select-") || itemComboBox.Text == "")
            {
                messageLabel.Text = "Select Category";
                return;
            }
            stockOut          = new StockOut();
            messageLabel.Text = "";
            //Stockout Quantity textfield checking
            if (String.IsNullOrEmpty(stockOutQuantityTextBox.Text))
            {
                messageLabel.Text = "Enter Stock Out Quantity";
                return;
            }
            if (System.Text.RegularExpressions.Regex.IsMatch(stockOutQuantityTextBox.Text, "[^0-9]"))
            {
                messageLabel.Text = "Enter Numeric Digits";
                return;
            }
            //avaiability checking
            int quantityOut       = Convert.ToInt32(stockOutQuantityTextBox.Text);
            int availableQuantity = Convert.ToInt32(availableQuantityTextBox.Text);
            int reorderLevel      = Convert.ToInt32(reorderLevelTextBox.Text);

            if (quantityOut > availableQuantity)
            {
                messageLabel.Text = "No Product as Your order";
                return;
            }
            if ((availableQuantity - quantityOut) <= reorderLevel)
            {
                messageLabel.Text = "Item is Under reorderLevel";
            }
            stockOut.ItemName    = itemComboBox.Text;
            stockOut.CompanyName = companyComboBox.Text;
            stockOut.Quantity    = Convert.ToInt32(stockOutQuantityTextBox.Text);
            item.Name            = itemComboBox.Text;
            item.CategoryID      = Convert.ToInt32(categoryComboBox.SelectedValue);
            item.CompanyID       = Convert.ToInt32(companyComboBox.SelectedValue);
            dataTable            = _stockOutManager.GetAvailableQuantityAndReorderLevel(item);
            stockOut.ItemID      = Convert.ToInt32(dataTable.Rows[0]["ID"].ToString());
            listStockOut.Add(stockOut);
            stockOutDataGridView.DataSource = null;
            stockOutDataGridView.DataSource = listStockOut;
            //Adding SI column
            foreach (DataGridViewRow row in stockOutDataGridView.Rows)
            {
                row.Cells["SL"].Value = (row.Index + 1).ToString();
            }

            //Preview
            companyComboBox.Text          = "-Select-";
            categoryComboBox.Text         = "-Select-";
            itemComboBox.Text             = "-Select-";
            reorderLevelTextBox.Text      = "<View>";
            availableQuantityTextBox.Text = "<View>";
            stockOutQuantityTextBox.Text  = "";
        }