Пример #1
0
        public void DoNotCrashOnUnknownType()
        {
            Func <IObjectDBTransaction, ILicenseTable> creator;

            using (var tr = _db.StartTransaction())
            {
                creator = tr.InitRelation <ILicenseTable>("LicRel");
                var lics    = creator(tr);
                var license = new LicenseDb {
                    ItemId = 1
                };                                        //no LicenseFileDb inserted
                lics.Insert(license);
                tr.Commit();
            }

            using (var tr = _db.StartTransaction())
            {
                var lics    = creator(tr);
                var license = new LicenseDb {
                    ItemId = 1
                };
                lics.Update(license);

                tr.Commit();
            }

            AssertNoLeaksInDb();
        }
Пример #2
0
        public LicenseViewViewModel(LicenseDb licenseDb)
        {
            this.dbContext = licenseDb;

            string errorMessage;
            var    licenseDetails = this.dbContext.GetLicenseDetails(out errorMessage);

            if (licenseDetails != null && licenseDetails.ContainsKey("ExpiryDate"))
            {
                _expiryDate = licenseDetails["ExpiryDate"];
                DateTime expiryDate; DateTime.TryParse(_expiryDate, out expiryDate);
                if (_expiryDate != null && IsDateBeforeOrToday(expiryDate))
                {
                    this.WarningMessage   = string.Format("Your License expires on {0}", expiryDate.ToShortDateString());
                    this.IsLicenseUpdated = true;
                }
                else
                {
                    this.WarningMessage   = string.Format("Your License was expired on {0}", expiryDate.ToShortDateString());
                    this.IsLicenseUpdated = false;
                }
            }
            else
            {
            }

            InitialilzeCommands();
        }
Пример #3
0
        public LoginViewViewModel(LicenseDb licenseDb)
        {
            this.dbContext = licenseDb;
            this._authenticationService = this.Container.Resolve <IAuthenticationService>(ServiceNames.AuthenticationService);
            this.IntializeCommands();

//#if DEBUG
//            Username = "******";
//#endif
        }
        public void DoNotCrashOnUnknownType()
        {
            Func<IObjectDBTransaction, ILicenseTable> creator;
            using (var tr = _db.StartTransaction())
            {
                creator = tr.InitRelation<ILicenseTable>("LicRel");
                var lics = creator(tr);
                var license = new LicenseDb { ItemId = 1 }; //no LicenseFileDb inserted
                lics.Insert(license);
                tr.Commit();
            }
            using (var tr = _db.StartTransaction())
            {
                var lics = creator(tr);
                var license = new LicenseDb { ItemId = 1 };
                lics.Update(license);

                tr.Commit();
            }
            AssertNoLeaksInDb();
        }