コード例 #1
0
        public Message AddOrEdit(Pricing pricing)
        {
            var message = new Message();
            var ID      = pricing.PricingID;
            int result  = _iPricingRepository.AddOrEdit(pricing);

            try
            {
                if (result > 0)
                {
                    if (Convert.ToInt32(ID) > 0)
                    {
                        message = Message.SetMessages.SetSuccessMessage("Submission Updated Successfully!");
                    }
                    else
                    {
                        message = Message.SetMessages.SetSuccessMessage("Submission Successful!");
                    }
                }
                else
                {
                    message = Message.SetMessages.SetErrorMessage("Could not be submitted!");
                }
            }
            catch (Exception e)
            {
                message = Message.SetMessages.SetWarningMessage(e.Message.ToString());
            }

            return(message);
        }
コード例 #2
0
        private UpsertResult <Pricing> UpsertPricing(Printing printing, JObject prices, bool foil)
        {
            var result = new UpsertResult <Pricing>();

            var properties = prices.Properties();

            foreach (var property in properties)
            {
                if (DateTime.TryParse(property.Name, out DateTime date))
                {
                    var dbPricing = printing.Pricings.Where(p => p.Date.Date == date.Date && p.Foil == foil).FirstOrDefault();
                    if (dbPricing == null)
                    {
                        dbPricing = new Pricing()
                        {
                            Printing = printing,
                            Foil     = foil,
                            Date     = date
                        };

                        //db.Pricings.Add(dbPricing);
                        result.ObjectsToAdd.Add(dbPricing);
                    }

                    dbPricing.Price = property.Value.HasValues ? (double)property.Value : 0;
                }
            }

            return(result);
        }
コード例 #3
0
 public TestProducts()
 {
     pricing["Regular"] = new Pricing(5.0M);
     pricing["Sale"]    = new Pricing(5.0M, 2.5M);
     pricing["Group"]   = new Pricing(5.0M, 2.5M, 2);
     pricing["Bogo"]    = new Pricing(5.0M, 2.5M, 2, 1);
 }
コード例 #4
0
        public void Test_PromoHit_A1Time_B2Time()
        {
            List <CartItem> shoppingCart = new List <CartItem> {
                new CartItem {
                    Key = "A", Count = 3
                },
                new CartItem {
                    Key = "B", Count = 5
                },
                new CartItem {
                    Key = "C", Count = 0
                },
                new CartItem {
                    Key = "D", Count = 0
                }
            };

            var log = new PromoEngineEventLogTrace(shoppingCart);

            promotionRuleEngine.Process(shoppingCart, log.HandlePromoDiscount, log.CalculateTotal);

            Assert.True(log.Details.Values.Where(x => x.Item1 == A3).Count() == 1);
            Assert.True(log.Details.Values.Where(x => x.Item1 == B2).Count() == 2);

            Assert.Equal(3, log.Details.Count);
            Assert.Equal(1 * Pricing.PromoPrice(A3) + 2 * Pricing.PromoPrice(B2) + Pricing.Price("B"), log.TotalAmount);
        }
コード例 #5
0
        public void Test_PromoHit_A_OneTime()
        {
            List <CartItem> shoppingCart = new List <CartItem> {
                new CartItem {
                    Key = "A", Count = 3
                },
                new CartItem {
                    Key = "B", Count = 0
                },
                new CartItem {
                    Key = "C", Count = 0
                },
                new CartItem {
                    Key = "D", Count = 0
                }
            };

            var log = new PromoEngineEventLogTrace(shoppingCart);

            promotionRuleEngine.Process(shoppingCart, log.HandlePromoDiscount, log.CalculateTotal);

            Assert.True(log.Details.Values.Where(x => x.Item1 == A3).Any());
            Assert.Single(log.Details);
            Assert.Equal(Pricing.PromoPrice(A3), log.TotalAmount);
        }
