Exemplo n.º 1
0
        public void DeDup()
        {
            var result = new List<Supplier>();
            var result_I = new List<SupplierInit>();
            var v = boot.Suppliers.AllSuppliers.GroupBy(x => x.name);
            foreach (var gr in v)
            {
                Supplier supl = gr.First();
                var p = supl.productSets.GroupBy(x => x.name);
                var pss = new List<ProductSet>();
                foreach (var pgr in p) pss.Add(pgr.First());
                supl.productSets = pss;
                result.Add(supl);

                SupplierInit supl_I = boot.ssInit.Find(x => x.name == supl.name);
                if (supl_I == null) continue;
                var pi = supl_I.pssInit.GroupBy(x => x.name);
                var psI = new List<psInit>();
                foreach (var pigr in pi) psI.Add(pigr.First());
                supl_I.pssInit = psI;
                result_I.Add(supl_I);
            }
            boot.Suppliers.AllSuppliers = result;
            boot.ssInit = result_I;
        }
Exemplo n.º 2
0
 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);
 }
Exemplo n.º 3
0
 /// <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);
 }
Exemplo n.º 4
0
        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();

        }