コード例 #1
0
        public void SinValid(int number)
        {
            //Fake SIN, mais vrai matematique
            var result = new SIN(number).Validate();

            Assert.True(result);
        }
コード例 #2
0
        public void SinInvalid(int number)
        {
            //Fake SIN, mais faux matematique
            var result = new SIN(number).Validate();

            Assert.False(result);
        }
コード例 #3
0
        public override void ExecuteCRMWorkFlowActivity(CodeActivityContext context, LocalWorkflowContext crmWorkflowContext)
        {
            crmWorkflowContext.TracingService.Trace("Loaded Supplier Information Workflow Activity");

            var supplierInformationUtil = new SupplierInformation(crmWorkflowContext.OrganizationService,
                                                                  crmWorkflowContext.TracingService);

            var socialInsuranceNumber = SIN.Get(context);

            if (string.IsNullOrEmpty(socialInsuranceNumber))
            {
                throw new ArgumentNullException("Social Insurance Number cannot be null or blank");
            }

            var supplierInfo = supplierInformationUtil.GetSupplierInformation(SIN.Get(context));

            LastName.Set(context, supplierInfo.LastName);
            crmWorkflowContext.TracingService.Trace($"Last Found: {supplierInfo.LastName}");

            SupplierNumber.Set(context, supplierInfo.SupplierNumber);
            crmWorkflowContext.TracingService.Trace($"Supplier Number: {supplierInfo.SupplierNumber}");

            SiteNumber.Set(context, supplierInfo.SupplierSiteNumber);
            crmWorkflowContext.TracingService.Trace($"Supplier Site Number: {supplierInfo.SupplierSiteNumber}");

            MethodOfPayment.Set(context, supplierInfo.MethodOfPayment);
            crmWorkflowContext.TracingService.Trace($"Method of Payment: {supplierInfo.MethodOfPayment}");

            crmWorkflowContext.TracingService.Trace("Custom Workflow Activity Finished");
        }
コード例 #4
0
 public Instructions()
 {
     instructions["ST"]   = new ST();
     instructions["LD"]   = new LD();
     instructions["ADD"]  = new ADD();
     instructions["SUB"]  = new SUB();
     instructions["JMP"]  = new JMP();
     instructions["JN"]   = new JN();
     instructions["JP"]   = new JP();
     instructions["JZ"]   = new JZ();
     instructions["JNZ"]  = new JNZ();
     instructions["HALT"] = new HALT();
     //Second architecture functions.
     instructions["LD2"] = new LD2();
     instructions["LD3"] = new LD3();
     instructions["ST2"] = new ST2();
     instructions["ST3"] = new ST3();
     instructions["POS"] = new POS();
     instructions["PXL"] = new PXL();
     instructions["RND"] = new RND();
     instructions["CLR"] = new CLR();
     instructions["COS"] = new COS();
     instructions["SIN"] = new SIN();
     instructions["IN"]  = new IN();
 }
コード例 #5
0
        public async Task OnDroneBuy(SIN sin, int lifestyle)
        {
            var factorId = GetFactorId(ScoringFactorEnum.buy_drone);

            await RaiseScoringEvent(sin.ScoringId ?? 0, factorId, (context) =>
            {
                var value = context.Set <ScoringEventLifestyle>().AsNoTracking().FirstOrDefault(s => s.ScoringFactorId == factorId && s.EventNumber == lifestyle);
                return(value?.Value ?? 1);
            });
        }
コード例 #6
0
        private void ProcessBuyScoring(SIN sin, Sku sku, ShopWallet shop)
        {
            var type = sku.Nomenklatura.Specialisation.ProductType;

            if (type == null)
            {
                throw new Exception("type not found");
            }
            var manager = IoC.IocContainer.Get <IScoringManager>();

            switch (type.Alias)
            {
            case "Implant":
                manager.OnImplantBuy(sin, sku.Nomenklatura.Lifestyle);
                break;

            case "Food":
            case "EdibleFood":
                manager.OnFoodBuy(sin, sku.Nomenklatura.Lifestyle);
                break;

            case "Weapon":
                manager.OnWeaponBuy(sin, sku.Nomenklatura.Lifestyle);
                break;

            case "Pill":
                manager.OnPillBuy(sin, sku.Nomenklatura.Lifestyle);
                break;

            case "Magic":
                manager.OnMagicBuy(sin, sku.Nomenklatura.Lifestyle);
                break;

            case "Insurance":
                manager.OnInsuranceBuy(sin, sku.Nomenklatura.Lifestyle);
                break;

            case "Charity":
                manager.OnCharityBuy(sin, sku.Nomenklatura.Lifestyle);
                break;

            case "drone":
                manager.OnDroneBuy(sin, sku.Nomenklatura.Lifestyle);
                break;

            case "matrix":
                manager.OnMatrixBuy(sin, sku.Nomenklatura.Lifestyle);
                break;

            default:
                manager.OnOtherBuy(sin, sku.Nomenklatura.Lifestyle);
                break;
            }
            manager.OnShopLifestyle(sin, shop.LifeStyle);
        }