コード例 #6
0
        public static List <Pricing> GetAppPrices(IEnumerable <long> appIDs, string countryCode)
        {
            if (appIDs == null || !appIDs.Any())
            {
                return(null);
            }
            string url = $"{BaseUrl}?appids={string.Join(",", appIDs)}&cc={countryCode}&filters=price_overview";

            string  json   = ApiRequester.GetJson(url);
            JObject tokens = JsonConvert.DeserializeObject <JObject>(json);

            List <Pricing> prices = new List <Pricing>();

            foreach (JProperty prop in tokens.Properties())
            {
                var     data = tokens[prop.Name]["data"];
                Pricing pricing;
                if (data.HasValues)
                {
                    pricing = data["price_overview"].ToObject <Pricing>();
                }
                else
                {
                    pricing = new Pricing {
                        Initial            = null,
                        Final              = null,
                        DiscountPercentage = null
                    };
                }
                pricing.AppID = Convert.ToInt64(prop.Name);
                prices.Add(pricing);
            }
            return(prices);
        }
コード例 #7
0
        public void Test_PromoHit_CD_10Time()
        {
            List <CartItem> shoppingCart = new List <CartItem> {
                new CartItem {
                    Key = "A", Count = 0
                },
                new CartItem {
                    Key = "B", Count = 0
                },
                new CartItem {
                    Key = "C", Count = 15
                },
                new CartItem {
                    Key = "D", Count = 10
                }
            };

            var log = new PromoEngineEventLogTrace(shoppingCart);

            promotionRuleEngine.Process(shoppingCart, log.HandlePromoDiscount, log.CalculateTotal);

            Assert.True(log.Details.Values.Where(x => x.Item1 == C1D1).Count() == 10);
            Assert.Equal(10, log.Details.Count);
            Assert.Equal(10 * Pricing.PromoPrice(C1D1) + 5 * Pricing.Price("C"), log.TotalAmount);
        }
コード例 #8
0
        /// <summary>
        /// Compute the exact price to start or restart given subscription
        /// </summary>
        /// <param name="pricing">The related usage</param>
        /// <param name="idSubscription">(mandatory) related subscription, required if referenceCustomer is null or if customer has multiple subscriptions</param>
        /// <param name="language">(optional) language of the localized texts</param>
        /// <param name="html">(optional) true to have the localized text as HTML string, false for plain text. Default is true</param>
        /// <param name="ensureBillable">(optional) true to ensure the customer is billable, meaning it can be charged</param>
        public virtual RequestReport GetSubscriptionStartPricing(out Pricing pricing, long?idSubscription, string language, bool?html, bool?ensureBillable)
        {
            pricing = null;

            // create the request
            RequestFluent request;
            var           result = this.CreateRequest(out request, EndpointsV1.PricingSubscription);

            // if succeeded
            if (result.IsSuccess())
            {
                // append optional parameters
                request
                .AddUrlParameter(EndpointParametersV1.Language, language)
                .AddUrlParameter(EndpointParametersV1.Html, html);

                // build the customer to send
                var dataToSend = new Subscription
                {
                    IdSubscription = idSubscription,
                    EnsureBillable = ensureBillable
                };

                // send the request
                var response = this.Send(request, dataToSend);

                // handle the response
                result = this.HandleResponse(out pricing, response);
            }
            return(result);
        }
