Пример #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="T:System.Object"/> class.
 /// </summary>
 public BillJsonModel(Bill bill)
 {
     Id = bill.Id;
     User = String.Format("{0} ({1})", bill.User.Company, bill.User.FIO);
     Amount = bill.Amount.ToString("0");
     Payed = bill.Payed;
     switch (bill.ActivationTarget)
     {
         case "tariff":
             ActivationTarget = "Тариф 'Золотой Поставщик'";
             ActivationAmount = String.Format("на {0} месяцев", bill.ActivationAmount);
             break;
         case "hot-products":
             ActivationTarget = "Оплата показа Горячих товаров";
             ActivationAmount = String.Format("{0} показов", bill.ActivationAmount);
             break;
         case "banners":
             ActivationTarget = "Создание баннера";
             break;
     }
     Activated = bill.Activated;
     DateCreated = bill.DateCreated;
     DateModified = bill.DateActivated;
 }
Пример #2
0
        public ActionResult HotProductsLegalBill(long shows, string companyName)
        {
            // Репозиторий
            var rep = Locator.GetService<IBillsRepository>();
            double price = 30.0/1000.0*shows;

            // Создаем и отображаем счет
            var bill = new Bill()
            {
                User = CurrentUser,
                ActivationTarget = "hot-products",
                ActivationAmount = (int)shows,
                DateCreated = DateTime.Now,
                Amount = (decimal) price
            };
            rep.Add(bill);
            rep.SubmitChanges();

            ViewBag.company = companyName;
            ViewBag.price = price;
            ViewBag.shows = shows;
            return View(bill);
        }
Пример #3
0
        public ActionResult GoldVendorPhysBill(long period, string fio, string address)
        {
            // Репозиторий
            var rep = Locator.GetService<IBillsRepository>();
            var settingsRep = Locator.GetService<ISettingsRepository>();
            var price = settingsRep.GetValue<decimal>("gold" + period);

            // Создаем и отображаем счет
            var bill = new Bill()
            {
                User = CurrentUser,
                ActivationTarget = "tariff",
                ActivationAmount = (int)period,
                DateCreated = DateTime.Now,
                Amount = price
            };
            rep.Add(bill);
            rep.SubmitChanges();

            ViewBag.fio = fio;
            ViewBag.address = address;
            ViewBag.price = price;
            ViewBag.period = period;
            return View(bill);
        }
Пример #4
0
        public ActionResult BannerPhysBill(string fio, string address)
        {
            // Репозиторий
            var rep = Locator.GetService<IBillsRepository>();
            double price = 3000.0;

            // Создаем и отображаем счет
            var bill = new Bill()
            {
                User = CurrentUser,
                ActivationTarget = "banners",
                ActivationAmount = 1,
                DateCreated = DateTime.Now,
                Amount = (decimal)price
            };
            rep.Add(bill);
            rep.SubmitChanges();

            ViewBag.fio = fio;
            ViewBag.address = address;
            ViewBag.price = price;
            return View(bill);
        }
Пример #5
0
		private void detach_Bills(Bill entity)
		{
			this.SendPropertyChanging();
			entity.User = null;
		}
Пример #6
0
		private void attach_Bills(Bill entity)
		{
			this.SendPropertyChanging();
			entity.User = this;
		}