Exemplo n.º 1
0
 private void btnSubmit_Click(object sender, EventArgs e)
 {
     if (String.IsNullOrEmpty(cboModel.Text))
     {
         MessageBox.Show(Filepath.ModelField);
         cboModel.Focus();
     }
     else if (String.IsNullOrEmpty(txtInventoryCode.Text))
     {
         MessageBox.Show(Filepath.CodeField);
         txtInventoryCode.Focus();
     }
     else if (String.IsNullOrEmpty(txtInventoryQuantity.Text))
     {
         MessageBox.Show(Filepath.QuantityField);
         txtInventoryQuantity.Focus();
     }
     else
     {
         ProductUI p1       = new ProductUI();
         string    modelNo  = cboModel.Text;
         int       code     = Convert.ToInt32(txtInventoryCode.Text);
         int       quantity = Convert.ToInt32(txtInventoryQuantity.Text);
         //var addproduct = inventory.AddExistingProduct(modelNo, code, quantity);
         p1.AddQuantity(modelNo, code, quantity);
         Reset();
     }
 }
Exemplo n.º 2
0
        private void btnProduct_Click(object sender, EventArgs e)
        {
            ProductUI product = new ProductUI();

            product.ShowDialog();
        }
Exemplo n.º 3
0
        private void btnSubmitSales_Click(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtCusName.Text))
            {
                MessageBox.Show(Filepath.CustomerField);
                txtCusName.Focus();
            }
            else if (String.IsNullOrEmpty(txtPhoneNo.Text))
            {
                MessageBox.Show(Filepath.PhoneField);
                txtPhoneNo.Focus();
            }
            else if (String.IsNullOrEmpty(txtSalesCode.Text))
            {
                MessageBox.Show(Filepath.CodeField);
                txtSalesCode.Focus();
            }
            else if (String.IsNullOrEmpty(txtSalesQuantity.Text))
            {
                MessageBox.Show(Filepath.QuantityField);
                txtSalesQuantity.Focus();
            }
            else if (String.IsNullOrEmpty(txtPrice.Text))
            {
                MessageBox.Show(Filepath.PriceField);
                txtPrice.Focus();
            }
            else if (String.IsNullOrEmpty(txtWarranty.Text))
            {
                MessageBox.Show(Filepath.WarrantyField);
                txtWarranty.Focus();
            }
            else
            {
                if (!File.Exists(Filepath.salesPath))
                {
                    p.slist1.Add(new Sales
                    {
                        CustomerName    = txtCusName.Text,
                        CustomerPhoneNo = Convert.ToInt64(txtPhoneNo.Text),
                        ModelName       = cboModels.Text,
                        Code            = Convert.ToInt32(txtSalesCode.Text),
                        Warranty        = Convert.ToInt32(txtWarranty.Text),
                        Price           = Convert.ToInt32(txtPrice.Text),
                        Quantity        = Convert.ToInt32(txtSalesQuantity.Text),
                        Date            = dateTimePicker1.Value
                    });
                }
                else
                {
                    deSerialize.SalesDeserialize(ref p);
                    p.slist1.Add(new Sales
                    {
                        CustomerName    = txtCusName.Text,
                        CustomerPhoneNo = Convert.ToInt64(txtPhoneNo.Text),
                        ModelName       = cboModels.Text,
                        Code            = Convert.ToInt32(txtSalesCode.Text),
                        Warranty        = Convert.ToInt32(txtWarranty.Text),
                        Price           = Convert.ToInt32(txtPrice.Text),
                        Quantity        = Convert.ToInt32(txtSalesQuantity.Text),
                        Date            = dateTimePicker1.Value
                    });
                }
                ProductUI p1          = new ProductUI();
                var       modelNumber = cboModels.Text;
                int       code        = Convert.ToInt32(txtSalesCode.Text);
                int       quantity    = Convert.ToInt32(txtSalesQuantity.Text);
                var       result      = p1.UpdateQuantity(modelNumber, code, quantity);

                if (result == false)
                {
                    serialize.SaleSerialize(ref p);
                }
                Reset();
            }
        }