コード例 #9
0
        /// <summary>
        /// Compute the exact price for a usage update
        /// </summary>
        /// <param name="pricing">The related usage</param>
        /// <param name="referenceFeature">(optional) reference of the related feature, required if idFeature is null</param>
        /// <param name="referenceCustomer">(optional) reference of related customer</param>
        /// <param name="idSubscription">(optional) reference of related subscription, required if referenceCustomer is null</param>
        /// <param name="increment">(optional) the number of units to increment that usage, required if quantityCurrent and isEnabled are null</param>
        /// <param name="quantityCurrent">(optional) the new value of the usage (On-Off features only), required if increment and isEnabled are null</param>
        /// <param name="isEnabled">(optional) the new status of given on-off usage, required if increment and quantityCurrent are null</param>
        /// <param name="dateStamp">(optional) the date the usage update occurs. Required for concurrency issues. Defaults to now (UTC)</param>
        /// <param name="language">(optional) language of the localized texts</param>
        /// <param name="html">(optional) true to have the localized text as HTML string, false for plain text. Default is true</param>
        /// <param name="ensureBillable">(optional) true to ensure the customer is billable, meaning it can be charged</param>
        public virtual RequestReport GetUsagePricing(out Pricing pricing, object referenceFeature, object referenceCustomer, long?idSubscription, int?increment, int?quantityCurrent, bool isEnabled, DateTime?dateStamp, string language, bool?html, bool?ensureBillable)
        {
            pricing = null;

            // create the request
            RequestFluent request;
            var           result = this.CreateRequest(out request, EndpointsV1.PricingUsage);

            // if succeeded
            if (result.IsSuccess())
            {
                // we really need a date
                dateStamp = dateStamp ?? DateTime.UtcNow;

                // build the customer to send
                var usageToSend = new Usage
                {
                    ReferenceFeature  = this.ToString(referenceFeature),
                    ReferenceCustomer = this.ToString(referenceCustomer),
                    IdSubscription    = idSubscription,
                    Increment         = increment,
                    QuantityCurrent   = quantityCurrent,
                    IsEnabled         = isEnabled,
                    DateStamp         = dateStamp,
                    EnsureBillable    = ensureBillable
                };

                // send the request
                var response = this.Send(request, usageToSend);

                // handle the response
                result = this.HandleResponse(out pricing, response);
            }
            return(result);
        }
コード例 #10
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,MembRegPrice,NonMembRegPrice,MembAcademyAlonePrice,NonMembAcademyAlonePrice,MembAcademyDayCampPrice,NonMembAcademyDayCampPrice")] Pricing pricing)
        {
            if (id != pricing.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pricing);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PricingExists(pricing.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(pricing));
        }
コード例 #11
0
        public Pricing GetPricing()
        {
            try
            {
                db = new DbConnect();

                command             = new MySqlCommand("GetPricing", db.GetConnection());
                command.CommandType = System.Data.CommandType.StoredProcedure;

                reader = command.ExecuteReader();

                if (reader.HasRows)
                {
                    pricing = new Pricing
                    {
                        PricingEntityID = reader.GetInt32("PricingEntityID"),
                        Price           = reader.GetInt32("Price"),
                        PricingType     = reader.GetString("PricingType"),
                        Period          = reader.GetString("Period"),
                        ModifiedDate    = reader.GetDateTime("ModifiedDate")
                    };
                }

                reader.Close();
                reader.Dispose();

                return(pricing);
            }
            catch (MySqlException mysqlEx)
            {
                throw mysqlEx;
            }
        }
コード例 #12
0
        public async Task <int> Create(Pricing pricing)
        {
            GetSessions();

            if (ViewBag.Email == null)
            {
                ExpiredSession();
            }


            if (ModelState.IsValid)
            {
                _context.Add(pricing);
                await _context.SaveChangesAsync();

                //return RedirectToAction(nameof(Index));
            }
            //return View(pricing);


            string queryString = "SELECT id FROM Pricing order by id desc limit 1;";
            var    dt          = ReturnDataAdapter(queryString);
            int    lastId      = (int)dt.Rows[0]["id"] == null ? 1 : (int)dt.Rows[0]["id"];

            return(lastId);
        }
コード例 #13
0
 public PriceViewModel()
 {
     Pricing  = new Pricing();
     MinPrice = new Pricing();
     MaxPrice = new Pricing();
     Initialize();
 }