コード例 #7
0
        public async Task OnInsuranceChanged(SIN sin, bool hasInsurance)
        {
            var factorId = GetFactorId(ScoringFactorEnum.insurance_change);

            await RaiseScoringEvent(sin.ScoringId ?? 0, factorId, (context) =>
            {
                var eventn = hasInsurance ? 1 : 0;
                var value  = context.Set <ScoringEventLifestyle>().AsNoTracking().FirstOrDefault(s => s.ScoringFactorId == factorId && s.EventNumber == eventn);
                return(value?.Value ?? 1);
            });
        }
コード例 #8
0
        public async Task OnFinishHim(SIN sin)
        {
            var factorId = GetFactorId(ScoringFactorEnum.finish_him);
            var scoring  = sin.Scoring;

            await RaiseScoringEvent(scoring.Id, factorId, (context) =>
            {
                var value = context.Set <ScoringEventLifestyle>().AsNoTracking().FirstOrDefault(s => s.ScoringFactorId == factorId && s.EventNumber == 1);
                return(value?.Value ?? 1);
            });
        }
コード例 #9
0
ファイル: BalanceDto.cs プロジェクト: sr-2020/Billing
 public BalanceDto(SIN sin)
 {
     CurrentBalance = BillingHelper.Round(sin.Wallet.Balance);
     CurrentScoring = Math.Round(sin.Scoring.CurrentFix + sin.Scoring.CurerentRelative, 2);
     SIN            = sin.Passport.Sin;
     PersonName     = sin.Passport.PersonName;
     Metatype       = sin.Passport.Metatype?.Name ?? "неизвестно";
     Citizenship    = sin.Passport.Citizenship ?? "неизвестно";
     Viza           = sin.Passport.Viza ?? "неизвестно";
     Pledgee        = sin.Passport.Mortgagee ?? "неизвестно";
     Id             = ModelId;
 }
コード例 #10
0
        public override void ExecuteCRMWorkFlowActivity(CodeActivityContext context, LocalWorkflowContext crmWorkflowContext)
        {
            crmWorkflowContext.TracingService.Trace("Loaded Supplier Information Workflow Activity");

            var supplierInformationUtil = new SupplierInformation(crmWorkflowContext.OrganizationService,
                                                                  crmWorkflowContext.TracingService);

            var socialInsuranceNumber = SIN.Get(context);

            if (string.IsNullOrEmpty(socialInsuranceNumber))
            {
                throw new ArgumentNullException("Social Insurance Number cannot be null or blank");
            }

            var supplierInfo = supplierInformationUtil.GetSupplierInformation(SIN.Get(context));

            crmWorkflowContext.TracingService.Trace($"SupplierInfo: {supplierInfo.ID}");

            if (supplierInfo.ID == Guid.Empty)
            {
                crmWorkflowContext.TracingService.Trace("SIN not found in the CAS Supplier Lookup records");

                //Populate entity reference with random GUID to avoid the workflow crash. Dynamics Bug. Microsoft needs to make fix.
                EntityReference CASSupplierLookupRef = new EntityReference("educ_cassupplierlookup", Guid.NewGuid());

                CASSupplierRef.Set(context, CASSupplierLookupRef);
                crmWorkflowContext.TracingService.Trace($"CASSupplierLookupRef: {supplierInfo.ID}");
                PartyId.Set(context, -1);
            }
            else
            {
                EntityReference CASSupplierLookupRef = new EntityReference("educ_cassupplierlookup", supplierInfo.ID);
                CASSupplierRef.Set(context, CASSupplierLookupRef);
                crmWorkflowContext.TracingService.Trace($"CASSupplierLookupRef: {supplierInfo.ID}");

                PartyId.Set(context, supplierInfo.PartyID);
                crmWorkflowContext.TracingService.Trace($"PartyID: {supplierInfo.PartyID}");

                LastName.Set(context, supplierInfo.LastName);
                crmWorkflowContext.TracingService.Trace($"Last Found: {supplierInfo.LastName}");

                SupplierNumber.Set(context, supplierInfo.SupplierNumber);
                crmWorkflowContext.TracingService.Trace($"Supplier Number: {supplierInfo.SupplierNumber}");

                SiteNumber.Set(context, supplierInfo.SupplierSiteNumber);
                crmWorkflowContext.TracingService.Trace($"Supplier Site Number: {supplierInfo.SupplierSiteNumber}");

                MethodOfPayment.Set(context, supplierInfo.MethodOfPayment);
                crmWorkflowContext.TracingService.Trace($"Method of Payment: {supplierInfo.MethodOfPayment}");

                crmWorkflowContext.TracingService.Trace("Custom Workflow Activity Finished");
            }
        }
