Esempio n. 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();
 }
Esempio n. 2
0
        private void EditProSupSaveBtn_Click(object sender, EventArgs e)
        {
            string operationStatus = "Failed to Update Product and Supplier . Try Again";
            bool   existed         = false;
            int    inputProductID  = Convert.ToInt32(EditProCB.SelectedValue);
            long   inputSupplierID = Convert.ToInt64(EditSupCB.SelectedValue);

            foreach (ProSup pps in ProSupLinkages)
            {
                if (pps.ProductId == inputProductID &&
                    pps.SupplierId == inputSupplierID)
                {
                    existed = true;
                }
            }

            if (!existed)
            {
                ProSup inputProSup = new ProSup();
                inputProSup.ProductSupplierId = selectedProductSupplierId;
                inputProSup.ProductId         = inputProductID;
                inputProSup.SupplierId        = inputSupplierID;
                if (ProSupDB.UpdateProSup(inputProSup))
                {
                    operationStatus = "Successfully updated product and supplier for the package !";
                    UpdateAllInfos();
                    BindPackages();
                    DisplayPacInfo(packageIdComboBox);
                    FilterPacProSup(packageIdComboBox);
                    EditProSupCancelBtn.Text = "Close";
                }
            }
            else
            {
                operationStatus = "This pair of product and supplier is already existed for this package.";
            }

            MessageBox.Show(operationStatus, "Status");
            GridViewProSupEdit = false;
        }