コード例 #14
0
        public void ValidSkus()
        {
            var aSkuMock = new Mock <ISku>();

            aSkuMock.Setup(x => x.Name).Returns('A');
            aSkuMock.Setup(x => x.GetPrice(It.IsAny <IItemCount>())).Returns(1);

            var bSkuMock = new Mock <ISku>();

            bSkuMock.Setup(x => x.Name).Returns('B');
            bSkuMock.Setup(x => x.GetPrice(It.IsAny <IItemCount>())).Returns(1);

            var skus = new[] { aSkuMock.Object, bSkuMock.Object };

            var target = new Pricing(skus);

            Assert.True(target.AvailableSkus.Count == 2);
            Assert.True(target.AvailableSkus.SingleOrDefault(s => s.Name == 'A') != null);
            Assert.True(target.AvailableSkus.SingleOrDefault(s => s.Name == 'B') != null);

            Assert.True(target.TryGetSku("A", out ISku aSku));
            Assert.True(target.TryGetSku("B", out ISku bSku));
            Assert.False(target.TryGetSku("C", out ISku cSku));

            Assert.True(aSku.Name == 'A');
            Assert.True(bSku.Name == 'B');
        }
コード例 #15
0
        static void Main(string[] args)
        {
            // Create a session into the platform...
            ISession session = GlobalSettings.Sessions.GetSession();

            // Open the session
            session.Open();

            // Retrieve a snapshot of prices from the platform
            var response = Pricing.GetSnapshot(new PricingSnapshot.Params().Universe("EUR=", "CAD=", "USD=")
                                               .WithFields("DSPLY_NAME", "BID", "ASK"));

            if (response.IsSuccess)
            {
                // Print the complete raw response from the platform
                Console.WriteLine($"\nPrice snapshot raw data: {response.Data.Raw}");

                // Print the contents of one item
                Console.WriteLine($"\nEUR= contents: {response.Data.Prices["EUR="].Fields()}");

                // Print 1 field
                Console.WriteLine($"\nEUR=[DSPLY_NAME]: {response.Data.Prices["EUR="]["DSPLY_NAME"]}");

                // Iterate through the cache
                Console.WriteLine("\nIterate through the cache and display a couple of fields");
                foreach (var item in response.Data.Prices)
                {
                    Console.WriteLine($"Quote for item: {item.Key}\n{item.Value.Fields("BID", "ASK")}");
                }
            }
            else
            {
                Console.WriteLine($"Request failed: {response.Status}");
            }
        }
コード例 #16
0
        public Book GetStudent()
        {
            string projectTitle = _config.GetSection("Project").GetSection("Title").Value;
            string dbConnection = _config.GetConnectionString("Database");

            //Console.Out.WriteLine($"We Are connecting to ...{dbConnection}");
            Console.WriteLine("========================NOS PIDEN NUEVA LISTA==========================");

            Random r   = new Random();
            int    est = r.Next(15, 21);

            cont = 0;

            for (int i = 0; i < est; i++)
            {
                cont += 1;
                string  med = cont >= 100 ? "" + cont : (cont >= 10 ? "0" + cont : "00" + cont);
                Pricing p   = new Pricing()
                {
                    Code           = cat[r.Next(0, 2)] + "-" + med,
                    Price          = r.Next(1, 5001),
                    PromotionPrice = r.Next(0, 2) == 0 ? 0 : r.Next(1, 2001),
                    PricingBookId  = 1
                };
                Console.WriteLine($"Precio CodProd: {p.Code} SetPrice: {p.Price} PromotionPrice: {p.PromotionPrice}");
                PriceBook.Add(p);
            }
            return(myBook);
        }
コード例 #17
0
        public async Task <IActionResult> PutPricing(int id, Pricing pricing)
        {
            if (id != pricing.Id)
            {
                return(BadRequest());
            }

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

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

            return(NoContent());
        }
コード例 #18
0
        public async Task <ActionResult <Pricing> > PostPricing(Pricing pricing)
        {
            _context.Pricings.Add(pricing);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetPricing", new { id = pricing.Id }, pricing));
        }