コード例 #11
0
        private void InitEcoFirstStage(SIN sin)
        {
            sin.InGame        = true;
            sin.OldMetaTypeId = null;
            sin.OldInsurance  = null;

            var wallet = CreateOrUpdateWallet(WalletTypes.Character, sin.WalletId ?? 0, 0);

            sin.Wallet = wallet;
            var scoring = Get <Scoring>(s => s.Id == sin.ScoringId);

            if (scoring == null)
            {
                scoring     = new Scoring();
                sin.Scoring = scoring;
                Add(scoring);
            }
            scoring.StartFactor      = 1;
            scoring.CurrentFix       = 0.5m;
            scoring.CurerentRelative = 0.5m;
            SaveContext();
            var categories = GetList <ScoringCategory>(c => c.CategoryType > 0);

            foreach (var category in categories)
            {
                var current = Get <CurrentCategory>(c => c.CategoryId == category.Id && c.ScoringId == sin.ScoringId);
                if (current != null)
                {
                    var factors = GetList <CurrentFactor>(c => c.CurrentCategoryId == current.Id);
                    RemoveRange(factors);
                    Remove(current);
                }
                current = new CurrentCategory
                {
                    CategoryId = category.Id,
                    ScoringId  = sin.ScoringId ?? 0,
                    Value      = sin.Scoring.StartFactor ?? 1
                };
                Add(current);
            }
            SaveContext();
            var transfers = GetList <Transfer>(t => t.WalletFromId == sin.WalletId || t.WalletToId == sin.WalletId);

            RemoveRange(transfers);
            SaveContext();
            var rentas = GetList <Renta>(r => r.SinId == sin.Id);

            RemoveRange(rentas);
            sin.EVersion = "2";
            SaveContext();
        }
コード例 #12
0
        public async Task OnShopLifestyle(SIN sin, int shoplifestyle)
        {
            var factorId     = GetFactorId(ScoringFactorEnum.shop_lifestyle);
            var dto          = BillingHelper.GetLifeStyleDto();
            var sinlifestyle = dto.GetLifeStyle(sin.Wallet);
            var scoring      = sin.Scoring;
            var lifestyle    = CompareLifestyle(shoplifestyle, (int)sinlifestyle);

            await RaiseScoringEvent(scoring.Id, factorId, (context) =>
            {
                var value = context.Set <ScoringEventLifestyle>().AsNoTracking().FirstOrDefault(s => s.ScoringFactorId == factorId && s.EventNumber == lifestyle);
                return(value?.Value ?? 1);
            });
        }
コード例 #13
0
        public async Task OnMetatypeChanged(SIN sin)
        {
            var factorId = GetFactorId(ScoringFactorEnum.metatype);

            await RaiseScoringEvent(sin.ScoringId ?? 0, factorId, (context) =>
            {
                if (sin.Passport == null)
                {
                    throw new BillingException("Паспорт персонажа утерян");
                }
                var value = context.Set <ScoringEventLifestyle>().AsNoTracking().FirstOrDefault(s => s.ScoringFactorId == factorId && s.EventNumber == sin.Passport.MetatypeId);
                return(value?.Value ?? 1);
            });
        }
コード例 #14
0
        protected Transfer MakeTransferLegSIN(int shopId, SIN sin, decimal amount, string comment)
        {
            var anon = GetAnon(sin.Character.Model);
            var shop = Get <ShopWallet>(s => s.Id == shopId, s => s.Wallet);

            if (shop == null)
            {
                throw new BillingNotFoundException($"shop {shopId} not found");
            }
            var transfer = AddNewTransfer(shop.Wallet, sin.Wallet, amount, comment, anon);

            SaveContext();
            return(transfer);
        }
