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"); } }
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.."); } }
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; } } }
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; }
private bool ValidateComponentInfo(SystemComponents sc) { bool valid = true; if (sc.Description.Length == 0) { valid = false; } if (sc.Status == "") { valid = false; } return(valid); }
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); } }
public bool HasNone(SystemComponents systemComponents) { return(!systemComponents.Any(fc => Components.Any(c => c.GetType() == fc))); }
public bool HasAll(SystemComponents systemComponents) { return(systemComponents.All(sc => Components.Any(c => c.GetType() == sc))); }