コード例 #19
0
        public Pricing Edit(Pricing pricing)
        {
            pricing.ModifiedOn = DateTime.Now;
            Pricing dbPricing = Single(pricing.ID);

            // get the database columns which need to be updated
            var databaseMembers =
                db.Mapping.MappingSource.GetModel(typeof(BizzyQuoteDataContext)).GetMetaType(typeof(Pricing)).DataMembers
                .Where(d => d.IsAssociation == false && d.IsDbGenerated == false && d.IsPersistent == true);

            // reflect to get instances of the entity preoprties
            var editProperties =
                from p in dbPricing.GetType().GetProperties()
                join m in databaseMembers on p.Name equals m.Name
                select p;

            // copy the values
            PropertyInfo[] editProps = editProperties.ToArray();
            foreach (PropertyInfo propertyInfo in editProps)
            {
                propertyInfo.SetValue(dbPricing, propertyInfo.GetValue(pricing, null), null);
            }

            db.SubmitChanges();
            return(dbPricing);
        }
コード例 #20
0
        public int Tests(int aItemCount = 0,
                         int bItemCount = 0,
                         int cItemCount = 0,
                         int dItemCount = 0)
        {
            var aSku = new DiscountedSku(new Sku('A', 50), 3, 130);
            var bSku = new DiscountedSku(new Sku('B', 30), 2, 45);
            var cSku = new Sku('C', 20);
            var dSku = new Sku('D', 15);

            var pricing  = new Pricing(aSku, bSku, cSku, dSku);
            var checkout = new store.Checkout(pricing);

            void callScan(string item, int itemCount)
            {
                var counter = itemCount;

                while (counter != 0)
                {
                    checkout.Scan(item);
                    counter--;
                }
            }

            callScan("A", aItemCount);
            callScan("B", bItemCount);
            callScan("C", cItemCount);
            callScan("D", dItemCount);

            return(checkout.GetTotalPrice());
        }
コード例 #21
0
ファイル: RawRiceController.cs プロジェクト: waleed470/DHMRI
        public ActionResult ShopRiceStock(FormCollection form, RawRice worth, Pricing pricing)
        {
            string idd = Convert.ToString(Session["UserId"]);

            var RiceName = Convert.ToString(form["RiceName"]);



            worth.Date   = DateTime.Now;
            worth.Id     = idd;
            worth.Status = true;
            db.RarRices.Add(worth);
            db.SaveChanges();
            var RawRice_id = db.RarRices.Max(m => m.RawRice_id);


            pricing.item_id              = RawRice_id;
            pricing.item_Type            = "RawRice";
            pricing.Pricing_Date         = DateTime.Now;
            pricing.Pricing_ModifiedDate = DateTime.Now;
            pricing.Status = true;
            db.Pricing.Add(pricing);
            db.SaveChanges();

            return(RedirectToAction("Index"));
        }
コード例 #22
0
ファイル: PricingController.cs プロジェクト: Misir8/BizCraft
        public async Task <IActionResult> Edit(Pricing pricing)
        {
            _context.Pricings.Update(pricing);
            await _context.SaveChangesAsync();

            return(RedirectToAction(nameof(Index)));
        }
コード例 #23
0
        public bool ResumeProduct(RetailerUpdateProductDTO retailerProduct)
        {
            var currentUser = ClaimsPrincipal.Current.Identity.Name;

            if (retailerProduct.BranchIdList == null || retailerProduct.BranchIdList.Count <= 0)
            {
                retailerProduct.BranchIdList = GetBranchIdListFromStore(retailerProduct.StoreId);
            }

            try
            {
                foreach (var branch in retailerProduct.BranchIdList)
                {
                    Pricing pricing = _unitOfWork.PricingRepository.Find(x => x.Store == retailerProduct.StoreId &&
                                                                         x.Branch == branch && x.Product == retailerProduct.ProductId).FirstOrDefault <Pricing>();
                    pricing.IsDeleted = false;
                    _unitOfWork.UpdateAndSave(pricing);//Here we may need to return number of Saved changes to ensures everything is good.
                }
            }
            catch
            {
                return(false);
            }

            return(true);
        }