コード例 #15
0
        protected Transfer MakeTransferSINSIN(SIN sinFrom, SIN sinTo, decimal amount, string comment, bool allAnon = false)
        {
            var anonFrom = GetAnon(sinFrom.Character.Model);
            var anonto   = GetAnon(sinTo.Character.Model);
            var anon     = allAnon || anonFrom || anonto;
            var transfer = AddNewTransfer(sinFrom.Wallet, sinTo.Wallet, amount, comment, anon);

            SaveContext();
            if (transfer != null)
            {
                EreminPushAdapter.SendNotification(sinTo.Character.Model, "Кошелек", $"Вам переведено денег {amount}");
            }
            return(transfer);
        }
コード例 #16
0
        public SINForm(Administration administrationMain, SIN sinLoad)
        {
            InitializeComponent();
            administration = administrationMain;
            sin = sinLoad;

            if (sin != null)
            {
                this.LoadSin();
            }

            this.LoadFunctions();
            this.LoadBoats();
            this.LoadMaterials();
        }
コード例 #17
0
        protected void RecalculateRenta(Renta renta, string qrDecoded, SIN newsin)
        {
            renta.SinId = newsin.Id;
            var anon = GetAnon(newsin.Character.Model);

            renta.CurrentScoring = newsin.Scoring.CurerentRelative + newsin.Scoring.CurrentFix;
            var gmdescript = BillingHelper.GetGmDescription(newsin.Passport, renta.Sku, anon);

            _ereminService.UpdateQR(qrDecoded, renta.BasePrice,
                                    BillingHelper.GetFinalPrice(renta),
                                    gmdescript,
                                    renta.Id,
                                    BillingHelper.GetLifestyle(renta.LifeStyle)).GetAwaiter().GetResult();
            SaveContext();
        }
コード例 #18
0
        protected Price CreateNewPrice(Sku sku, ShopWallet shop, SIN sin)
        {
            decimal modeldiscount;

            try
            {
                var eService = new EreminService();
                modeldiscount = eService.GetDiscount(sin.Character.Model, BillingHelper.GetDiscountType(sku.Nomenklatura.Specialisation.ProductType.DiscountType));
            }
            catch (Exception e)
            {
                Console.Error.WriteLine(e.ToString());
                modeldiscount = 1;
            }
            decimal discount = 1;

            if (sin.Passport.Mortgagee == sku.Corporation.Alias)
            {
                discount *= 0.9m;
            }
            discount *= modeldiscount;
            var currentScoring = sin.Scoring.CurrentFix + sin.Scoring.CurerentRelative;

            if (currentScoring == 0)
            {
                currentScoring = 1;
            }
            var price = new Price
            {
                Sku            = sku,
                Shop           = shop,
                BasePrice      = sku.Nomenklatura.BasePrice,
                CurrentScoring = currentScoring,
                DateCreated    = DateTime.Now.ToUniversalTime(),
                Discount       = discount,
                Sin            = sin,
                ShopComission  = BillingHelper.GetShopComission(shop.LifeStyle),
                ShopPrice      = BillingHelper.GetShopPrice(sku)
            };

            price.FinalPrice = BillingHelper.GetFinalPrice(price);
            Add(price);
            SaveContext();
            return(price);
        }
コード例 #19
0
 public UserDto(SIN sin)
 {
     if (sin == null)
     {
         return;
     }
     Name = sin.Passport?.PersonName;
     if (sin.Character != null)
     {
         ModelId = sin.Character.Model;
         Id      = sin.Character.Model;
     }
     else
     {
         ModelId = 0;
     }
     Balance  = sin.Wallet?.Balance ?? 0;
     Eversion = sin.EVersion;
 }
コード例 #20
0
        protected void CloseOverdraft(Renta renta, Wallet mir, SIN sin, bool first = false)
        {
            decimal comission;

            if (renta.FullPrice)
            {
                comission = BillingHelper.GetFinalPrice(renta);
            }
            else
            {
                comission = BillingHelper.CalculateComission(renta);
            }
            //create KPI here
            renta.Sku.Corporation.CurrentKPI += renta.ShopPrice;
            if (first)
            {
                renta.Sku.Corporation.SkuSold += renta.ShopPrice;
            }
            //comission
            AddNewTransfer(mir, renta.Shop.Wallet, comission, $"Рентное начисление: {renta.Sku.Name} в {renta.Shop.Name} от {sin.Passport.PersonName}", false, renta.Id, false);
        }
