Ejemplo n.º 1
0
        public dynamic SaveVatRate(VatRate vatRate)
        {
            if (vatRate.VatRateId == 0)
            {
                _context.VatRates.Add(vatRate);
            }
            else
            {
                VatRate dbEntry = GetVatRate(vatRate.VatRateId);

                if (dbEntry != null)
                {
                    dbEntry.Symbol = vatRate.Symbol;
                    dbEntry.Value  = vatRate.Value;
                }
            }

            try
            {
                _context.SaveChanges();
            }
            catch (DbUpdateException e)
            {
                return(new { Result = false, Message = "Nie można zapisać stawki VAT z symbolem, który został już wykorzystany" });
            }

            return(new { Result = true, Message = $"Zapisano stawkę VAT {vatRate.Symbol} {vatRate.Value}%", vatRate.VatRateId });
        }
Ejemplo n.º 2
0
        public async Task <IActionResult> PutVatRate(int id, VatRate vatRate)
        {
            if (id != vatRate.Id)
            {
                return(BadRequest());
            }

            _context.Entry(vatRate).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!VatRateExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Calculates the line.
        /// </summary>
        /// <param name="quantity">Quantity.</param>
        /// <param name="initialNetPrice">Initial net price.</param>
        /// <param name="discountRate">Discount rate.</param>
        /// <param name="initialGrossPrice">Initial gross price.</param>
        /// <param name="precision">Precision.</param>
        public void Calculate(decimal quantity, decimal initialNetPrice, decimal discountRate, decimal initialGrossPrice, int precision)
        {
            this.Quantity          = quantity;
            this.DiscountRate      = discountRate;
            this.InitialNetPrice   = initialNetPrice;
            this.InitialGrossPrice = initialGrossPrice;

            VatRate vr = DictionaryMapper.Instance.GetVatRate(this.VatRateId);

            decimal vatRate = vr.Rate;

            if (((CommercialDocumentBase)this.Parent).CalculationType == CalculationType.Gross)
            {
                if (initialGrossPrice == 0 && initialNetPrice != 0)
                {
                    this.InitialGrossPrice = Decimal.Round(this.InitialNetPrice * (1 + vatRate / 100), precision, MidpointRounding.AwayFromZero);
                }

                this.InitialNetPrice = Decimal.Round(this.InitialGrossPrice / (1 + vatRate / 100), precision, MidpointRounding.AwayFromZero);

                //Zabezpieczenie przed przeliczeniem, które zwróci inne wyniki niż były na dokumencie źródłowym o ile taki istnieje (wtedy GrossPrice jest większe od 0), celowo obliczamy z większa precyzją
                if (this.GrossPrice != 0 && this.InitialGrossPrice != 0)
                {
                    this.DiscountRate = 100 * (1 - this.GrossPrice / this.InitialGrossPrice);
                }
                this.GrossPrice = Decimal.Round(this.InitialGrossPrice * (1 - this.DiscountRate / 100), precision, MidpointRounding.AwayFromZero);
                this.NetPrice   = Decimal.Round(this.GrossPrice / (1 + vatRate / 100), precision, MidpointRounding.AwayFromZero);

                this.GrossValue = Decimal.Round(this.GrossPrice * this.Quantity, precision, MidpointRounding.AwayFromZero);
                this.VatValue   = Decimal.Round(this.GrossValue * vatRate / (vatRate + 100), precision, MidpointRounding.AwayFromZero);
                this.NetValue   = Decimal.Round(this.GrossValue - this.VatValue, precision, MidpointRounding.AwayFromZero);
            }
            else //if (((CommercialDocument)this.Parent).CalculationType == CalculationType.Net)
            {
                if (initialNetPrice == 0 && initialGrossPrice != 0)
                {
                    this.InitialNetPrice = Decimal.Round(this.InitialGrossPrice / (1 + vatRate / 100), precision, MidpointRounding.AwayFromZero);
                }

                //Zabezpieczenie przed przeliczeniem, które zwróci inne wyniki niż były na dokumencie źródłowym o ile taki istnieje (wtedy NetPrice jest większe od 0), celowo obliczamy z większa precyzją
                if (this.NetPrice != 0 && this.InitialNetPrice != 0)
                {
                    this.DiscountRate = 100 * (1 - this.NetPrice / this.InitialNetPrice);
                }
                this.NetPrice          = Decimal.Round(this.InitialNetPrice * (1 - this.DiscountRate / 100), precision, MidpointRounding.AwayFromZero);
                this.InitialGrossPrice = Decimal.Round(this.InitialNetPrice * (1 + vatRate / 100), precision, MidpointRounding.AwayFromZero);
                this.GrossPrice        = Decimal.Round(this.NetPrice * (1 + Decimal.Round(vatRate / 100, precision, MidpointRounding.AwayFromZero)), precision, MidpointRounding.AwayFromZero);

                this.NetValue   = Decimal.Round(this.NetPrice * this.Quantity, precision, MidpointRounding.AwayFromZero);
                this.VatValue   = Decimal.Round(this.NetValue * vatRate / 100, precision, MidpointRounding.AwayFromZero);
                this.GrossValue = Decimal.Round(this.NetValue + this.VatValue, precision, MidpointRounding.AwayFromZero);
            }
            //Ponieważ DiscountRate może mieć teraz po przeliczeniu więcej niż dwa miejsca po przecinku to zaokraglamy aby w bazie nie bylo przeklaman
            this.DiscountRate = Decimal.Round(this.DiscountRate, precision, MidpointRounding.AwayFromZero);

            this.DiscountGrossValue = Decimal.Round(this.InitialGrossPrice - this.GrossPrice, precision, MidpointRounding.AwayFromZero);
            this.DiscountNetValue   = Decimal.Round(this.InitialNetPrice - this.NetPrice, precision, MidpointRounding.AwayFromZero);
            this.InitialNetValue    = Decimal.Round(this.InitialNetPrice * this.Quantity, precision, MidpointRounding.AwayFromZero);
            this.InitialGrossValue  = Decimal.Round(this.InitialGrossPrice * this.Quantity, precision, MidpointRounding.AwayFromZero);
        }
Ejemplo n.º 4
0
        public async Task <ActionResult <VatRate> > PostVatRate(VatRate vatRate)
        {
            _context.VatRate.Add(vatRate);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetVatRate", new { id = vatRate.Id }, vatRate));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Edit(int id, [Bind("VatRateID,Name,Rate,Description,IsActive,AddedDate,UpdatedDate,AddedUserID,UpdatedUserID")] VatRate vatRate)
        {
            if (id != vatRate.VatRateID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    vatRate.UpdatedDate   = DateTime.Now;
                    vatRate.UpdatedUserID = Int32.Parse(HttpContext.Session.GetString("UserID"));
                    _context.Update(vatRate);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!VatRateExists(vatRate.VatRateID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AddedUserID"]   = new SelectList(_context.Users, "UserID", "Login", vatRate.AddedUserID);
            ViewData["UpdatedUserID"] = new SelectList(_context.Users, "UserID", "Login", vatRate.UpdatedUserID);
            return(View(vatRate));
        }
Ejemplo n.º 6
0
 private void LoadData()
 {
     using (SqlConnection conn = new SqlConnection())
     {
         conn.ConnectionString = clsUtils.GetConnString(1);
         conn.Open();
         DataSet        SettingData         = new DataSet();
         SqlDataAdapter SettingsDataAdapter = new SqlDataAdapter("SELECT * from tblCompanyDetails", conn);
         SettingsDataAdapter.Fill(SettingData, "tblCompanyDetails");
         txtCompanyName.Text = SettingData.Tables["tblCompanyDetails"].Rows[0]["CompanyName"].ToString();
         txtAdd1.Text        = SettingData.Tables["tblCompanyDetails"].Rows[0]["Street"].ToString();
         txtAdd2.Text        = SettingData.Tables["tblCompanyDetails"].Rows[0]["Area"].ToString();
         txtAdd3.Text        = SettingData.Tables["tblCompanyDetails"].Rows[0]["Town"].ToString();
         txtAdd4.Text        = SettingData.Tables["tblCompanyDetails"].Rows[0]["County"].ToString();
         txtPostCode.Text    = SettingData.Tables["tblCompanyDetails"].Rows[0]["PostCode"].ToString();
         txtTelephone.Text   = SettingData.Tables["tblCompanyDetails"].Rows[0]["Telephone"].ToString();
         txtFax.Text         = SettingData.Tables["tblCompanyDetails"].Rows[0]["Fax"].ToString();
         txtVATReg.Text      = SettingData.Tables["tblCompanyDetails"].Rows[0]["VATRegistrationNo"].ToString();
         txtEmail.Text       = SettingData.Tables["tblCompanyDetails"].Rows[0]["Email"].ToString();
         txtWWW.Text         = SettingData.Tables["tblCompanyDetails"].Rows[0]["Website"].ToString();
         double VatRate;
         VatRate         = Convert.ToDouble(SettingData.Tables["tblCompanyDetails"].Rows[0]["VatRate"]);
         txtVATRate.Text = VatRate.ToString("P2", CultureInfo.InvariantCulture);
         // txtVATRate.Text = FormatPercent(txtVATRate.Text)
     }
 }
Ejemplo n.º 7
0
        private void txtVATRate_Leave(object sender, EventArgs e)
        {
            double VatRate;

            VatRate         = Convert.ToDouble(txtVATRate.Text.TrimEnd());
            txtVATRate.Text = VatRate.ToString("P2", CultureInfo.InvariantCulture);
        }
Ejemplo n.º 8
0
        public string Update()
        {
            CommissionAmount = (CommissionRate * Amount) / 100;
            CommissionAmount = Math.Round((decimal)CommissionAmount);
            VatOnAmount      = Amount + CommissionAmount;
            VatAmount        = (CommissionAmount + Amount) * VatRate / 100;
            VatAmount        = Math.Round((decimal)VatAmount);
            InvoiceAmount    = Amount + CommissionAmount + VatAmount;

            XDocument doc    = XDocument.Load(@"Transactions.xml");
            var       record = from r in doc.Descendants("Transaction")
                               where (int)r.Element("Invoice").Attribute("Id") == InvoiceId
                               select r;

            foreach (XElement r in record)
            {
                r.Element("Invoice").Element("InvoiceNo").Value        = InvoiceNo;
                r.Element("Invoice").Element("InvoiceDate").Value      = XmlConvert.ToString(InvoiceDate, XmlDateTimeSerializationMode.RoundtripKind);
                r.Element("Invoice").Element("CommissionRate").Value   = CommissionRate.ToString();
                r.Element("Invoice").Element("CommissionAmount").Value = CommissionAmount.ToString();
                r.Element("Invoice").Element("VatRate").Value          = VatRate.ToString();
                r.Element("Invoice").Element("VatAmount").Value        = VatAmount.ToString();
                r.Element("Invoice").Element("InvoiceAmount").Value    = InvoiceAmount.ToString();
                r.Element("Invoice").Element("Source").Value           = Source;
                r.Element("Invoice").Element("Destination").Value      = Destination;
                r.Element("Invoice").Element("TruckNo").Value          = TruckNo;
            }
            doc.Save(@"Transactions.xml");
            return("Record Updated");
        }
Ejemplo n.º 9
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            var model = new VatRate {
                Rate      = txtRate.ToInt(),
                RateName  = txtRateName.Text,
                StartDate = dteStartDate.Value,
                EndDate   = dteEndDate.Value
            };
            WriteRepository repository = new WriteRepository();

            if (panel1.Enabled)
            {
                model.ID = vatRates[index].ID;
                repository.UpdateVatRate(model);
            }
            else
            {
                repository.InsertVatRate(model);
                panel1.Enabled    = true;
                btnCancel.Visible = false;
                btnSave.Left      = btnClose.Left - btnSave.Width - 10;
                index             = vatRates.Count;
                panel1.Enabled    = true;
            }
            LoadVatRates();
            ShowVatRate();
        }
Ejemplo n.º 10
0
        public void CalculateSimplified(int precision)
        {
            VatRate vr = DictionaryMapper.Instance.GetVatRate(this.VatRateId);

            decimal vatRate = vr.Rate;

            if (((CommercialDocumentBase)this.Parent).CalculationType == CalculationType.Gross)
            {
                if (this.InitialGrossPrice == 0 && this.InitialNetPrice != 0)
                {
                    this.InitialGrossPrice = Decimal.Round(this.InitialNetPrice * (1 + vatRate / 100), precision, MidpointRounding.AwayFromZero);
                }

                if (this.GrossPrice != 0 && this.InitialGrossPrice != 0)
                {
                    this.DiscountRate = 100 * (1 - this.GrossPrice / this.InitialGrossPrice);
                }
            }
            else             //if (((CommercialDocument)this.Parent).CalculationType == CalculationType.Net)
            {
                if (this.NetPrice != 0 && this.InitialNetPrice != 0)
                {
                    this.DiscountRate = 100 * (1 - this.NetPrice / this.InitialNetPrice);
                }
                this.InitialGrossPrice = Decimal.Round(this.InitialNetPrice * (1 + vatRate / 100), precision, MidpointRounding.AwayFromZero);
            }
            //Ponieważ DiscountRate może mieć teraz po przeliczeniu więcej niż dwa miejsca po przecinku to zaokraglamy aby w bazie nie bylo przeklaman
            this.DiscountRate = Decimal.Round(this.DiscountRate, precision, MidpointRounding.AwayFromZero);

            this.DiscountGrossValue = Decimal.Round(this.InitialGrossPrice - this.GrossPrice, precision, MidpointRounding.AwayFromZero);
            this.DiscountNetValue   = Decimal.Round(this.InitialNetPrice - this.NetPrice, precision, MidpointRounding.AwayFromZero);
            this.InitialNetValue    = Decimal.Round(this.InitialNetPrice * this.Quantity, precision, MidpointRounding.AwayFromZero);
            this.InitialGrossValue  = Decimal.Round(this.InitialGrossPrice * this.Quantity, precision, MidpointRounding.AwayFromZero);
        }
Ejemplo n.º 11
0
 public double?CalculatePrice()
 {
     if (PriceWithVat.IsNullOrDefault() || VatRate.IsNullOrDefault())
     {
         return(null);
     }
     return(PriceWithVat / ((VatRate + 100) / 100));
 }
Ejemplo n.º 12
0
        public void Return_a_succesful_result_when_using_a_value_between_0_and_1(string stringValue)
        {
            decimal value = decimal.Parse(stringValue);

            var result = VatRate.Create(value);

            Assert.IsTrue(result.Success);
            Assert.AreEqual(value, result.Value.Value);
        }
Ejemplo n.º 13
0
        public void Return_a_failed_result_when_using_a_value_less_than_or_equal_to_0_or_higher_than_or_equal_to_1(string stringValue)
        {
            decimal value = decimal.Parse(stringValue);

            var result = VatRate.Create(value);

            Assert.IsTrue(result.IsFailure);
            Assert.IsNull(result.Value);
        }
Ejemplo n.º 14
0
 private NewExpenseViewModel(ServiceProvider serviceProvider, ExpenseType expenseType, VatRate vatRate)
 {
     DataService    = serviceProvider.GetService <IDataService>();
     ExpenseType    = expenseType;
     VatRatesSource = new CollectionViewSource()
     {
         Source = DataService.GetVatRates()
     };
     VatRate = vatRate;
 }
Ejemplo n.º 15
0
 private Good CreateGood(string sku, VatRate vatRate, string name, UnitOfMeasure uom, ProductCategory category, Part part)
 => new NonUnifiedGoodBuilder(this.Session)
 .WithProductIdentification(new SkuIdentificationBuilder(this.Session)
                            .WithIdentification(sku)
                            .WithProductIdentificationType(new ProductIdentificationTypes(this.Session).Sku).Build())
 .WithVatRate(vatRate)
 .WithName(name)
 .WithUnitOfMeasure(uom)
 .WithPart(part)
 .Build();
Ejemplo n.º 16
0
        public void ShouldSortByHighest(DateTime effectiveDate, int amount, List <Country> countries, ExpectedResult expectedResult)
        {
            var vatRate = new VatRate();

            vatRate.Countries.AddRange(countries);

            var lowestRates = vatRate.GetHighest(effectiveDate, amount);

            Assert.AreEqual(expectedResult.RatesCount, lowestRates.Count);
            Assert.AreEqual(expectedResult.FirstContryCode, lowestRates.FirstOrDefault()?.Code);
        }
Ejemplo n.º 17
0
        public void Create_a_purchase_info_given_valid_VatRate_and_GrossAmount()
        {
            VatRate     vatRate     = VatRate.Create(0.10m).Value;
            MoneyAmount grossAmount = MoneyAmount.Create(1.10m).Value;

            var result = PurchaseInfo.CreateWithGrossAmount(vatRate, grossAmount);

            Assert.AreEqual(vatRate.Value, result.VatRate.Value);
            Assert.AreEqual(grossAmount.Value, result.GrossAmount.Value);
            Assert.AreEqual(1.0m, result.NetAmount.Value);
            Assert.AreEqual(0.10m, result.VatAmount.Value);
        }
Ejemplo n.º 18
0
        public void Create_a_succesful_result_given_valid_VatRate_and_VatAmount()
        {
            VatRate     vatRate   = VatRate.Create(0.10m).Value;
            MoneyAmount vatAmount = MoneyAmount.Create(1).Value;

            var result = PurchaseInfo.CreateWithVatAmount(vatRate, vatAmount);

            Assert.AreEqual(vatRate.Value, result.VatRate.Value);
            Assert.AreEqual(vatAmount.Value, result.VatAmount.Value);
            Assert.AreEqual(11.0m, result.GrossAmount.Value);
            Assert.AreEqual(10.0m, result.NetAmount.Value);
        }
 public IActionResult SaveVatRate(VatRate vatRate)
 {
     if (ModelState.IsValid && vatRate != null)
     {
         var result = _dictionaryContainer.VatRateRepository.SaveVatRate(vatRate);
         return(Json(result));
     }
     else
     {
         return(Json("Niepoprawne dane wejściowe. Nie udało się zapisać stawki VAT"));
     }
 }
Ejemplo n.º 20
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public static VatRate GetVatRate(int orgId, string type)
        {
            VatRate        vatRate        = null;
            string         token          = GetApiAccessToken();
            string         currentUserUrl = $"api/orgs/{orgId}/vatrates/code({type})";
            HttpStatusCode statusCode;
            string         result;

            if (GetApiResultContent(currentUserUrl, token, out statusCode, out result))
            {
                vatRate = JsonConvert.DeserializeObject <VatRate>(result);
            }

            return(vatRate);
        }
Ejemplo n.º 21
0
        public async Task <IActionResult> Create([Bind("VatRateID,Name,Rate,Description,IsActive,AddedDate,UpdatedDate,AddedUserID,UpdatedUserID")] VatRate vatRate)
        {
            if (ModelState.IsValid)
            {
                vatRate.IsActive    = true;
                vatRate.AddedDate   = DateTime.Now;
                vatRate.AddedUserID = Int32.Parse(HttpContext.Session.GetString("UserID"));
                _context.Add(vatRate);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AddedUserID"]   = new SelectList(_context.Users, "UserID", "Login", vatRate.AddedUserID);
            ViewData["UpdatedUserID"] = new SelectList(_context.Users, "UserID", "Login", vatRate.UpdatedUserID);
            return(View(vatRate));
        }
Ejemplo n.º 22
0
        static async Task Main(string[] args)
        {
            Console.WriteLine("Rate calculation program");

            Initialize();
            var dtoRate = await _client.GetVatRates();

            VatRate rate = Mapper.Map <VatRateDto, VatRate>(dtoRate);

            Console.WriteLine($"Getting {RateCount} lowest vat rates:\n");
            PrintAsJson(rate.GetLowest(EffectiveDateFrom, RateCount));

            Console.WriteLine(new string('-', MaxLineLngth));

            Console.WriteLine($"Getting {RateCount} highest vat rates:\n");
            PrintAsJson(rate.GetHighest(EffectiveDateFrom, RateCount));

            Console.WriteLine("Please press any key to exit the program...");
            Console.ReadKey();
        }
Ejemplo n.º 23
0
        public Result <PurchaseInfoDto> Handle(GetPurchaseInfoQuery query)
        {
            List <string> errors = new List <string>();

            var vatRateResult = VatRate.Create(query.VatRate);

            if (vatRateResult.IsFailure)
            {
                errors.AddRange(vatRateResult.Errors);
            }

            var amountResult = MoneyAmount.Create(query.Amount);

            if (amountResult.IsFailure)
            {
                errors.AddRange(amountResult.Errors);
                return(Result <PurchaseInfoDto> .ResultFail(errors));
            }

            if (errors.Any())
            {
                return(Result <PurchaseInfoDto> .ResultFail(errors));
            }

            if (query.AmountType == AmountType.Gross)
            {
                return(MapPurchaseInfoToDto(PurchaseInfo.CreateWithGrossAmount(vatRateResult.Value, amountResult.Value)));
            }
            else if (query.AmountType == AmountType.Net)
            {
                return(MapPurchaseInfoToDto(PurchaseInfo.CreateWithNetAmount(vatRateResult.Value, amountResult.Value)));
            }
            else if (query.AmountType == AmountType.Vat)
            {
                return(MapPurchaseInfoToDto(PurchaseInfo.CreateWithVatAmount(vatRateResult.Value, amountResult.Value)));
            }
            else
            {
                throw new ArgumentException(nameof(AmountType));
            }
        }
Ejemplo n.º 24
0
        public Guid GetPrepaidItemId(CommercialDocument salesOrder, int stage, Guid vatRateId)
        {
            if (stage < 0)
            {
                throw new ArgumentException("Invalid stage", "stage");
            }

            XElement process = this.GetProcess(salesOrder);

            string stageName = "stage" + stage.ToString(CultureInfo.InvariantCulture);

            XElement vatRateElement = process.Element("configuration").Element("prepaidItems").Elements("vatRate").Where(p => p.Attribute("id").Value == vatRateId.ToUpperString()).FirstOrDefault();

            VatRate vatRate = DictionaryMapper.Instance.GetVatRate(vatRateId);

            if (vatRateElement == null)
            {
                throw new ClientException(ClientExceptionId.UnsupportedVatRate, null, "symbol:" + vatRate.Symbol);
            }

            Guid g = new Guid(vatRateElement.Element(stageName).Value);

            return(g);
        }
Ejemplo n.º 25
0
 public VatRateModel(VatRate model) : base(model)
 {
     Value = model.Value;
 }
Ejemplo n.º 26
0
 public static NewExpenseViewModel Create(ServiceProvider sp, ExpenseType expenseType, VatRate vat)
 {
     DataService    = serviceProvider.GetService <IDataService>();
     ExpenseType    = expenseType;
     VatRatesSource = new CollectionViewSource()
     {
         Source = DataService.GetVatRates()
     };
     VatRate = vatRate;
 }
Ejemplo n.º 27
0
 EmptyRelationshipsDto ITypeConverter <VatRate, EmptyRelationshipsDto> .Convert(VatRate source, EmptyRelationshipsDto destination, ResolutionContext context)
 {
     return(new EmptyRelationshipsDto());
 }
Ejemplo n.º 28
0
 public async Task Add(VatRate vatRate)
 => await _context.VatRates.AddAsync(vatRate);
Ejemplo n.º 29
0
        public override void Init()
        {
            base.Init();

            var euro = new Currencies(this.DatabaseSession).FindBy(Currencies.Meta.IsoCode, "EUR");

            this.internalOrganisation = new InternalOrganisations(this.DatabaseSession).FindBy(InternalOrganisations.Meta.Name, "internalOrganisation");
            this.internalOrganisation.PreferredCurrency = euro;

            this.supplier = new OrganisationBuilder(this.DatabaseSession).WithName("supplier").Build();

            this.vatRate21 = new VatRateBuilder(this.DatabaseSession).WithRate(21).Build();

            var mechelen = new CityBuilder(this.DatabaseSession).WithName("Mechelen").Build();
            this.kiev = new CityBuilder(this.DatabaseSession).WithName("Kiev").Build();

            this.shipToContactMechanismMechelen = new PostalAddressBuilder(this.DatabaseSession).WithGeographicBoundary(mechelen).WithAddress1("Haverwerf 15").Build();
            this.shipToContactMechanismKiev = new PostalAddressBuilder(this.DatabaseSession).WithGeographicBoundary(this.kiev).WithAddress1("Dnieper").Build();
            this.shipToCustomer = new OrganisationBuilder(this.DatabaseSession).WithName("shipToCustomer").Build();
            this.shipToCustomer.AddPartyContactMechanism(new PartyContactMechanismBuilder(this.DatabaseSession)
                                                            .WithContactMechanism(this.shipToContactMechanismKiev)
                                                            .WithContactPurpose(new ContactMechanismPurposes(this.DatabaseSession).ShippingAddress)
                                                            .WithUseAsDefault(true)
                                                            .Build());

            this.billToCustomer = new OrganisationBuilder(this.DatabaseSession)
                .WithName("billToCustomer")
                .WithPreferredCurrency(euro)
                .Build();

            this.billToCustomer.AddPartyContactMechanism(new PartyContactMechanismBuilder(this.DatabaseSession)
                                                            .WithContactMechanism(this.shipToContactMechanismKiev)
                                                            .WithContactPurpose(new ContactMechanismPurposes(this.DatabaseSession).BillingAddress)
                                                            .WithUseAsDefault(true)
                                                            .Build());

            this.part = new FinishedGoodBuilder(this.DatabaseSession).WithName("part").Build();

            this.ancestorProductCategory = new ProductCategoryBuilder(this.DatabaseSession).WithDescription("ancestor").Build();
            this.parentProductCategory = new ProductCategoryBuilder(this.DatabaseSession).WithDescription("parent").WithParent(this.ancestorProductCategory).Build();
            this.productCategory = new ProductCategoryBuilder(this.DatabaseSession).WithDescription("gizmo").Build();
            this.productCategory.AddParent(this.parentProductCategory);

            this.good = new GoodBuilder(this.DatabaseSession)
                .WithSku("10101")
                .WithVatRate(this.vatRate21)
                .WithName("good")
                .WithProductCategory(this.productCategory)
                .WithFinishedGood(this.part)
                .WithUnitOfMeasure(new UnitsOfMeasure(this.DatabaseSession).Piece)
                .Build();

            new SupplierRelationshipBuilder(this.DatabaseSession)
                .WithInternalOrganisation(this.internalOrganisation)
                .WithSupplier(this.supplier)
                .WithFromDate(DateTime.UtcNow)
                .Build();

            new CustomerRelationshipBuilder(this.DatabaseSession)
                .WithCustomer(this.billToCustomer)
                .WithInternalOrganisation(Singleton.Instance(this.DatabaseSession).DefaultInternalOrganisation)
                .Build();

            new CustomerRelationshipBuilder(this.DatabaseSession)
                .WithCustomer(this.shipToCustomer)
                .WithInternalOrganisation(Singleton.Instance(this.DatabaseSession).DefaultInternalOrganisation)
                .Build();

            this.partyRevenueHistory = new PartyRevenueHistoryBuilder(this.DatabaseSession)
                .WithCurrency(euro)
                .WithInternalOrganisation(this.internalOrganisation)
                .WithParty(this.billToCustomer)
                .WithRevenue(100M)
                .Build();

            this.productCategoryRevenueHistory = new PartyProductCategoryRevenueHistoryBuilder(this.DatabaseSession)
                .WithCurrency(euro)
                .WithInternalOrganisation(this.internalOrganisation)
                .WithParty(this.billToCustomer)
                .WithProductCategory(this.productCategory)
                .WithRevenue(100M)
                .WithQuantity(10)
                .Build();

            this.parentProductCategoryRevenueHistory = new PartyProductCategoryRevenueHistoryBuilder(this.DatabaseSession)
                .WithCurrency(euro)
                .WithInternalOrganisation(this.internalOrganisation)
                .WithParty(this.billToCustomer)
                .WithProductCategory(this.parentProductCategory)
                .WithRevenue(100M)
                .WithQuantity(10)
                .Build();

            this.ancestorProductCategoryRevenueHistory = new PartyProductCategoryRevenueHistoryBuilder(this.DatabaseSession)
                .WithCurrency(euro)
                .WithInternalOrganisation(this.internalOrganisation)
                .WithParty(this.billToCustomer)
                .WithProductCategory(this.ancestorProductCategory)
                .WithRevenue(100M)
                .WithQuantity(10)
                .Build();

            this.variantGood = new GoodBuilder(this.DatabaseSession)
               .WithSku("v10101")
               .WithVatRate(this.vatRate21)
               .WithName("variant good")
               .WithUnitOfMeasure(new UnitsOfMeasure(this.DatabaseSession).Piece)
               .WithInventoryItemKind(new InventoryItemKinds(this.DatabaseSession).NonSerialized)
               .Build();

            this.variantGood2 = new GoodBuilder(this.DatabaseSession)
                .WithSku("v10102")
                .WithVatRate(this.vatRate21)
                .WithName("variant good2")
                .WithUnitOfMeasure(new UnitsOfMeasure(this.DatabaseSession).Piece)
                .WithInventoryItemKind(new InventoryItemKinds(this.DatabaseSession).NonSerialized)
                .Build();

            this.virtualGood = new GoodBuilder(this.DatabaseSession)
                .WithSku("v10103")
                .WithVatRate(this.vatRate21)
                .WithName("virtual good")
                .WithVariant(this.variantGood)
                .WithVariant(this.variantGood2)
                .WithUnitOfMeasure(new UnitsOfMeasure(this.DatabaseSession).Piece)
                .WithInventoryItemKind(new InventoryItemKinds(this.DatabaseSession).NonSerialized)
                .Build();

            this.goodPurchasePrice = new ProductPurchasePriceBuilder(this.DatabaseSession)
                .WithCurrency(euro)
                .WithFromDate(DateTime.UtcNow)
                .WithPrice(7)
                .WithUnitOfMeasure(new UnitsOfMeasure(this.DatabaseSession).Piece)
                .Build();

            this.goodSupplierOffering = new SupplierOfferingBuilder(this.DatabaseSession)
                .WithProduct(this.good)
                .WithSupplier(this.supplier)
                .WithFromDate(DateTime.UtcNow)
                .WithProductPurchasePrice(this.goodPurchasePrice)
                .Build();

            this.virtualGoodPurchasePrice = new ProductPurchasePriceBuilder(this.DatabaseSession)
                .WithCurrency(euro)
                .WithFromDate(DateTime.UtcNow)
                .WithPrice(8)
                .WithUnitOfMeasure(new UnitsOfMeasure(this.DatabaseSession).Piece)
                .Build();

            this.virtualgoodSupplierOffering = new SupplierOfferingBuilder(this.DatabaseSession)
                .WithProduct(this.virtualGood)
                .WithSupplier(this.supplier)
                .WithFromDate(DateTime.UtcNow)
                .WithProductPurchasePrice(this.virtualGoodPurchasePrice)
                .Build();

            this.feature1 = new ColourBuilder(this.DatabaseSession)
                .WithName("white")
                .WithVatRate(this.vatRate21)
                .WithLocalisedName(new LocalisedTextBuilder(this.DatabaseSession)
                                            .WithText("white")
                                            .WithLocale(Singleton.Instance(this.DatabaseSession).DefaultLocale)
                                            .Build())
                .Build();

            this.feature2 = new ColourBuilder(this.DatabaseSession)
                .WithName("black")
                .WithLocalisedName(new LocalisedTextBuilder(this.DatabaseSession)
                                            .WithText("black")
                                            .WithLocale(Singleton.Instance(this.DatabaseSession).DefaultLocale)
                                            .Build())
                .Build();

            this.currentBasePriceGeoBoundary = new BasePriceBuilder(this.DatabaseSession)
                .WithSpecifiedFor(this.internalOrganisation)
                .WithDescription("current BasePriceGeoBoundary ")
                .WithGeographicBoundary(mechelen)
                .WithProduct(this.good)
                .WithPrice(8)
                .WithFromDate(DateTime.UtcNow)
                .Build();

            // previous basePrice for good
            new BasePriceBuilder(this.DatabaseSession).WithDescription("previous good")
                .WithSpecifiedFor(this.internalOrganisation)
                .WithProduct(this.good)
                .WithPrice(8)
                .WithFromDate(DateTime.UtcNow.AddYears(-1))
                .WithThroughDate(DateTime.UtcNow.AddDays(-1))
                .Build();

            // future basePrice for good
            new BasePriceBuilder(this.DatabaseSession).WithDescription("future good")
                .WithSpecifiedFor(this.internalOrganisation)
                .WithProduct(this.good)
                .WithPrice(11)
                .WithFromDate(DateTime.UtcNow.AddYears(1))
                .Build();

            this.currentGoodBasePrice = new BasePriceBuilder(this.DatabaseSession)
                .WithSpecifiedFor(this.internalOrganisation)
                .WithDescription("current good")
                .WithProduct(this.good)
                .WithPrice(10)
                .WithFromDate(DateTime.UtcNow)
                .WithThroughDate(DateTime.UtcNow.AddYears(1).AddDays(-1))
                .Build();

            // previous basePrice for feature1
            new BasePriceBuilder(this.DatabaseSession).WithDescription("previous feature1")
                .WithSpecifiedFor(this.internalOrganisation)
                .WithProductFeature(this.feature1)
                .WithPrice(0.5M)
                .WithFromDate(DateTime.UtcNow.AddYears(-1))
                .WithThroughDate(DateTime.UtcNow.AddDays(-1))
                .Build();

            // future basePrice for feature1
            new BasePriceBuilder(this.DatabaseSession).WithDescription("future feature1")
                .WithSpecifiedFor(this.internalOrganisation)
                .WithProductFeature(this.feature1)
                .WithPrice(2.5M)
                .WithFromDate(DateTime.UtcNow.AddYears(1))
                .Build();

            new BasePriceBuilder(this.DatabaseSession)
                .WithSpecifiedFor(this.internalOrganisation)
                .WithDescription("current feature1")
                .WithProductFeature(this.feature1)
                .WithPrice(2)
                .WithFromDate(DateTime.UtcNow)
                .WithThroughDate(DateTime.UtcNow.AddYears(1).AddDays(-1))
                .Build();

            // previous basePrice for feature2
            new BasePriceBuilder(this.DatabaseSession).WithDescription("previous feature2")
                .WithSpecifiedFor(this.internalOrganisation)
                .WithProductFeature(this.feature2)
                .WithPrice(2)
                .WithFromDate(DateTime.UtcNow.AddYears(-1))
                .WithThroughDate(DateTime.UtcNow.AddDays(-1))
                .Build();

            // future basePrice for feature2
            new BasePriceBuilder(this.DatabaseSession)
                .WithSpecifiedFor(this.internalOrganisation)
                .WithDescription("future feature2")
                .WithProductFeature(this.feature2)
                .WithPrice(4)
                .WithFromDate(DateTime.UtcNow.AddYears(1))
                .Build();

            this.currentFeature2BasePrice = new BasePriceBuilder(this.DatabaseSession)
                .WithSpecifiedFor(this.internalOrganisation)
                .WithDescription("current feature2")
                .WithProductFeature(this.feature2)
                .WithPrice(3)
                .WithFromDate(DateTime.UtcNow)
                .WithThroughDate(DateTime.UtcNow.AddYears(1).AddDays(-1))
                .Build();

            // previous basePrice for good with feature1
            new BasePriceBuilder(this.DatabaseSession).WithDescription("previous good/feature1")
                .WithSpecifiedFor(this.internalOrganisation)
                .WithProduct(this.good)
                .WithProductFeature(this.feature1)
                .WithPrice(4)
                .WithFromDate(DateTime.UtcNow.AddYears(-1))
                .WithThroughDate(DateTime.UtcNow.AddDays(-1))
                .Build();

            // future basePrice for good with feature1
            new BasePriceBuilder(this.DatabaseSession)
                .WithSpecifiedFor(this.internalOrganisation)
                .WithDescription("future good/feature1")
                .WithProduct(this.good)
                .WithProductFeature(this.feature1)
                .WithPrice(6)
                .WithFromDate(DateTime.UtcNow.AddYears(1))
                .Build();

            this.currentGood1Feature1BasePrice = new BasePriceBuilder(this.DatabaseSession)
                .WithSpecifiedFor(this.internalOrganisation)
                .WithDescription("current good/feature1")
                .WithProduct(this.good)
                .WithProductFeature(this.feature1)
                .WithPrice(5)
                .WithFromDate(DateTime.UtcNow)
                .WithThroughDate(DateTime.UtcNow.AddYears(1).AddDays(-1))
                .Build();

            new BasePriceBuilder(this.DatabaseSession)
                .WithSpecifiedFor(this.internalOrganisation)
                .WithDescription("current variant good2")
                .WithProduct(this.variantGood2)
                .WithPrice(11)
                .WithFromDate(DateTime.UtcNow)
                .Build();

            this.DatabaseSession.Derive(true);
            this.DatabaseSession.Commit();

            this.order = new SalesOrderBuilder(this.DatabaseSession)
                .WithShipToCustomer(this.shipToCustomer)
                .WithBillToCustomer(this.billToCustomer)
                .WithTakenByInternalOrganisation(this.internalOrganisation)
                .Build();

            this.DatabaseSession.Derive(true);
            this.DatabaseSession.Commit();
        }
Ejemplo n.º 30
0
        public override void Init()
        {
            base.Init();

            var euro = new Currencies(this.DatabaseSession).FindBy(Currencies.Meta.IsoCode, "EUR");

            this.supplier = new OrganisationBuilder(this.DatabaseSession).WithName("supplier").WithLocale(new Locales(this.DatabaseSession).EnglishGreatBritain).Build();

            this.internalOrganisation = new InternalOrganisations(this.DatabaseSession).FindBy(InternalOrganisations.Meta.Name, "internalOrganisation");

            this.vatRate21 = new VatRateBuilder(this.DatabaseSession).WithRate(21).Build();

            this.mechelen = new CityBuilder(this.DatabaseSession).WithName("Mechelen").Build();
            this.kiev = new CityBuilder(this.DatabaseSession).WithName("Kiev").Build();

            this.billToContactMechanismMechelen = new PostalAddressBuilder(this.DatabaseSession).WithAddress1("Mechelen").WithGeographicBoundary(this.mechelen).Build();
            this.shipToContactMechanismKiev = new PostalAddressBuilder(this.DatabaseSession).WithAddress1("Kiev").WithGeographicBoundary(this.kiev).Build();
            this.billToCustomer = new OrganisationBuilder(this.DatabaseSession).WithName("billToCustomer").WithPreferredCurrency(euro).Build();

            this.shipToCustomer = new OrganisationBuilder(this.DatabaseSession).WithName("shipToCustomer").WithPreferredCurrency(euro).Build();

            new CustomerRelationshipBuilder(this.DatabaseSession).WithFromDate(DateTime.UtcNow).WithCustomer(this.billToCustomer).WithInternalOrganisation(this.internalOrganisation).Build();
            new CustomerRelationshipBuilder(this.DatabaseSession).WithFromDate(DateTime.UtcNow).WithCustomer(this.shipToCustomer).WithInternalOrganisation(this.internalOrganisation).Build();

            this.DatabaseSession.Derive(true);

            this.good = new GoodBuilder(this.DatabaseSession)
                .WithSku("10101")
                .WithVatRate(this.vatRate21)
                .WithName("good")
                .WithInventoryItemKind(new InventoryItemKinds(this.DatabaseSession).NonSerialized)
                .WithUnitOfMeasure(new UnitsOfMeasure(this.DatabaseSession).Piece)
                .Build();

            this.feature1 = new ColourBuilder(this.DatabaseSession)
                .WithName("white")
                .WithVatRate(this.vatRate21)
                .WithLocalisedName(new LocalisedTextBuilder(this.DatabaseSession)
                                            .WithText("white")
                                            .WithLocale(Singleton.Instance(this.DatabaseSession).DefaultLocale)
                                            .Build())
                .Build();

            this.feature2 = new ColourBuilder(this.DatabaseSession)
                .WithName("black")
                .WithLocalisedName(new LocalisedTextBuilder(this.DatabaseSession)
                                            .WithText("black")
                                            .WithLocale(Singleton.Instance(this.DatabaseSession).DefaultLocale)
                                            .Build())
                .Build();

            this.goodPurchasePrice = new ProductPurchasePriceBuilder(this.DatabaseSession)
                .WithCurrency(euro)
                .WithFromDate(DateTime.UtcNow.AddMinutes(-1))
                .WithPrice(7)
                .WithUnitOfMeasure(new UnitsOfMeasure(this.DatabaseSession).Piece)
                .Build();

            this.goodSupplierOffering = new SupplierOfferingBuilder(this.DatabaseSession)
                .WithProduct(this.good)
                .WithSupplier(this.supplier)
                .WithFromDate(DateTime.UtcNow.AddMinutes(-1))
                .WithProductPurchasePrice(this.goodPurchasePrice)
                .Build();

            this.currentBasePriceGeoBoundary = new BasePriceBuilder(this.DatabaseSession)
                .WithSpecifiedFor(this.internalOrganisation)
                .WithDescription("current BasePriceGeoBoundary")
                .WithGeographicBoundary(this.mechelen)
                .WithProduct(this.good)
                .WithPrice(8)
                .WithFromDate(DateTime.UtcNow.AddMinutes(-1))
                .Build();

            // previous basePrice for good
            new BasePriceBuilder(this.DatabaseSession).WithDescription("previous good")
                .WithSpecifiedFor(this.internalOrganisation)
                .WithProduct(this.good)
                .WithPrice(8)
                .WithFromDate(DateTime.UtcNow.AddYears(-1))
                .WithThroughDate(DateTime.UtcNow.AddDays(-1))
                .Build();

            this.currentGood1BasePrice = new BasePriceBuilder(this.DatabaseSession)
                .WithSpecifiedFor(this.internalOrganisation)
                .WithDescription("current good")
                .WithProduct(this.good)
                .WithPrice(10)
                .WithFromDate(DateTime.UtcNow.AddMinutes(-1))
                .WithThroughDate(DateTime.UtcNow.AddYears(1).AddDays(-1))
                .Build();

            // future basePrice for good
            new BasePriceBuilder(this.DatabaseSession).WithDescription("future good")
                .WithSpecifiedFor(this.internalOrganisation)
                .WithProduct(this.good)
                .WithPrice(11)
                .WithFromDate(DateTime.UtcNow.AddYears(1))
                .Build();

            // previous basePrice for feature1
            new BasePriceBuilder(this.DatabaseSession).WithDescription("previous feature1")
                .WithSpecifiedFor(this.internalOrganisation)
                .WithProductFeature(this.feature1)
                .WithPrice(0.5M)
                .WithFromDate(DateTime.UtcNow.AddYears(-1))
                .WithThroughDate(DateTime.UtcNow.AddDays(-1))
                .Build();

            // future basePrice for feature1
            new BasePriceBuilder(this.DatabaseSession).WithDescription("future feature1")
                .WithSpecifiedFor(this.internalOrganisation)
                .WithProductFeature(this.feature1)
                .WithPrice(2.5M)
                .WithFromDate(DateTime.UtcNow.AddYears(1))
                .Build();

            this.currentFeature1BasePrice = new BasePriceBuilder(this.DatabaseSession)
                .WithSpecifiedFor(this.internalOrganisation)
                .WithDescription("current feature1")
                .WithProductFeature(this.feature1)
                .WithPrice(2)
                .WithFromDate(DateTime.UtcNow.AddMinutes(-1))
                .WithThroughDate(DateTime.UtcNow.AddYears(1).AddDays(-1))
                .Build();

            // previous basePrice for feature2
            new BasePriceBuilder(this.DatabaseSession).WithDescription("previous feature2")
                .WithSpecifiedFor(this.internalOrganisation)
                .WithProductFeature(this.feature2)
                .WithPrice(2)
                .WithFromDate(DateTime.UtcNow.AddYears(-1))
                .WithThroughDate(DateTime.UtcNow.AddDays(-1))
                .Build();

            // future basePrice for feature2
            new BasePriceBuilder(this.DatabaseSession)
                .WithSpecifiedFor(this.internalOrganisation)
                .WithDescription("future feature2")
                .WithProductFeature(this.feature2)
                .WithPrice(4)
                .WithFromDate(DateTime.UtcNow.AddYears(1))
                .Build();

            new BasePriceBuilder(this.DatabaseSession)
                .WithSpecifiedFor(this.internalOrganisation)
                .WithDescription("current feature2")
                .WithProductFeature(this.feature2)
                .WithPrice(3)
                .WithFromDate(DateTime.UtcNow.AddMinutes(-1))
                .WithThroughDate(DateTime.UtcNow.AddYears(1).AddDays(-1))
                .Build();

            // previous basePrice for good with feature1
            new BasePriceBuilder(this.DatabaseSession).WithDescription("previous good/feature1")
                .WithSpecifiedFor(this.internalOrganisation)
                .WithProduct(this.good)
                .WithProductFeature(this.feature1)
                .WithPrice(4)
                .WithFromDate(DateTime.UtcNow.AddYears(-1))
                .WithThroughDate(DateTime.UtcNow.AddDays(-1))
                .Build();

            // future basePrice for good with feature1
            new BasePriceBuilder(this.DatabaseSession)
                .WithSpecifiedFor(this.internalOrganisation)
                .WithDescription("future good/feature1")
                .WithProduct(this.good)
                .WithProductFeature(this.feature1)
                .WithPrice(6)
                .WithFromDate(DateTime.UtcNow.AddYears(1))
                .Build();

            this.currentGood1Feature1BasePrice = new BasePriceBuilder(this.DatabaseSession)
                .WithSpecifiedFor(this.internalOrganisation)
                .WithDescription("current good/feature1")
                .WithProduct(this.good)
                .WithProductFeature(this.feature1)
                .WithPrice(5)
                .WithFromDate(DateTime.UtcNow.AddMinutes(-1))
                .WithThroughDate(DateTime.UtcNow.AddYears(1).AddDays(-1))
                .Build();

            this.invoice = new SalesInvoiceBuilder(this.DatabaseSession)
                .WithSalesInvoiceType(new SalesInvoiceTypes(this.DatabaseSession).SalesInvoice)
                .WithBillToContactMechanism(this.billToContactMechanismMechelen)
                .WithBillToCustomer(this.billToCustomer)
                .WithShipToAddress(this.shipToContactMechanismKiev)
                .WithShipToCustomer(this.shipToCustomer)
                .WithBilledFromInternalOrganisation(this.internalOrganisation)
                .Build();

            this.DatabaseSession.Derive(true);
            this.DatabaseSession.Commit();
        }
Ejemplo n.º 31
0
        public SaleViewController(Sale sale)
        {
            Model = sale;

            string readFile(string fileName)
            {
                var assemblyFullName = Assembly.GetCallingAssembly()
                                       .FullName;

                var assembly = assemblyFullName.Substring(0, assemblyFullName.IndexOf(","));

                var stream = System.Windows.Application.GetResourceStream(new Uri(string.Format(assembly + ";component/Resources/{0}", fileName),
                                                                                  UriKind.Relative));
                var bytes = new byte[stream.Stream.Length];

                stream.Stream.Read(bytes, 0, bytes.Length);

                return(Encoding.UTF8.GetString(bytes));;
            }

            var vat = new VatRate()
            {
                Id   = Guid.NewGuid(),
                Name = "Vat",
                Rate = 0.16M
            };

            Products = readFile("products.txt")
                       .Split(Environment.NewLine)
                       .Select((a, i) => (a, i))
                       .Where(a => a.i % 10 == 0)
                       .Select(a => a.a.Split('\t'))
                       .Select(a => new Product
            {
                Id        = Guid.NewGuid(),
                Name      = a[0],
                SalePrice = decimal.Parse(a[1]),
                VatRate   = vat,
            })
                       .ToArray();

            Customers = readFile("customers.txt")
                        .Split(Environment.NewLine)
                        .Select((a, i) => (a, i))
                        .Where(a => a.i % 10 == 0)
                        .Select(a => a.a.Split('\t'))
                        .Select(a => new Customer
            {
                Id   = Guid.NewGuid(),
                Name = a[0],
            })
                        .ToArray();

            Branches = new[]
            {
                new Branch()
                {
                    Name = "HQ",
                    Id   = Guid.NewGuid()
                },
                new Branch()
                {
                    Name = "Nairobi Depot",
                    Id   = Guid.NewGuid()
                },
            };

            Salespersons = new[]
            {
                new Salesperson()
                {
                    FirstName = "James",
                    LastName  = "Bond",
                    Id        = Guid.NewGuid()
                },
                new Salesperson()
                {
                    FirstName = "John",
                    LastName  = "McClane",
                    Id        = Guid.NewGuid()
                }
            };
        }
Ejemplo n.º 32
0
 private void InstantiateObjects(ISession session)
 {
     this.productCategory = (ProductCategory)session.Instantiate(this.productCategory);
     this.parentProductCategory = (ProductCategory)session.Instantiate(this.parentProductCategory);
     this.ancestorProductCategory = (ProductCategory)session.Instantiate(this.ancestorProductCategory);
     this.part = (FinishedGood)session.Instantiate(this.part);
     this.good = (Good)session.Instantiate(this.good);
     this.feature1 = (Colour)session.Instantiate(this.feature1);
     this.feature2 = (Colour)session.Instantiate(this.feature2);
     this.internalOrganisation = (InternalOrganisation)session.Instantiate(this.internalOrganisation);
     this.shipToCustomer = (Organisation)session.Instantiate(this.shipToCustomer);
     this.billToCustomer = (Organisation)session.Instantiate(this.billToCustomer);
     this.supplier = (Organisation)session.Instantiate(this.supplier);
     this.kiev = (City)session.Instantiate(this.kiev);
     this.shipToContactMechanismMechelen = (PostalAddress)session.Instantiate(this.shipToContactMechanismMechelen);
     this.shipToContactMechanismKiev = (PostalAddress)session.Instantiate(this.shipToContactMechanismKiev);
     this.currentBasePriceGeoBoundary = (BasePrice)session.Instantiate(this.currentBasePriceGeoBoundary);
     this.currentGoodBasePrice = (BasePrice)session.Instantiate(this.currentGoodBasePrice);
     this.currentGood1Feature1BasePrice = (BasePrice)session.Instantiate(this.currentGood1Feature1BasePrice);
     this.currentFeature2BasePrice = (BasePrice)session.Instantiate(this.currentFeature2BasePrice);
     this.goodPurchasePrice = (ProductPurchasePrice)session.Instantiate(this.goodPurchasePrice);
     this.virtualGoodPurchasePrice = (ProductPurchasePrice)session.Instantiate(this.virtualGoodPurchasePrice);
     this.currentGoodBasePrice = (BasePrice)session.Instantiate(this.currentGoodBasePrice);
     this.goodSupplierOffering = (SupplierOffering)session.Instantiate(this.goodSupplierOffering);
     this.virtualgoodSupplierOffering = (SupplierOffering)session.Instantiate(this.virtualgoodSupplierOffering);
     this.order = (SalesOrder)session.Instantiate(this.order);
     this.vatRate21 = (VatRate)session.Instantiate(this.vatRate21);
 }
 public override void FillCongressVotingArguments(CongressVoting voting)
 {
     voting.Argument1 = ((int)ProductType).ToString();
     voting.Argument2 = VatRate.ToString();
 }