Exemplo n.º 1
0
        public CharacterDetailViewModel(Character c)
        {
            ClaymoreDataModelContainer db = new ClaymoreDataModelContainer();

            Character         = c;
            lstXPTransactions = new List <XPTransaction>();
            foreach (XPAsset curAsset in  c.XPAssets)
            {
                foreach (XPChange curChange in curAsset.XPChanges)
                {
                    if (!lstXPTransactions.Contains(curChange.Transaction))
                    {
                        lstXPTransactions.Add(curChange.Transaction);
                    }
                }
            }
            foreach (XPTransaction curTransaction in lstXPTransactions)
            {
                List <XPChange> lstCharacterRelevantChanges = new List <XPChange>(curTransaction.Changes.Where(x => x.XPAsset.CharacterId == c.Id));
                lstCharacterRelevantChanges.Sort(XPChange.Compare);
                curTransaction.Changes = lstCharacterRelevantChanges;
            }

            lstXPTransactions.Sort(XPTransaction.Compare);
        }
Exemplo n.º 2
0
        public static void RefreshAllXPAssets()
        {
            ClaymoreDataModelContainer db = new ClaymoreDataModelContainer();
            DbCommand cmdRefresh          = db.Database.Connection.CreateCommand();

            cmdRefresh.CommandText = "UPDATE XPAssets SET XPAssets.AllocatedXP = (SELECT SUM(Amount) FROM XPChanges WHERE XPChanges.XPAssetId = XPAssets.Id)";
            db.Database.Connection.Open();
            cmdRefresh.ExecuteNonQuery();
            db.Database.Connection.Close();
        }