コード例 #21
0
        /// <summary>
        /// НЕ ВЫПОЛНЯЕТСЯ SAVECONTEXT
        /// </summary>
        protected void ProcessRenta(Renta renta, Wallet mir, SIN sin, bool first = false)
        {
            if (renta?.Shop?.Wallet == null ||
                renta?.Sku?.Corporation?.Wallet == null ||
                sin?.Character == null ||
                sin?.Wallet == null ||
                renta?.Sku?.Nomenklatura == null)
            {
                throw new Exception("Ошибка загрузки моделей по ренте");
            }
            var finalPrice = BillingHelper.GetFinalPrice(renta);

            //если баланс положительный
            if (sin.Wallet.Balance > 0)
            {
                AddNewTransfer(sin.Wallet, mir, finalPrice, $"Рентный платеж: { renta.Sku.Name} в {renta.Shop.Name}", false, renta.Id, false);
                CloseOverdraft(renta, mir, sin, first);
            }
            else
            {
                AddNewTransfer(sin.Wallet, mir, finalPrice, $"Рентный платеж: {renta.Sku.Name} в {renta.Shop.Name}", false, renta.Id, true);
            }
        }
コード例 #22
0
 public override string ToString()
 {
     return(String.Format($"SIN: {SIN.ToString()}, First Name: {FirstName}, Last Name: {LastName}, Age: {Age.ToString()}"));
 }
コード例 #23
0
 public async Task OnTest(SIN sin)
 {
     throw new NotImplementedException("123");
 }
コード例 #24
0
ファイル: BillingManager.cs プロジェクト: sr-2020/Billing
 private void UnblockCharacter(SIN sin)
 {
     sin.Blocked = false;
     SaveContext();
 }
コード例 #25
0
        protected override void Execute(CodeActivityContext executionContext)
        {
            //Create the tracing service
            ITracingService tracingService = executionContext.GetExtension <ITracingService>();

            //Create the context
            IWorkflowContext            context        = executionContext.GetExtension <IWorkflowContext>();
            IOrganizationServiceFactory serviceFactory = executionContext.GetExtension <IOrganizationServiceFactory>();
            IOrganizationService        service        = serviceFactory.CreateOrganizationService(context.UserId);

            tracingService.Trace("Loaded UpsertSupplierWorkflow");
            tracingService.Trace("CREATING Contact object with the input values");
            tracingService.Trace("Checkpoint 1");

            Contact contact = new Contact();

            int partyid = PartyID.Get <int>(executionContext);


            tracingService.Trace("Starting assigning attribute variables.");

            contact.First_Name = FirstName.Get <string>(executionContext).ToString();
            tracingService.Trace("First Name Populated");

            tracingService.Trace(string.Format("Setting party id = {0}", partyid));
            contact.Party_Id = partyid;
            tracingService.Trace("Party ID populated");

            contact.Last_Name = LastName.Get <string>(executionContext).ToString();
            tracingService.Trace("Last Name Populated");

            contact.Payment_Method = PaymentMethod.Get <string>(executionContext).ToString();
            tracingService.Trace("Payment Method Populated");

            contact.SIN = SIN.Get <string>(executionContext).ToString();
            tracingService.Trace("SIN Populated");

            contact.Address1 = Address1.Get <string>(executionContext).ToString();
            tracingService.Trace("Address1 Populated");

            contact.Country_Code = Country.Get <string>(executionContext).ToString();
            tracingService.Trace("Country Populated");

            contact.City = City.Get <string>(executionContext).ToString();
            tracingService.Trace("City Populated");

            contact.Province_Code = Province.Get <string>(executionContext).ToString();
            tracingService.Trace("Province Populated");

            contact.Postal_Code = PostalCode.Get <string>(executionContext).ToString();
            tracingService.Trace("Postal Code Populated");
            tracingService.Trace("Checkpoint 2");


            EntityReference contactRef = ContactReference.Get <EntityReference>(executionContext);

            contact.ID = contactRef.Id;

            tracingService.Trace("Fetching the Configs");
            ////Get the configuration record for Oracle_T4A group from the configs entity and get the connection value from the record.
            var configs = Helper.GetSystemConfigurations(service, ConfigEntity.Group.ORACLE_T4A, string.Empty);

            tracingService.Trace("Fetching Connection");
            string connection = Helper.GetConfigKeyValue(configs, ConfigEntity.Key.CONNECTION, ConfigEntity.Group.ORACLE_T4A);

            try
            {
                tracingService.Trace("Fetching Oracle Response by making call to Helper.UpsertSupplierInOracle()");
                OracleResponse response = Helper.UpsertSupplierInOracle(contact, connection, tracingService);

                if (response.TransactionCode == OracleResponse.T4A_STATUS.OK)
                {
                    tracingService.Trace("Inside OracleResponse.T4A_STATUS.OK \nRetriving and setting response values to output");
                    PartyID.Set(executionContext, response.PartyId);
                    tracingService.Trace("Party ID Output Param is set");
                }

                tracingService.Trace("Setting up transaction code and transaction message");
                TransactionCode.Set(executionContext, response.TransactionCode.Trim());
                TransactionMessage.Set(executionContext, response.TransactionMessage);
            }
            catch (InvalidWorkflowException ex)
            {
                Helper.LogIntegrationError(service, ErrorType.CONTACT_ERROR, IntegrationErrorCodes.UPSERT_SUPPLIER.GetIntValue(), Strings.T4A_FER_ERROR,
                                           string.Format("Error Description: {0} ", ex.Message), contactRef);
            }
            catch (Exception ex)
            {
                Helper.LogIntegrationError(service, ErrorType.CONTACT_ERROR, IntegrationErrorCodes.UPSERT_SUPPLIER.GetIntValue(), Strings.T4A_FER_ERROR,
                                           string.Format("Error Description: {0} ", ex.Message), contactRef);
            }
        }
