public async Task <IActionResult> Edit(int id, [Bind("CityId,BranchId,StuffId,Price,Id,UserId,Status,ModDateTime,ModByUserId,Comment")] PriceTag priceTag) { if (id != priceTag.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(priceTag); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PriceTagExists(priceTag.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["BranchId"] = new SelectList(_context.Branches, "Id", "Name", priceTag.BranchId); ViewData["CityId"] = new SelectList(_context.Cities, "Id", "Name", priceTag.CityId); ViewData["StuffId"] = new SelectList(_context.Stuffs, "Id", "Name", priceTag.StuffId); return(View(_mapper.Map <PriceTagViewModel>(priceTag))); }
public void Print_price_tag() { var address = new Address("Тестовый"); var lines = new List <TagPrintable>(); var line = new TagPrintable() { Nds = 10, RetailCost = 251.20m, Product = "Диклофенак", Quantity = 1 }; lines.Add(line); var priceTagSettings = new PriceTagSettings() { Type = PriceTagType.Normal }; var doc = new PriceTagDocument(lines, priceTagSettings, null).Build(); Assert.IsNotNull(doc); var priceTag = PriceTag.Default(TagType.RackingMap, null); var settings = new Settings(address); settings.RackingMap.Size = RackingMapSize.Custom; var doc2 = new RackingMapDocument(lines, settings, priceTag).Build(); Assert.IsNotNull(doc2); }
public void Check_custom_price_tag_address() { var address = new Address("Тестовый адрес"); var lines = new List <TagPrintable>(); var line = new TagPrintable() { AddressName = "Тестовый измененный адрес", ClientName = "Тестовый клиент", Nds = 10, RetailCost = 251.20m, Product = "Диклофенак", Quantity = 1 }; lines.Add(line); var priceTagSettings = new PriceTagSettings() { Type = PriceTagType.Custom, Address = address }; var priceTag = PriceTag.Default(TagType.PriceTag, address); var doc = new PriceTagDocument(lines, priceTagSettings, priceTag).Build(); Assert.IsNotNull(doc); var text = doc.Descendants <StackPanel>() .First() .Descendants <Label>() .First() .Content.ToString().Trim(); Assert.AreEqual($"{line.ClientName}, {line.AddressName}", text); }
public void Preview() { if (Tag.Value == null) { return; } PreviewContent.Value = PriceTag.Preview(Tag.Value.Width, Tag.Value.Height, Tag.Value.BorderThickness, Items); }
void OnMouseEnter() { if (!isAvailable() && building.GetComponent <Building>() != null && !building.GetComponent <Building>().locked) { Building comp = building.GetComponent <Building>(); PriceTag.SetPriceTag(Camera.main.WorldToScreenPoint(building.transform.position) + new Vector3(80, 30, 0), comp, energy); } }
private void LoadPriceTagPreview() { if (!MarkupAddress.HasValue) { return; } RxQuery(s => PriceTag.LoadOrDefault(s.Connection, TagType.PriceTag, MarkupAddress.Value)) .Subscribe(x => PriceTagPreview.Value = x.Preview()); }
public void DisableOutline() { outline.SetActive(false); targetAlpha = 0; if (!PriceTag.hover) { PriceTag.Hide(); } }
void AddPriceTag() { GameObject instance = Instantiate(ResourceLoader.instance.priceTagFab); instance.transform.SetParent(transform); instance.transform.localPosition = Vector2.zero; priceTag = instance.GetComponent <PriceTag>(); priceTag.GetComponentInChildren <Text>().rectTransform.localPosition = new Vector2(0, 0.25f); }
public string GetDefaultOption(BUY_HOW buyHow) { PriceTag defaultPriceTag = GetDefaultPriceTag(buyHow); if (defaultPriceTag == null || tItem == null) { return(string.Empty); } return(defaultPriceTag.GetRemainString(tItem.IsAmount)); }
protected override void OnInitialize() { base.OnInitialize(); address = address ?? Address; RxQuery(s => PriceTag.LoadOrDefault(s.Connection, TagType.PriceTag, address)) .Subscribe(x => priceTag = x); RxQuery(s => PriceTag.LoadOrDefault(s.Connection, TagType.RackingMap, null)) .Subscribe(x => rackingMap = x); this.priceTagSettings = Settings.Value.PriceTags.First(r => r.Address?.Id == address?.Id); }
public async Task <IActionResult> Create([Bind("CityId,BranchId,StuffId,Price,Id,UserId,Status,ModDateTime,ModByUserId,Comment")] PriceTag priceTag) { if (ModelState.IsValid) { _context.Add(priceTag); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["BranchId"] = new SelectList(_context.Branches, "Id", "Name", priceTag.BranchId); ViewData["CityId"] = new SelectList(_context.Cities, "Id", "Name", priceTag.CityId); ViewData["StuffId"] = new SelectList(_context.Stuffs, "Id", "Name", priceTag.StuffId); return(View(_mapper.Map <PriceTagViewModel>(priceTag))); }
public int GetCashback() { BUY_HOW buyHow = BUY_HOW.CASH_POINT; PriceTag defaultPriceTag = GetDefaultPriceTag(buyHow); if (defaultPriceTag == null) { return(0); } if (defaultPriceTag.CashBack > 0) { return(defaultPriceTag.CashBack); } return(0); }
public string GetDefaultTokenPrice() { BUY_HOW buyHow = BUY_HOW.CASH_POINT; PriceTag defaultPriceTag = GetDefaultPriceTag(buyHow); if (defaultPriceTag == null) { return(string.Empty); } int percent = 0; if (BuildOption.Instance.Props.usePriceDiscount && tItem.type == TItem.TYPE.WEAPON) { TWeapon tWeapon = (TWeapon)tItem; percent = tWeapon.GetDiscountRatio(); } return(defaultPriceTag.GetPriceString(buyHow, percent)); }
public string GetDefaultBrickPrice() { BUY_HOW buyHow = BUY_HOW.BRICK_POINT; PriceTag defaultPriceTag = GetDefaultPriceTag(buyHow); if (defaultPriceTag == null) { return(string.Empty); } int percent = 0; if (tItem.type == TItem.TYPE.WEAPON) { TWeapon tWeapon = (TWeapon)tItem; percent = tWeapon.GetDiscountRatio(); } return(defaultPriceTag.GetPriceString(buyHow, percent)); }
protected override void OnInitialize() { base.OnInitialize(); OnCloseDisposable.Add(Shell.SpecialMarkupProducts.Subscribe(_ => Calculate())); if (Session == null) { return; } Waybill = Session.Get <Waybill>(id); if (Waybill == null) { return; } Waybill.Settings = Settings; Waybill.ObservableForProperty(x => x.Status, skipInitial: false) .Select(x => x.Value == DocStatus.NotPosted).Subscribe(CanStock); Waybill.ObservableForProperty(x => x.Status, skipInitial: false) .Select(x => x.Value == DocStatus.NotPosted && Waybill.SupplierSum == null).Subscribe(CanEditSum); Waybill.ObservableForProperty(m => (object)m.Status, skipInitial: false) .Merge(Waybill.ObservableForProperty(m => (object)m.IsCreatedByUser)) .Select(_ => !User.IsStockEnabled && Waybill.Status == DocStatus.NotPosted && !Waybill.IsCreatedByUser) .Subscribe(CanToEditable); Waybill.ObservableForProperty(m => (object)m.Status, skipInitial: false) .Merge(Waybill.ObservableForProperty(m => (object)m.IsCreatedByUser)) .Select(_ => Waybill.Status == DocStatus.NotPosted && Waybill.IsCreatedByUser) .Subscribe(CanAddFromCatalog); if (Waybill.IsNew) { Waybill.IsNew = false; if (Shell.NewDocsCount.Value > 0) { Shell.NewDocsCount.Value--; } } Calculate(); var stockids = Waybill.Lines.Where(x => x.StockId != null).Select(x => x.StockId).ToArray(); RxQuery(s => s.Query <Stock>().Where(x => stockids.Contains(x.ServerId)).ToDictionary(x => x.ServerId)) .ObserveOn(UiScheduler) .Subscribe(x => { Waybill.Lines.Each(y => { y.Stock = x.GetValueOrDefault(y.StockId); }); }); Lines.Value = new ListCollectionView(Waybill.Lines.OrderBy(l => l.Product).ToList()); Taxes = new List <ValueDescription <int?> > { new ValueDescription <int?>("Все", -1), }; Taxes.AddRange(Lines.Value.Cast <WaybillLine>().Select(l => l.Nds).Distinct() .OrderBy(t => t) .Select(t => new ValueDescription <int?>(((object)t ?? "Нет значения").ToString(), t))); CurrentTax.Value = Taxes.FirstOrDefault(); Reject = CurrentWaybillLine .Throttle(Consts.ScrollLoadTimeout, Scheduler) .Select(v => RxQuery(s => { if (v?.RejectId == null) { return(null); } return(s.Get <Reject>(v.RejectId.Value)); })) .Switch() .ToValue(CloseCancellation); IsRejectVisible = Reject.Select(r => r != null).ToValue(); if (Waybill.IsCreatedByUser) { EmptyLabelVisibility = EmptyLabelVisibility.Select(s => Visibility.Collapsed).ToValue(); OrderDetailsVisibility = OrderDetailsVisibility.Select(s => Visibility.Collapsed).ToValue(); } RxQuery(s => PriceTag.LoadOrDefault(s.Connection, TagType.PriceTag, Waybill.Address)) .Subscribe(x => priceTag = x); RxQuery(s => PriceTag.LoadOrDefault(s.Connection, TagType.RackingMap, Waybill.Address)) .Subscribe(x => rackingMap = x); }
public PriceTagDocument(IList <TagPrintable> lines, PriceTagSettings priceTagSettings, PriceTag priceTag) { this.lines = lines; this.priceTag = priceTag; this.priceTagSettings = priceTagSettings; }
void Awake() { self = this; priceButton = priceTag.GetComponent <Button>(); Hide(); }
protected override void OnInitialize() { base.OnInitialize(); RxQuery(s => PriceTag.LoadOrDefault(s.Connection, tagType, address)).Subscribe(Tag); }
public void Reset() { Tag.Value = PriceTag.Default(tagType, address); }
private void LoadRackingMapPreview() { RxQuery(s => PriceTag.LoadOrDefault(s.Connection, TagType.RackingMap, null)) .Subscribe(x => RackingMapPreview.Value = x.Preview()); }
protected override void setReferences() { base.setReferences(); priceTag = GetComponentInChildren <PriceTag>(); }
public RackingMapDocument(IList <TagPrintable> lines, Settings settings, PriceTag priceTag = null) { this.settings = settings; this.lines = lines; this.priceTag = priceTag; }