Exemplo n.º 1
0
 public MaterialCommoditiesList(MaterialCommoditiesList other)       // clone from other
 {
     List = new List <MaterialCommodities>();
     other.List.ForEach(item =>
     {
         if (item.Count > 0)        // if items, or commodity and not clear zero, or material and not clear zero, add
         {
             List.Add(item);
         }
     });
 }
        static public MaterialCommoditiesList Process(JournalEntry je, MaterialCommoditiesList oldml, SQLiteConnectionUser conn,
                                                      bool clearzeromaterials, bool clearzerocommodities)
        {
            MaterialCommoditiesList newmc = (oldml == null) ? new MaterialCommoditiesList() : oldml;

            if (je is IMaterialCommodityJournalEntry)
            {
                IMaterialCommodityJournalEntry e = je as IMaterialCommodityJournalEntry;
                newmc = newmc.Clone(clearzeromaterials, clearzerocommodities);          // so we need a new one, makes a new list, but copies the items..
                e.MaterialList(newmc, conn);
                // newmc.Dump();    // debug
            }

            return(newmc);
        }
        public MaterialCommoditiesList Clone(bool clearzeromaterials, bool clearzerocommodities)       // returns a new copy of this class.. all items a copy
        {
            MaterialCommoditiesList mcl = new MaterialCommoditiesList();

            list.ForEach(item =>
            {
                bool commodity = item.Details.IsCommodity;
                // if items, or commodity and not clear zero, or material and not clear zero, add
                if (item.Count > 0 || (commodity && !clearzerocommodities) || (!commodity && !clearzeromaterials))
                {
                    mcl.list.Add(item);
                }
            });

            return(mcl);
        }
Exemplo n.º 4
0
        public MaterialCommoditiesList Clone(bool clearzeromaterials, bool clearzerocommodities)       // returns a new copy of this class.. all items a copy
        {
            MaterialCommoditiesList mcl = new MaterialCommoditiesList();

            mcl.list = new List <MaterialCommodities>(list.Count);
            list.ForEach(item =>
            {
                bool commodity = item.category.Equals(MaterialCommodities.CommodityCategory);
                // if items, or commodity and not clear zero, or material and not clear zero, add
                if (item.count > 0 || (commodity && !clearzerocommodities) || (!commodity && !clearzeromaterials))
                {
                    mcl.list.Add(item);
                }
            });

            return(mcl);
        }
Exemplo n.º 5
0
        static public MaterialCommoditiesList Process(JournalEntry je, MaterialCommoditiesList oldml)
        {
            MaterialCommoditiesList newmc = (oldml == null) ? new MaterialCommoditiesList() : oldml;

            if (je is ICommodityJournalEntry || je is IMaterialJournalEntry) // could be both
            {
                newmc = newmc.Clone();                                       // so we need a new one, makes a new list, but copies the items..

                if (je is ICommodityJournalEntry)
                {
                    ICommodityJournalEntry e = je as ICommodityJournalEntry;
                    e.UpdateCommodities(newmc);
                }

                if (je is IMaterialJournalEntry)
                {
                    IMaterialJournalEntry e = je as IMaterialJournalEntry;
                    e.UpdateMaterials(newmc);
                }
            }

            return(newmc);
        }
Exemplo n.º 6
0
        public void ProcessWithUserDb(JournalEntry je, HistoryEntry prev, HistoryList hl, SQLiteConnectionUser conn)      // called after above with a USER connection
        {
            materialscommodities = MaterialCommoditiesList.Process(je, prev?.materialscommodities, conn, EliteConfigInstance.InstanceConfig.ClearMaterials, EliteConfigInstance.InstanceConfig.ClearCommodities);

            snc = SystemNoteClass.GetSystemNote(Journalid, IsFSDJump, System);       // may be null
        }
Exemplo n.º 7
0
 public void UpdateMaterialCommodity(MaterialCommoditiesList mc)
 {
     MaterialCommodity = mc;
 }
Exemplo n.º 8
0
 public void UpdateMaterialsCommodities(JournalEntry je, MaterialCommoditiesList prev)
 {
     MaterialCommodity = MaterialCommoditiesList.Process(je, prev);
 }
Exemplo n.º 9
0
        public void ProcessWithUserDb(JournalEntry je, HistoryEntry prev, HistoryList hl, SQLiteConnectionUser conn)      // called after above with a USER connection
        {
            MaterialCommodity = MaterialCommoditiesList.Process(je, prev?.MaterialCommodity, conn);

            snc = SystemNoteClass.GetSystemNote(Journalid, IsFSDJump, System);       // may be null
        }
Exemplo n.º 10
0
 public void UpdateMaterials(JournalEntry je, HistoryEntry prev)
 {
     MaterialCommodity = MaterialCommoditiesList.Process(je, prev?.MaterialCommodity);
 }