コード例 #24
0
        static void Main(string[] args)
        {
            try
            {
                var session = Sessions.GetSession();

                // Open the session
                session.Open();

                // Create a streaming price interface for a list of instruments and specify lambda expressions to capture real-time updates
                using var stream = Pricing.Definition("EUR=", "CAD=", "USD=").Fields("DSPLY_NAME", "BID", "ASK")
                                   .GetStream().OnRefresh((item, refresh, s) => Console.WriteLine(refresh))
                                   .OnUpdate((item, update, s) => DisplayUpdate(item, update))
                                   .OnStatus((item, status, s) => Console.WriteLine(status))
                                   .OnError((item, err, s) => Console.WriteLine(err));
                stream.Open();

                // Pause on the main thread while updates come in.  Wait for a key press to exit.
                Console.WriteLine("Streaming updates.  Press any key to stop...");
                Console.ReadKey();
            }
            catch (Exception e)
            {
                Console.WriteLine($"\n**************\nFailed to execute: {e.Message}\n{e.InnerException}\n***************");
            }
        }
コード例 #25
0
ファイル: PricingExtension.cs プロジェクト: nxlap97/CORE
        public static PricingModel ToViewModel(this Pricing entity, IPricingService pricingService, IMDocumentService documentService)
        {
            var img = new MDocument();

            if (!string.IsNullOrWhiteSpace(entity.ImageId))
            {
                img = documentService.GetById(entity.ImageId);
            }

            var modelVm = new PricingModel()
            {
                Id               = entity.Id,
                CreatedBy        = entity.CreatedBy,
                CreatedDate      = entity.CreatedDate,
                Description      = entity.Description,
                ViewCount        = entity.ViewCount,
                ImageId          = entity.ImageId,
                Name             = entity.Name,
                Published        = entity.Published,
                ShortDescription = entity.ShortDescription,
                ImageUrl         = img?.FileUrl
            };

            return(modelVm);
        }
コード例 #26
0
        public override void ClearAllIsModified()
        {
            base.ClearAllIsModified();

            if (Pricing != null)
            {
                Pricing.ClearAllIsModified();
            }
            IsPricingModified = false;

            if (RuralFeatures != null)
            {
                RuralFeatures.ClearAllIsModified();
            }
            IsRuralFeaturesModified = false;

            if (BuildingDetails != null)
            {
                BuildingDetails.ClearAllIsModified();
            }
            IsBuildingDetailsModified = false;

            IsCategoryTypeModified = false;
            IsAuctionOnModified    = false;
            IsCouncilRatesModified = false;
        }
コード例 #27
0
        private void initObjectModels()
        {
            // initializing footer objects
            terms         = new Terms(browser);
            privacy       = new Privacy(browser);
            security      = new Security(browser);
            status        = new Status(browser);
            help          = new Help(browser);
            footerLogo    = new pageObjectModels.footer.Logo(browser);
            contactGitHub = new ContactGitHub(browser);
            api           = new API(browser);
            training      = new Training(browser);
            shop          = new Shop(browser);
            footerBlog    = new pageObjectModels.footer.Blog(browser);
            about         = new About(browser);

            // initializing explore objects
            integrations = new Integrations(browser);
            showcases    = new Showcases(browser);
            trending     = new Trending(browser);

            // initializing header objects
            headerLogo = new pageObjectModels.header.Logo(browser);
            personal   = new Personal(browser);
            openSource = new OpenSource(browser);
            business   = new Business(browser);
            explore    = new Explore(browser);
            pricing    = new Pricing(browser);
            headerBlog = new pageObjectModels.header.Blog(browser);
            support    = new Support(browser);
            searchBar  = new pageObjectModels.header.SearchBar(browser);
            signIn     = new SignIn(browser);
            signUp     = new SignUp(browser);

            // initializing main objects
            signUpUsername  = new SignUpUsername(browser);
            signUpEmail     = new SignUpEmail(browser);
            signUpPassword  = new SignUpPassword(browser);
            signUpSubmit    = new SignUpSubmit(browser);
            signUpForGitHub = new SignUpForGitHubButton(browser);

            // initializing pricing objects
            joinGitHubForFree    = new JoinGitHubForFree(browser);
            upgradeAccount       = new UpgradeAccount(browser);
            createOrganization   = new CreateOrganization(browser);
            startEnterpriseTrial = new StartEnterpriseTrial(browser);

            // initializing blog objects
            featured      = new Featured(browser);
            allPosts      = new AllPosts(browser);
            newFeatures   = new NewFeatures(browser);
            engineering   = new Engineering(browser);
            enterprise    = new Enterprise(browser);
            conferences   = new Conferences(browser);
            meetups       = new Meetups(browser);
            newHires      = new NewHires(browser);
            watercooler   = new Watercooler(browser);
            blogSearchBar = new pageObjectModels.blog.SearchBar(browser);
        }
