public void Update() { if (boot == null) throw new Exception("Not Initialized Boot"); SupplierInit supl_I = boot.ssInit.Find(x => x.name == SuplName); if (supl_I == null) throw new Exception("No Supplier to Update"); psInit psi = supl_I.pssInit.Find(x => x.name == name); if (psi == null) throw new Exception($"No ProductSet to update in Supplier \"{SuplName}\""); Update(psi); }
/// <summary> /// Update - read updated pricelist from Excel and put it to AllSuppliers /// </summary> public void Update(psInit psi) { SupplierInit supl_I = boot.ssInit.Find(x => x.name == SuplName); int indx = supl_I.pssInit.FindIndex(x => x.name == name); if (indx > 0 && indx < supl_I.pssInit.Count) supl_I.pssInit[indx] = psi; else supl_I.pssInit.Add(psi); var doc = boot.Doc; string docName = SuplName + " " + name; doc.Init(docName, boot.ExcelDir, psi.FileName, psi.SheetN, LoadDescription: psi.LoadDescriptor, FirstRow: psi.i0, RuleText: RuleText.ToArray()); doc = doc.GetDoc(docName); Init(name, doc); var ss = boot.Suppliers.AllSuppliers; Supplier supl = ss.Find(x => x.name == SuplName); ProductSet ps = supl.productSets.Find(x => x.name == name); if (ps == null) ps = this; else supl.productSets.Add(this); }
public void Update(string suplName, string psName) { SupplierInit supl_I = boot.ssInit.Find(x => x.name == suplName) ?? throw new ArgumentException($"SupplierInit {suplName} not found"); psInit psi = supl_I.pssInit.Find(x => x.name == psName) ?? throw new ArgumentException($"psInit {psName} not found for SupplierInit=\"{suplName}\""); string LoadDescription = psi.LoadDescriptor; Supplier supl = boot.Suppliers.AllSuppliers.Find(x => x.name == suplName) ?? throw new ArgumentException($"Supplier {suplName} not found"); ProductSet ps = supl.productSets.Find(x => x.name == suplName) ?? throw new ArgumentException($"ProductSet=\"{psName}\" not found for Supplier=\"{suplName}\""); int indx = supl.productSets.IndexOf(ps); string docName = suplName + "_" + psName; //17/2 boot.Doc.Init(docName, boot.ExcelDir, ); int suplIndex = boot.Suppliers.AllSuppliers.IndexOf(supl); //17/2 boot.Suppliers.AllSuppliers[suplIndex].productSets[indx] = newPS; throw new NotImplementedException(); }