public virtual ActionResult Submit(EditItemsViewModel model) { var logEntry = LogI("Update Items, count=" + model.Listings.Count); logEntry.Info("begin"); if (model.Listings.Count > 0) { var selectedListing = model.SelectedListing; if (ModelState.IsValid) { var priceManager = new PriceManager(LogService, Time, DbFactory, ActionService, Settings); foreach (var listing in model.Listings) { logEntry.Info("Submit, listing=", listing.ToString()); listing.Update(Db, LogService, priceManager, StyleHistoryService, Time.GetAppNowTime(), AccessManager.UserId); } } logEntry.Info("end"); return(Json(new UpdateRowViewModel(selectedListing, "Products_" + selectedListing.ParentASIN, null, true), JsonRequestBehavior.AllowGet)); } return(Json(null, JsonRequestBehavior.AllowGet)); }
private void UpdatePapers() { _isUpdating = true; _channelsView.Rows.Clear(); foreach (PaperFormat format in PriceManager.PaperFormats) { foreach (PaperType type in PriceManager.PaperTypes) { var key = new KeyValuePair <PaperFormat, PaperType>(format, type); int index = _channelsView.Rows.Add(); if (PriceManager.ContainsProduct(GetProductKey(key))) { _channelsView["ChannelColumn", index].Value = PriceManager.GetProduct(GetProductKey(key)).Channel; } else { _channelsView["ChannelColumn", index].Value = ""; } _channelsView.Rows[index].Tag = key; _channelsView["PaperColumn", index].Value = format.Name + " " + type.Name; } } _isUpdating = false; }
public JobScheduler() { uOw = new UnitOfWork(); followPriceManager = new FollowPriceManager(uOw); priceManager = new PriceManager(uOw); emailService = new EmailService(uOw); }
private void _printersView_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (!_isUpdating) { var key = (KeyValuePair <PaperFormat, PaperType>)_printersView.Rows[e.RowIndex].Tag; string newPrinter = (string)_printersView["PrinterColumn", e.RowIndex].Value; if (PriceManager.ContainsProduct(GetProductKey(key))) { if (string.IsNullOrEmpty(newPrinter)) { PriceManager.RemoveProduct(GetProductKey(key)); } else { PriceManager.GetProduct(GetProductKey(key)).Printer = newPrinter; } } else if (!string.IsNullOrEmpty(newPrinter)) { PriceManager.AddProduct(key.Key, key.Value, newPrinter); } if (Parent is MainForm) { (Parent as MainForm).UpdatePriceNodes(); } } }
private void _channelsView_CellValueChanged(object sender, DataGridViewCellEventArgs e) { if (!_isUpdating) { var key = (KeyValuePair <PaperFormat, PaperType>)_channelsView.Rows[e.RowIndex].Tag; string newChannel = _channelsView["ChannelColumn", e.RowIndex].Value != null ? _channelsView["ChannelColumn", e.RowIndex].Value.ToString() : string.Empty; _channelsView.Rows[e.RowIndex].ErrorText = ""; if (!string.IsNullOrEmpty(newChannel)) { foreach (DataGridViewRow row in _channelsView.Rows) { if (row.Index != e.RowIndex) { string name = _channelsView["ChannelColumn", row.Index].Value != null ? _channelsView["ChannelColumn", row.Index].Value.ToString() : string.Empty; if (name.Equals(newChannel)) { _channelsView.Rows[e.RowIndex].ErrorText = RM.GetString("ChannelError"); break; } } } } if (PriceManager.ContainsProduct(GetProductKey(key))) { PriceManager.GetProduct(GetProductKey(key)).Channel = newChannel; } } }
private static Tuple <decimal, decimal> GetOrderPriceAndTax(tbl_Orders table) { if (table == null || table.tbl_OrderContent.Count == 0) { return(new Tuple <decimal, decimal>(0, 0)); } decimal totalPrice = 0, totalTaxAmount = 0; foreach (var content in table.tbl_OrderContent) { Tuple <decimal, decimal> priceAndTax = PriceManager.GetPrice(content.OC_Price.GetValueOrDefault(), content.OC_Tax.GetValueOrDefault(0), (int)content.OC_Quantity.GetValueOrDefault(0), table.O_DomainID); totalPrice += priceAndTax.Item1; totalTaxAmount += priceAndTax.Item2; } if (table.tbl_Discount != null) { Tuple <decimal, decimal> priceAndTax = PriceManager.AddDiscountToPrice(table.tbl_Discount, totalPrice, totalTaxAmount, table.O_DomainID); totalPrice = priceAndTax.Item1; totalTaxAmount = priceAndTax.Item2; } if (table.tbl_Postage != null) { decimal maxTax = table.tbl_OrderContent.Max(bc => bc.GetTaxValue()); Tuple <decimal, decimal> postagePriceAndTax = PriceManager.GetPostagePriceAndTax(table.tbl_Postage, maxTax, table.O_DomainID); totalPrice += postagePriceAndTax.Item1; totalTaxAmount += postagePriceAndTax.Item2; } return(new Tuple <decimal, decimal>(totalPrice, totalTaxAmount)); }
private void _servicesView_UserDeletedRow(object sender, DataGridViewRowEventArgs e) { Service service = e.Row.Tag as Service; PriceManager.RemoveService(service); ValidateCells(null); }
private void _formatsView_UserDeletedRow(object sender, DataGridViewRowEventArgs e) { PaperFormat format = e.Row.Tag as PaperFormat; PriceManager.RemovePaperFormat(format); ValidateCells(null); }
private void Awake() { _priceList = new SortedList <int, decimal>(); _priceManager = gameObject.AddComponent <PriceManager>(); startPos = new Vector3(0.049f, 1.048f + dropHeight, 0f); Instance = this; SpawnBox(); }
private void _typesView_UserDeletedRow(object sender, DataGridViewRowEventArgs e) { PaperType type = e.Row.Tag as PaperType; PriceManager.RemovePaperType(type); ValidateCells(null); }
void Start() { Cursor.visible = false; _rb = GetComponent <Rigidbody2D>(); _gm = FindObjectOfType <GameManager>(); _childSprite = GameObject.Find("PickedUpObject").GetComponent <SpriteRenderer>(); _buySeed = FindObjectOfType <PriceManager>(); _actualDamage = 1; }
public void PriceManager_Ctor_Right() { //Arrange //Act var target = new PriceManager(); //Assert target.Should().NotBeNull(); }
public static string GetDeliveryAmountString(this tbl_Orders table, bool hideTax = false) { IDomain domainService = (IDomain)DependencyResolver.Current.GetService <IDomain>(); bool useTax = domainService.GetSettingsValueAsBool(SettingsKey.useTax, table.O_DomainID); bool priceIncludesVat = domainService.GetSettingsValueAsBool(SettingsKey.priceDisplayIncludesVAT, table.O_DomainID); return(PriceManager.FormatPrice((useTax && priceIncludesVat) ? table.TotalDeliveryAmount : table.DeliveryCharge.GetValueOrDefault(0), table.DeliveryTax.GetValueOrDefault(0), table.O_DomainID, hideTax)); }
public static string GetDeliveryTaxAmountString(this tbl_Basket table, bool hideTax = false) { if (table.tbl_Postage != null && table.tbl_BasketContent.Count > 0) { decimal maxTax = table.tbl_BasketContent.Max(bc => bc.GetTaxValue()); Tuple <decimal, decimal> postagePriceAndTax = PriceManager.GetPostagePriceAndTax(table.tbl_Postage, maxTax, table.B_DomainID); return(String.Format("{0:C}", postagePriceAndTax.Item2)); } return(String.Empty); }
public ActionResult About() { var r = PriceManager.ReadWorkbook( _ctx.EmailMessages.Where(f => f.FileAttachName.EndsWith("xls")) .Select(x => x.FileAttachName) .ToList()); return(View(r)); }
public static decimal GetDeliveryTaxAmount(this tbl_Basket table) { if (table.tbl_Postage != null && table.tbl_BasketContent.Count > 0) { decimal maxTax = table.tbl_BasketContent.Max(bc => bc.GetTaxValue()); Tuple <decimal, decimal> postagePriceAndTax = PriceManager.GetPostagePriceAndTax(table.tbl_Postage, maxTax, table.B_DomainID); return(postagePriceAndTax.Item2); } return(0); }
public ServiceResult DeletePriceRule(PriceRule PriceRule) { if (PriceRule == null || string.IsNullOrWhiteSpace(PriceRule.UUID)) { return(ServiceResponse.Error("Invalid account was sent.")); } PriceManager financeManager = new PriceManager(Globals.DBConnectionKey, Request.Headers?.Authorization?.Parameter); return(financeManager.Delete(PriceRule)); }
public ServiceResult DeletePriceRule(PriceRule PriceRule) { if (PriceRule == null || string.IsNullOrWhiteSpace(PriceRule.UUID)) { return(ServiceResponse.Error("Invalid account was sent.")); } PriceManager financeManager = new PriceManager(Globals.DBConnectionKey, this.GetAuthToken(Request)); return(financeManager.Delete(PriceRule)); }
public ActionResult ZXTPrice(string pid) { var result = PriceManager.PriceChangeLog(pid).Where(c => c.ChangeDateTime > DateTime.Now.AddYears(-1)).OrderBy(c => c.ChangeDateTime).ToList(); if (result.Any()) { ViewBag.xArr = string.Join(",", result.Select(_ => _.ChangeDateTime.ToShortDateString())); ViewBag.yArr = string.Join(",", result.Select(_ => _.NewPrice.ToString())); } ViewBag.PID = pid; return(View(result.OrderByDescending(_ => _.ChangeDateTime).ToList())); }
public void CallCheckFbaFbpPrice() { var dbFactory = new DbFactory(); var settings = new SettingsService(dbFactory); var priceManager = new PriceManager(_log, _time, dbFactory, _actionService, settings); using (var db = dbFactory.GetRWDb()) { db.DisableValidation(); priceManager.FixupFBAPrices(db); } }
public ActionResult IsLowerThanActivityPrice(string pid, decimal price) { var data = PriceManager.GetFlashSalePriceByPID(pid); if (data == null || !data.Any()) { return(Json(1)); } else { return(Json(data.Any(_ => _.Price >= price) ? 0 : 1)); } }
public ServiceResult Insert(PriceRule PriceRule) { if (PriceRule == null || string.IsNullOrWhiteSpace(PriceRule.Name)) { return(ServiceResponse.Error("Invalid PriceRule sent to server.")); } string authToken = Request.Headers?.Authorization?.Parameter; UserSession us = SessionManager.GetSession(authToken); if (us == null) { return(ServiceResponse.Error("You must be logged in to access this function.")); } if (string.IsNullOrWhiteSpace(us.UserData)) { return(ServiceResponse.Error("Couldn't retrieve user data.")); } if (CurrentUser == null) { return(ServiceResponse.Error("You must be logged in to access this function.")); } if (string.IsNullOrWhiteSpace(PriceRule.AccountUUID) || PriceRule.AccountUUID == SystemFlag.Default.Account) { PriceRule.AccountUUID = CurrentUser.AccountUUID; } if (string.IsNullOrWhiteSpace(PriceRule.CreatedBy)) { PriceRule.CreatedBy = CurrentUser.UUID; } if (PriceRule.DateCreated == DateTime.MinValue) { PriceRule.DateCreated = DateTime.UtcNow; } if (string.IsNullOrWhiteSpace(PriceRule.Image)) { PriceRule.Image = "/Content/Default/Images/PriceRule/default.png"; } PriceManager financeManager = new PriceManager(Globals.DBConnectionKey, Request.Headers?.Authorization?.Parameter); return(financeManager.Insert(PriceRule, false)); }
private void Awake() { PriceManager = GameObject.Find("PriceManager").GetComponent <PriceManager>(); type = "Normal"; orderState = OrderState.yet; timer = 0; payment = 0; plusPopular = 3; minPopular = 6; ExitTime = 60.0f; waitTime = 20.0f; GetOrder(); SetTextBox(); }
/// <summary> /// Initializating managers and uOw /// </summary> public TaskExecuter() { uOw = new UnitOfWork(); elasticuOw = new ElasticUnitOfWork(); parsermanager = new ParserTaskManager(uOw); propmanager = new PropertyManager(uOw); goodManager = new GoodManager(uOw); urlManager = new URLManager(uOw); htmlValidator = new HtmlValidator(); priceManager = new PriceManager(uOw); elasticManager = new ElasticManager(elasticuOw); goodwizardManager = new GoodDatabasesWizard(elasticuOw, uOw); taskinfoManager = new ExecuteManager(uOw); }
public void GivenAUserWhenAddsArticleThenTheArticleIsAdded() { // Arrange var article = new Article(); article.Price = 95.5; article.Name = "whatever"; PriceManager priceManager = new PriceManager(); // Act priceManager.AddArticle(article); // Assert Assert.IsTrue(priceManager.Articles.Count == 1, "The article has not been properly added"); }
public static decimal GetDiscountAmount(this tbl_Basket table) { if (table.tbl_Discount != null) { decimal totalPrice = 0, totalTaxAmount = 0; foreach (var content in table.tbl_BasketContent) { Tuple <decimal, decimal> priceAndTax = PriceManager.GetPriceAndTaxAmounts(content.tbl_ProductPrice, content.BC_Quantity); totalPrice += priceAndTax.Item1; totalTaxAmount += priceAndTax.Item2; } return(PriceManager.GetDiscountAmount(table.tbl_Discount, totalPrice, totalTaxAmount, table.B_DomainID)); } return(0); }
public void PriceManager_GetTicketPrice() { //Arrange var target = new PriceManager(); var session = new Session() { Id = 0, TimeAndDate = DateTime.Now }; //Act var result = target.GetTicketPrice(session, 1, 1); //Assert result.Should().Be(5.00); }
public ServiceResult GetPriceRules() { if (CurrentUser == null) { return(ServiceResponse.Error("You must be logged in to access this function.")); } PriceManager financeManager = new PriceManager(Globals.DBConnectionKey, this.GetAuthToken(Request)); List <dynamic> PriceRule = (List <dynamic>)financeManager.GetPriceRules(CurrentUser.AccountUUID, false).Cast <dynamic>().ToList(); DataFilter filter = this.GetFilter(Request); PriceRule = PriceRule.Filter(ref filter); return(ServiceResponse.OK("", PriceRule, filter.TotalRecordCount)); }
public ServiceResult GetPriceRules(string filter = "") { if (CurrentUser == null) { return(ServiceResponse.Error("You must be logged in to access this function.")); } PriceManager financeManager = new PriceManager(Globals.DBConnectionKey, Request.Headers?.Authorization?.Parameter); List <dynamic> PriceRule = (List <dynamic>)financeManager.GetPriceRules(CurrentUser.AccountUUID, false).Cast <dynamic>().ToList(); int count; DataFilter tmpFilter = this.GetFilter(filter); PriceRule = FilterEx.FilterInput(PriceRule, tmpFilter, out count); return(ServiceResponse.OK("", PriceRule, count)); }
//Todo optimize this process. Cache on client and cache here. // add better data retrieval.. // private CartView GetCartView(ShoppingCart cart) { CartView cv = new CartView(); try { var config = new MapperConfiguration(cfg => { cfg.CreateMap <ShoppingCart, CartView>(); }); IMapper mapper = config.CreateMapper(); cv = mapper.Map <ShoppingCart, CartView>(cart); } catch (Exception ex) { SystemLogger logger = new SystemLogger(Globals.DBConnectionKey); logger.InsertException(ex, "StoreController", "GetCartView", ContextHelper.GetContextData()); return(cv); } StoreManager storeManager = new StoreManager(Globals.DBConnectionKey, this.GetAuthToken(Request)); cv.CartItems = storeManager.GetItemsInCart(cv.UUID); PriceManager cm = new PriceManager(Globals.DBConnectionKey, this.GetAuthToken(Request)); cv.PriceRules = cm.GetPriceRules(cv.UUID, "shoppingcart"); LocationManager lm = new LocationManager(Globals.DBConnectionKey, this.GetAuthToken(Request)); var resb = lm.Get(cv.BillingLocationUUID); if (resb.Code == 200) { cv.BillingAddress = (Location)resb.Result; } if (cv.ShippingSameAsBiling == false) { var resc = lm.Get(cv.ShippingLocationUUID); if (resc.Code == 200) { cv.ShippingAddress = (Location)resc.Result; } } return(cv); }
void Awake() { Instance = this; }