public void RemoveFromAllPkg()
 {
     PackageDB.removePSFromAllPkg(this);
 }
Esempio n. 2
0
 // delete this package
 public void Delete()
 {
     PackageDB.DeletePackage(this);
 }
 // add this product to a package
 public void AddToPackage(int packageId)
 {
     PackageDB.AddPSByID(packageId, ProductSupplierId);
 }
Esempio n. 4
0
 // removes products for this package
 public void RemoveProducts()
 {
     PackageDB.RemoveAllPSForPkg(PackageId);
 }
Esempio n. 5
0
 // update this package
 public void Update()
 {
     PackageDB.UpdatePackage(this);
 }
Esempio n. 6
0
 // add this package to database
 public int AddPackage()
 {
     return(PackageDB.AddPackage(this));
 }
Esempio n. 7
0
 // get list of available suppliers
 public List <Product_Supplier> GetNotAddedPS()
 {
     return(PackageDB.GetNotAddedPS(PackageId));
 }
Esempio n. 8
0
        // reload package list from database and refresh buttons for each package
        private void Reload()
        {
            // remove buttons for old packages
            pnlPackages.Controls.Clear();

            count       = 0;
            packageList = PackageDB.GetPackages();
            // draw a button for each package in list
            foreach (var package in packageList)
            {
                int    startX = pnlPackages.Location.X;
                int    startY = pnlPackages.Location.Y;
                Button button = new Button();
                button.Location = new Point(45 + startX, 30 * count + startY - 140);
                button.Size     = new Size(200, 25);
                button.TabIndex = count;
                button.Cursor   = Cursors.Hand;
                button.Text     = package.PkgName;
                button.Tag      = count.ToString();
                button.Name     = package.PackageId.ToString();
                button.Click   += Package_Button_Click;

                // set color of expired, current, and available packages
                if (package.PkgEndDate < DateTime.Today)
                {
                    button.FlatStyle = FlatStyle.Flat;
                    button.FlatAppearance.BorderColor        = Color.FromArgb(244, 67, 54);
                    button.FlatAppearance.MouseDownBackColor = Color.FromArgb(244, 67, 54);
                    button.BackColor = Color.FromArgb(211, 47, 47);
                    button.ForeColor = Color.WhiteSmoke;
                }
                else if (package.PkgStartDate < DateTime.Today)
                {
                    button.FlatStyle = FlatStyle.Flat;
                    button.FlatAppearance.MouseDownBackColor = Color.FromArgb(255, 87, 34);
                    button.FlatAppearance.BorderColor        = Color.FromArgb(255, 87, 34);
                    button.ForeColor = Color.WhiteSmoke;
                    button.BackColor = Color.FromArgb(230, 74, 25);
                }
                else
                {
                    button.FlatStyle = FlatStyle.Flat;
                    button.FlatAppearance.MouseDownBackColor = Color.ForestGreen;
                    button.FlatAppearance.BorderColor        = Color.ForestGreen;
                    button.ForeColor = Color.WhiteSmoke;
                    button.BackColor = Color.FromArgb(76, 175, 80);
                }

                pnlPackages.Controls.Add(button);
                count++;
            }

            // disable update and delete buttons
            btnEditPackage.Enabled   = false;
            btnDeletePackage.Enabled = false;

            // reset current package and PS list
            currentPackage = null;
            currentPSList  = null;

            // clear form details
            tbPkgName.Clear();
            tbPkgStartDate.Clear();
            tbPkgEndDate.Clear();
            tbPkgDesc.Clear();
            tbPkgBasePrice.Clear();
            tbPkgAgencyCommission.Clear();
            lvProducts.Items.Clear();
        }