Exemplo n.º 1
0
        public void GetFranchiseeDataForUpdate(int labId, out FranchiseeTenant outfranchiseeTenant,
                                               out FranchiseeConfiguration outfranchiseeConfiguration)
        {
            outfranchiseeTenant        = null;
            outfranchiseeConfiguration = null;

            outfranchiseeTenant = _franchiseeTenantRepository.GetById(labId);
            if (outfranchiseeTenant != null)
            {
                // change the connection
                var connectionString = PersistenceHelper.GenerateConnectionString(outfranchiseeTenant.Server, outfranchiseeTenant.Database, outfranchiseeTenant.UserName, outfranchiseeTenant.Password);
                _franchiseeConfigurationRepository.ChangeConnectionString(connectionString);
                outfranchiseeConfiguration = _franchiseeConfigurationRepository.FirstOrDefault();
            }
        }
Exemplo n.º 2
0
        public bool AddPackageHistoryNoToken(PackageHistoryDto packageHistoryInfo)
        {
            var packageHistory = new PackageHistory();

            using (var scope = new TransactionScope())
            {
                var franchiseeTenant = _franchiseeTenantRepository.GetById(packageHistoryInfo.FranchiseeTenantId);

                packageHistory.PackageId          = packageHistoryInfo.PackageId;
                packageHistory.OldPackageId       = packageHistoryInfo.OldPackageId;
                packageHistory.StartDate          = packageHistoryInfo.StartDate;
                packageHistory.EndDate            = packageHistoryInfo.EndDate;
                packageHistory.RequestId          = packageHistoryInfo.RequestId;
                packageHistory.FranchiseeTenantId = packageHistoryInfo.FranchiseeTenantId;
                packageHistory.AccountNumber      = franchiseeTenant.AccountNumber;
                packageHistory.IsApply            = packageHistoryInfo.IsApply;
                Add(packageHistory);


                franchiseeTenant.CurrentPackageId       = packageHistory.PackageId;
                franchiseeTenant.RemainingAmount        = packageHistoryInfo.Amount;
                franchiseeTenant.NextBillingDate        = packageHistoryInfo.NextBillingDate;
                franchiseeTenant.PackageNextBillingDate = packageHistoryInfo.PackageNextBillingDate;

                _franchiseeTenantRepository.Update(franchiseeTenant);
                _franchiseeTenantRepository.Commit();
                scope.Complete();
                return(true);
            }
        }