Beispiel #1
0
        private void SaveButton_Click(object sender, EventArgs e)
        {
            int er = 0;

            ep.Clear();
            if (categoryComboBox.Text == "")
            {
                er++;
                ep.SetError(categoryComboBox, "Required");
            }
            if (companyComboBox.Text == "")
            {
                er++;
                ep.SetError(companyComboBox, "Required");
            }
            if (itemComboBox.Text == "")
            {
                er++;
                ep.SetError(itemComboBox, "Required");
            }
            if (stokInTextBox.Text == "")
            {
                er++;
                ep.SetError(stokInTextBox, "Required");
            }
            if (er > 0)
            {
                return;
            }

            Model.StockIn stockIn = new Model.StockIn();

            stockIn.CompanyId = Convert.ToInt64(companyComboBox.SelectedValue);

            stockIn.CategoryId        = Convert.ToInt64(categoryComboBox.SelectedValue);
            stockIn.ItemId            = Convert.ToInt64(itemComboBox.SelectedValue);
            stockIn.AvailableQuantity = Convert.ToInt32(stokInTextBox.Text);
            bool isAdded = _stockInManager.Add(stockIn);

            if (isAdded)
            {
                MessageBox.Show("Successfully Added. ");
                stokInTextBox.Clear();
            }
            else
            {
                MessageBox.Show("Sry! Added Failed.");
            }

            stockInItemDataGridView.DataSource = _stockInManager.StockInLoad(); // Load new StockIn Item
        }
        private void SaveButton_Click(object sender, EventArgs e)
        {
            if (stockQuantityTextBox.Text == "")
            {
                msgLabel.Text      = "Enter a Company";
                msgLabel.ForeColor = Color.Red;
                return;
            }
            _stockIn.ItemId  = Convert.ToInt64(itemComboBox.SelectedValue);
            _stockIn.StockIn = Convert.ToInt64(stockQuantityTextBox.Text);

            long availableQuantity = Convert.ToInt64(availableQuantituLabel.Text) + _stockIn.StockIn;
            bool isAdded           = _stockInManager.Add(_stockIn, availableQuantity);

            if (isAdded)
            {
                msgLabel.Text = $"Save stock Quantity: {stockQuantityTextBox.Text} successfully";
            }
        }
        private void SaveButton_Click(object sender, EventArgs e)
        {
            Model.StockIn stockIn = new Model.StockIn();

            stockIn.CampanyId = Convert.ToInt64(companyComboBox.SelectedValue);

            stockIn.CategoryId        = Convert.ToInt64(categoryComboBox.SelectedValue);
            stockIn.ItemId            = Convert.ToInt64(itemComboBox.SelectedValue);
            stockIn.AvailableQuantity = Convert.ToInt32(stokInTextBox.Text);
            bool isAdded = _stockInManager.Add(stockIn);

            if (isAdded)
            {
                MessageBox.Show("Successfully Added. ");
                stokInTextBox.Clear();
            }
            else
            {
                MessageBox.Show("Sry! Added Failed.");
            }
        }