Exemple #1
0
 /// <summary>
 /// Update All List of Infos
 /// </summary>
 private void UpdateAllInfos()
 {
     AllPackages       = PackagesDB.GetPackages();
     AllProducts       = ProductsDB.GetProducts();
     AllSuppliers      = SuppliersDB.GetSuppliers();
     ProSupLinkages    = ProSupDB.GetProSups();
     PacProSupLinkages = PacProSupDB.GetPacProSup();
 }
Exemple #2
0
        private void AddProSupConfirmBtn_Click(object sender, EventArgs e)
        {
            bool   existed    = false;
            string statusTest = "Failed";

            UpdateAllInfos();
            int  inputPackageID  = Convert.ToInt32(packageIdComboBox.SelectedValue);
            int  inputProductID  = Convert.ToInt32(ProductAddComboB.SelectedValue);
            long inputSupplierID = Convert.ToInt64(SupplierAddComboB.SelectedValue);

            foreach (PacProSup pps in PacProSupLinkages)
            {
                if (pps.PackageId == inputPackageID && pps.ProductId == inputProductID &&
                    pps.SupplierId == inputSupplierID)
                {
                    existed = true;
                }
            }

            if (!existed)
            {
                PacProSup newPPS = new PacProSup();
                newPPS.PackageId  = inputPackageID;
                newPPS.ProductId  = inputProductID;
                newPPS.SupplierId = inputSupplierID;


                if (PacProSupDB.AddPacProSup(newPPS))
                {
                    statusTest = "Adding Successful !";
                    UpdateAllInfos();
                    BindPackages();
                    DisplayPacInfo(packageIdComboBox);
                    FilterPacProSup(packageIdComboBox);
                    AddProSupCancel.Text = "Close";
                }
            }
            else
            {
                statusTest = "That is already Existed for the current package !";
            }


            MessageBox.Show(statusTest, "Status");
        }