コード例 #28
0
        public ActionResult DeleteConfirmed(int id)
        {
            Pricing pricing = db.Pricings.Find(id);

            db.Pricings.Remove(pricing);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #29
0
        public Pricing UpdateStudent([FromBody] Pricing priceToUpdate)
        {
            Pricing foundPrice = PriceBook.Find(quo => (quo.Code == priceToUpdate.Code));

            foundPrice.Price          = priceToUpdate.Price;
            foundPrice.PromotionPrice = priceToUpdate.PromotionPrice;
            return(foundPrice);
        }
コード例 #30
0
        public ActionResult DeleteConfirmed(int id)
        {
            Pricing pricing = pricingManager.Find(x => x.Id == id);

            pricingManager.Delete(pricing);

            return(RedirectToAction("Index"));
        }
コード例 #31
0
 public static Zone createZone(string name, int width, int height, string formats, Pricing pricing)
 {
     Zone zone = new Zone();
     zone.name = name;
     zone.width = width;
     zone.height = height;
     zone.formats = formats;
     zone.pricing = pricing;
     return zone;
 }
コード例 #32
0
        /// <summary>
        /// Create the pricing
        /// </summary>
        protected override void Create()
        {
            var p = new Pricing
                        {
                            AdjustQPFee = AdjustQpFee,
                            BasicPrice = BasicPrice,
                            DeferFee = DeferFee,
                            PricingDate = PricingDate,
                            PricingQuantity = PricingQuantity,
                            QuotaId = QuotaId,
                            UnpricingId = UnpricingId,
                            FinalPrice = FinalPrice,
                            PricingBasis = PricingBasisId,
                            CurrencyId =  SelectedCurrencyId,
                            Premium = Premium,
                            PriceDate = PriceDate,
                            ExchangeRate = Rate
                        };

            var pricingService = SvcClientManager.GetSvcClient<PricingServiceClient>(SvcType.PricingSvc);
            var returnedPricing = pricingService.AddNewManualPricing(p, CurrentUser.Id, IsPricingComplete);
            
            using (var quotaService = SvcClientManager.GetSvcClient<QuotaServiceClient>(SvcType.QuotaSvc))
            {
                var q = quotaService.GetById(QuotaId);
                if (q.RelQuotaId != null)
                {
                    p.QuotaId = q.RelQuotaId.Value;
                    p.RelPricingId = returnedPricing.Id;
                    p.IsAutoGenerated = true;

                    using (var upService = SvcClientManager.GetSvcClient<UnpricingServiceClient>(SvcType.UnpricingSvc))
                    {
                        //var tu = upService.GetById(UnpricingId);
                        var tu = upService.Query("it.RelUnpricingId = " + UnpricingId, null).FirstOrDefault();
                        if (tu != null && tu.RelUnpricingId != null)
                        {
                            p.UnpricingId = tu.Id;
                            pricingService.AddNewManualPricing(p, CurrentUser.Id, IsPricingComplete);
                        }
                    }
                }                
            }
        }