コード例 #26
0
        private void InitEcoSecondStage(SIN sin)
        {
            if ((sin.Passport.MetatypeId ?? 0) > 5)
            {
                sin.EVersion = "4";
                SaveContext();
                return;
            }
            var joinchacter = Get <JoinCharacter>(jc => jc.CharacterId == sin.CharacterId);
            var fields      = GetList <JoinFieldValue>(jfv => jfv.JoinCharacterId == joinchacter.Id, jfv => jfv.JoinField);
            var insurance   = fields.FirstOrDefault(f => f.JoinField.Name == "Страховка");
            var lifestyle   = Lifestyles.Wood;


            CorporationWallet citizen;
            ShopWallet        shop;
            Sku sku;

            if (insurance != null)
            {
                lifestyle = BillingHelper.GetLifestyleFromJoin(insurance.Value);
            }
            sin.Wallet.Balance = GetStartBalance(lifestyle);
            var ls = (int)lifestyle;
            var pt = ProductTypeEnum.Insurance.ToString();

            if (lifestyle == Lifestyles.Wood)
            {
                citizen = Get <CorporationWallet>(c => c.Alias == "Omnistar");
                if (citizen == null)
                {
                    throw new BillingNotFoundException("Гражданство при инициализации не найдено");
                }
                shop = Get <ShopWallet>(s => s.Name == "МЧС");
            }
            else
            {
                if (lifestyle == Lifestyles.Iridium)
                {
                    sin.Wallet.IsIrridium = true;
                }
                else
                {
                    sin.Wallet.IsIrridium = false;
                }
                if (sin.Passport.Citizenship == "Россия")
                {
                    citizen = Get <CorporationWallet>(c => c.Alias == "Россия");
                    shop    = Get <ShopWallet>(s => s.Name == "МЧС");
                }
                else
                {
                    citizen = Get <CorporationWallet>(c => c.Alias == "Zurich-Orbital");
                    shop    = Get <ShopWallet>(s => s.Name == "CrashCart");
                }

                if (citizen == null)
                {
                    throw new BillingNotFoundException("Гражданство при инициализации не найдено");
                }
                if (shop == null)
                {
                    throw new BillingNotFoundException("Продавец страховки при инициализации не найден");
                }
            }
            sku = Get <Sku>(s => s.CorporationId == citizen.Id && s.Nomenklatura.Specialisation.ProductType.Alias == pt && s.Nomenklatura.Lifestyle == ls, s => s.Nomenklatura.Specialisation.ProductType, s => s.Corporation);
            if (sku == null)
            {
                throw new BillingNotFoundException("Страховка при инициализации не найдена");
            }
            if (shop == null)
            {
                throw new BillingNotFoundException("Магазин стартовой страховки не найден");
            }
            var price = CreateNewPrice(sku, shop, sin);
            var renta = CreateRenta(sin.Character.Model, price.Id, 0, 1);

            sin.EVersion = "4";
            SaveContext();
        }