Example #1
0
 private void btnNextComp_Click(object sender, EventArgs e)
 {
     if (ValidateProductInfo())
     {
         ContractProducts cp = new ContractProducts(contract, product);
         if (!products.Contains(cp))
         {
             products.Add(cp);
             List <SystemComponents> comps = new SystemComponents(product).GetSystemComponents();
             foreach (SystemComponents item in comps)
             {
                 if (item.Status == "Discontinued")
                 {
                     comps.Remove(item);
                 }
             }
             compBind.DataSource     = comps;
             lbComponents.DataSource = compBind;
             pnlProducts.Hide();
             pnlComponents.Show();
         }
         else
         {
             CustomExceptions error = new CustomExceptions("This product has already been added to the contract.", "Duplicate Product");
         }
     }
     else
     {
         CustomExceptions error = new CustomExceptions("Please select a product before you continue.", "No product selected");
     }
 }
Example #2
0
 private void btnAddComp_Click(object sender, EventArgs e)
 {
     if (ValidateComponentInfo())
     {
         bool             exist = false;
         SystemComponents sc    = new SystemComponents("", p, redCompDesc.Text, "Active", txtCompManufacturer.Text, txtCompModel.Text);
         foreach (SystemComponents item in addComponents)
         {
             if ((item.Model == sc.Model) && (item.Manufacturer == sc.Manufacturer))
             {
                 item.Description = sc.Description;
                 exist            = true;
                 break;
             }
         }
         if (!exist)
         {
             addComponents.Add(sc);
             lbComponents.Items.Add(sc);
             txtCompModel.Clear();
             txtCompManufacturer.Clear();
             redCompDesc.Clear();
         }
     }
     else
     {
         CustomExceptions error = new CustomExceptions("Please fill in all required fields.", "Something went wrong..");
     }
 }
Example #3
0
        private void lbComponents_SelectedIndexChanged(object sender, EventArgs e)
        {
            txtCompSerial.Clear();
            comp = (SystemComponents)lbComponents.SelectedItem;
            List <Configurations> confs = new Configurations(comp).GetAllConfigurations();

            foreach (Configurations item in confs)
            {
                if (item.Status == "Discontinued")
                {
                    confs.Remove(item);
                }
            }
            configBind.DataSource = confs;
            cmbConf.DataSource    = configBind;
            txtConfName.DataBindings.Clear();
            txtConfName.DataBindings.Add("Text", configBind, "Name");
            redConfDesc.DataBindings.Clear();
            redConfDesc.DataBindings.Add("Text", configBind, "Description");
            txtConfAddCost.DataBindings.Clear();
            txtConfAddCost.DataBindings.Add("Text", configBind, "AddCost");
            txtCompSerial.Focus();

            foreach (ContractConfigurations item in configs)
            {
                if (item.ContractConfigurations_Configuration.Configuration_Component == (SystemComponents)compBind.Current)
                {
                    cmbConf.SelectedItem = item.ContractConfigurations_Configuration;
                    txtCompSerial.Text   = item.CompSerial;
                    break;
                }
            }
        }
Example #4
0
        private void lbComponents_SelectedIndexChanged(object sender, EventArgs e)
        {
            SystemComponents sc = (SystemComponents)lbComponents.SelectedItem;

            txtCompModel.Text        = sc.Model;
            txtCompManufacturer.Text = sc.Manufacturer;
            redCompDesc.Text         = sc.Description;
        }
Example #5
0
        private bool ValidateComponentInfo(SystemComponents sc)
        {
            bool valid = true;

            if (sc.Description.Length == 0)
            {
                valid = false;
            }
            if (sc.Status == "")
            {
                valid = false;
            }
            return(valid);
        }
Example #6
0
        private void btnPrintContract_Click(object sender, EventArgs e)
        {
            Client          client    = (Client)clientBind.Current;
            List <Contract> contracts = new Contract().GetAllContracts(client.ClientIdentifier);

            foreach (Contract item in contracts)
            {
                List <Product>          products = new List <Product>();
                List <SystemComponents> comps    = new List <SystemComponents>();
                List <Configurations>   confs    = new List <Configurations>();

                List <ContractProducts> cp = new ContractProducts(item, new Product()).GetContractProducts();
                foreach (ContractProducts cproduct in cp)
                {
                    products.Add(cproduct.ContractProducts_Product);
                }

                foreach (Product p in products)
                {
                    List <SystemComponents> comp = new SystemComponents(p).GetSystemComponents();
                    foreach (SystemComponents c in comp)
                    {
                        comps.Add(c);
                    }
                }


                List <ContractConfigurations> cc = new ContractConfigurations(item).GetContractConfigurations();
                foreach (ContractConfigurations configuration in cc)
                {
                    confs.Add(configuration.ContractConfigurations_Configuration);
                }


                PdfWriter.CreateClientContractPdf(client, item, products, comps, confs);
            }
        }
Example #7
0
 public bool HasNone(SystemComponents systemComponents)
 {
     return(!systemComponents.Any(fc => Components.Any(c => c.GetType() == fc)));
 }
Example #8
0
 public bool HasAll(SystemComponents systemComponents)
 {
     return(systemComponents.All(sc => Components.Any(c => c.GetType() == sc)));
 }