示例#1
0
 // Load datbase to view without change in category and brand
 private void onLoad()
 {
     importTBBindingSource.DataSource = ImportBUS.getAll();
     productBindingSource.DataSource  = ProductBUS.getAll();
     importBindingSource.DataSource   = new Import();
     dgvImport.ClearSelection();
 }
示例#2
0
 private void btnSearchProduct_Click(object sender, EventArgs e)
 {
     if (cboProduct.SelectedValue != null)
     {
         importTBBindingSource.DataSource =
             ImportBUS.searchByProduct((int)cboBrand.SelectedValue);
     }
 }
示例#3
0
 // Load database to view
 private void initLoad()
 {
     importTBBindingSource.DataSource = ImportBUS.getAll();
     importBindingSource.DataSource   = new Import();
     categoryBindingSource.DataSource = CategoryBUS.getAll();
     brandBindingSource.DataSource    = BrandBUS.getAll();
     productBindingSource.DataSource  = ProductBUS.getAll();
     dgvImport.ClearSelection();
 }
示例#4
0
        private void btnImport_Clicked(object sender, RoutedEventArgs e)
        {
            if (txtAmount.Text.Count() == 0 || btnProduct.Content.ToString().Count() == 0 || btnSuplier.Content.ToString().Count() == 0)
            {
                lblNotice.Content    = "Please fill all information.";
                lblNotice.Visibility = Visibility.Visible;
                return;
            }


            int  amount;
            bool isNumeric = Int32.TryParse(txtAmount.Text, out amount);

            if (!isNumeric)
            {
                lblNotice.Content    = "Amount isn't number!";
                lblNotice.Visibility = Visibility.Visible;
                return;
            }



            ProductBUS bus    = new ProductBUS();
            ProductDTO result = bus.LoadOneProduct(Global.IDProduct);

            result.IvenNum = result.IvenNum + amount;
            bus.UpdateProduct(result);


            ImportDTO import = new ImportDTO();

            import.Product   = Int32.Parse(btnProduct.Content.ToString());
            import.Suplier   = Int32.Parse(btnSuplier.Content.ToString());
            import.Amount    = amount;
            import.Total     = amount * result.InputPrice;
            import.DateInput = lblDate.Content.ToString();

            ImportBUS importBUS = new ImportBUS();

            importBUS.AddNewImport(import);

            this.Close();
        }
示例#5
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     ImportBUS.delete(importBindingSource.Current as Import);
     onLoad();
 }
示例#6
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     ImportBUS.insert(importBindingSource.Current as Import);
     onLoad();
 }