void B_Move_Click(object sender, System.EventArgs e) { if (!int.TryParse(T_Amount.Text, out int amount) || amount < 1) { MessageBox.Show(this, Resources.INVALID_SKU_QTY_IS_ENTERED, Resources.FAILURE, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (amount > _selectedCell.Amount) { MessageBox.Show(this, Resources.QTY_TOO_BIG_FOR_GIVEN_CELL, Resources.FAILURE, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } PointOfSale pointOfSale = PointOfSale.Restore(((LiteBizItem)CB_PointsOfSale.SelectedItem).Value); if (MessageBox.Show(this, string.Format(Resources.CONFIRM_MOVING_GOODS, _skuInStock.Article.Name, amount, pointOfSale.Name), Resources.CONFIRMATION, MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; } // TODO: Implement transaction SkuInStock skuInDestination = SkuInStock.Restore(_skuInStock.Article, pointOfSale); skuInDestination[_selectedCell.X, _selectedCell.Y].Amount += amount; skuInDestination.Flush(); _skuInStock[_selectedCell.X, _selectedCell.Y].Amount -= amount; _skuInStock.Flush(); //_selectedCell.Flush(); ((PanelViewSku)Parent.Parent.Parent).UpdateWOldSearch(); MessageBox.Show(this, Resources.GOODS_HAS_BEEN_MOVED, Resources.MESSAGE, MessageBoxButtons.OK, MessageBoxIcon.Information); }
public ActionResult LocalSettings(LocalSettings item) { item.Store = Store.TryFind(item.StoreId); item.PointOfSale = PointOfSale.TryFind(item.PointOfSaleId); item.CashDrawer = CashDrawer.TryFind(item.CashDrawerId.GetValueOrDefault()); if (!ModelState.IsValid) { return(View(item)); } Response.Cookies.Add(new HttpCookie(WebConfig.StoreCookieKey) { Value = item.Store.Id.ToString(), Expires = DateTime.Now.AddYears(100) }); if (item.PointOfSale != null) { Response.Cookies.Add(new HttpCookie(WebConfig.PointOfSaleCookieKey) { Value = item.PointOfSale.Id.ToString(), Expires = DateTime.Now.AddYears(100) }); } else { if (Request.Cookies [WebConfig.PointOfSaleCookieKey] != null) { Response.Cookies.Add(new HttpCookie(WebConfig.PointOfSaleCookieKey) { Value = string.Empty, Expires = DateTime.Now.AddDays(-1d) }); } } if (item.CashDrawer != null) { Response.Cookies.Add(new HttpCookie(WebConfig.CashDrawerCookieKey) { Value = item.CashDrawer.Id.ToString(), Expires = DateTime.Now.AddYears(100) }); } else { if (Request.Cookies [WebConfig.CashDrawerCookieKey] != null) { Response.Cookies.Add(new HttpCookie(WebConfig.CashDrawerCookieKey) { Value = string.Empty, Expires = DateTime.Now.AddDays(-1d) }); } } return(RedirectToAction("Index", "Home")); }
public async Task <PointOfSale> Create(PointOfSale pos) { _db.PointOfSales.Add(pos); await _db.SaveChangesAsync(); return(pos); }
public ActionResult Delete(int id, FormCollection collection) { PointOfSale c = new PointOfSale(); c = cs.Get(t => t.id == id); cs.Delete(c); cs.Commit(); return(RedirectToAction("Index")); }
public ActionResult Index([Bind(Include = "EmployeeKey, SaleDate, ProductKey, SaleDetailPriceCharged,SaleDetailDiscount,SaleKey")] PointOfSale pos) { db.SaveChanges(); //Receipt sent through the Message class to result page Message msg = new Message("Thank you for your purchase! Total price is " + pos.SaleDetailPriceCharged + " with discount of " + pos.SaleDetailDiscount + " for item #" + pos.ProductKey); return(View("Result", msg)); }
public void SetPointOfSale(PointOfSale pointOfSale) { if (pointOfSale == null) { ValidationService.ValidateExistRequest(pointOfSale, FieldResource.PointOfSale); } PointOfSale = pointOfSale; }
/// <inheritdoc /> public PointOfSale CreateOrUpdatePos(PointOfSale request) { var req = BuildRequest(request.Id == 0 ? "point-of-sales" : $"point-of-sales/{request.Id}/", request.Id == 0 ? Method.POST : Method.PUT); req.AddJsonBody(request); var res = ExecuteRequestInternal <PointOfSale>(req); AssertOk(res); return(res.Data); }
public Order(int id, Waiter waiter, PointOfSale pointOfSale, Table table, DateTime creationDate, StatusOrderEnum statusOrder) { Id = id; CreationDate = ValidationService.SetDate(creationDate, FieldResource.CreationDate); StatusOrder = statusOrder; SetWaiter(waiter); SetPointOfSale(pointOfSale); SetTable(table); }
public PointOfSale MapEntity(PointOfSaleRequest request) { PointOfSale pointOfSale = new PointOfSale(request.Id, request.Number, request.TypePointOfSale); UpdateOrder(pointOfSale); UpdateOrderItem(pointOfSale); return(pointOfSale); }
private PointOfSale ValidatePointOfSale(int id) { PointOfSale pointOfSale = pointOfSaleRepository.GetInstance().Select(id).FirstOrDefault(); if (pointOfSale == null || pointOfSale.Id <= 0) { throw new InvalidRequestException(string.Format(MessageResource.InvalidRequest, FieldResource.PointOfSale.ToLower())); } return(pointOfSale); }
public IHttpActionResult GetPointOfSale(int id) { PointOfSale pointOfSale = db.PointOfSales.Find(id); if (pointOfSale == null) { return(NotFound()); } return(Ok(pointOfSale)); }
public static void Validate(this PointOfSale pointOfSale) { if (!HasValue(pointOfSale.ValueToPay, pointOfSale.TotalValue)) { throw new PointOfSaleException(HasNotValue); } if (!IsBigger(pointOfSale.ValueToPay, pointOfSale.TotalValue)) { throw new PointOfSaleException(ValueToPayIsSmaller); } }
public void Setup() { _keyPos = CryptoHelper.LoadKeyFromPem <AsymmetricCipherKeyPair>("pos1.pem").Private; _keyInstrument1 = CryptoHelper.LoadKeyFromPem <AsymmetricCipherKeyPair>("source1.pem").Private; _keyRegistry = CryptoHelper.LoadKeyFromPem <AsymmetricCipherKeyPair>("registry.pem").Public; _rnd = new Random(); _womClient = new Client("dev.wom.social", new ConsoleLoggerFactory(), _keyRegistry); _instrument = _womClient.CreateInstrument(_idSource, _keyInstrument1); _pos = _womClient.CreatePos(_idPos, _keyPos); }
private void UpdateOrderItem(PointOfSale entity) { List <OrderItem> list = orderItemRepository.GetInstance().Select().Where(x => x.Order.PointOfSale.Id == entity.Id) .Select(s => new OrderItem(s.Id, s.Order, s.Product, s.Amount)).ToList(); foreach (var obj in list) { obj.Order.SetPointOfSale(entity); orderItemRepository.GetInstance().Update(obj); } }
private void UpdateOrder(PointOfSale entity) { List <Order> list = orderRepository.GetInstance().Select().Where(x => x.PointOfSale.Id == entity.Id) .Select(s => new Order(s.Id, s.Waiter, s.PointOfSale, s.Table, s.CreationDate, s.StatusOrder)).ToList(); foreach (var obj in list) { obj.SetPointOfSale(entity); orderRepository.GetInstance().Update(obj); } }
public Order MapEntity(OrderRequest request) { Waiter waiter = ValidateWaiter(request.IdWaiter); PointOfSale pointOfSale = ValidatePointOfSale(request.IdPointOfSale); Table table = ValidateTable(request.IdTable); Order order = new Order(request.Id, waiter, pointOfSale, table, request.CreationDate, request.StatusOrder); UpdateOrderItem(order); return(order); }
public async Task <ChangeComposition> GetChangeAsync(PointOfSale pointOfSale) { pointOfSale.Validate(); Bills = await BillService.GetBillsAsync(); Coins = await CoinService.GetCoinsAsync(); var result = CalculeChange(Math.Round(pointOfSale.ValueToPay - pointOfSale.TotalValue, 2, MidpointRounding.ToZero), new ChangeComposition()); await TransactionService.RegisterAsync(pointOfSale, result); return(result); }
public IHttpActionResult PostPointOfSale(PointOfSale pointOfSale) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.PointOfSales.Add(pointOfSale); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = pointOfSale.ID }, pointOfSale)); }
void B_Read_Click(object sender, EventArgs e) { PointOfSale o = GetObject(); if (o == null) { Clear(); return; } T_Name.Text = o.Name; }
public async Task <IActionResult> Create([Bind("Id,Name,EnterpriseId")] PointOfSale pointOfSale) { if (ModelState.IsValid) { _context.Add(pointOfSale); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["EnterpriseId"] = new SelectList(_context.Enterprises, "Id", "Id", pointOfSale.EnterpriseId); return(View(pointOfSale)); }
public async Task RegisterAsync(PointOfSale pointOfSale, ChangeComposition composition) { using var context = new PointOfSaleContext(_configuration); await context.Transactions.AddAsync(new Transactions { ValueToPay = pointOfSale.ValueToPay, TotalValue = pointOfSale.TotalValue, Change = composition.TotalChange, ChangeMessage = composition.ResponseMessage }); await context.SaveChangesAsync(); }
public ActionResult DeleteConfirmed(int id) { var item = PointOfSale.Find(id); //PointOfSale item = PointOfSale.Find (id); try { using (var scope = new TransactionScope()) { item.DeleteAndFlush(); } return(PartialView("_DeleteSuccesful", item)); } catch (Exception) { return(PartialView("DeleteUnsuccessful")); } }
public ActionResult Create(PointOfSale item) { if (!ModelState.IsValid) return PartialView ("_Create", item); item.Store = Store.Find (item.StoreId); item.Warehouse = Warehouse.Find (item.WarehouseId); using (var scope = new TransactionScope ()) { item.CreateAndFlush (); } return PartialView ("_CreateSuccesful", item); }
public string getTransactionType(string description) { description = description.ToUpper(); if (Deposit.Any(n => description.IndexOf(n) != -1)) { return(Enumerators.TransactionType.Deposit.ToString()); } else if (PaymentMade.Any(n => description.IndexOf(n) != -1)) { return(Enumerators.TransactionType.PaymentMade.ToString()); } else if (PaymentReceived.Any(n => description.IndexOf(n) != -1)) { return(Enumerators.TransactionType.PaymentReceived.ToString()); } else if (PointOfSale.Any(n => description.IndexOf(n) != -1)) { return(Enumerators.TransactionType.PointOfSale.ToString()); } else if (Withdrawal.Any(n => description.IndexOf(n) != -1)) { return(Enumerators.TransactionType.Withdrawal.ToString()); } else if (OverseePurchase.Any(n => description.IndexOf(n) != -1)) { return(Enumerators.TransactionType.OverseePurchase.ToString()); } else if (TransactionCharges.Any(n => description.IndexOf(n) != -1)) { return(Enumerators.TransactionType.TransactionCharges.ToString()); } else if (AdminCharges.Any(n => description.IndexOf(n) != -1)) { return(Enumerators.TransactionType.AdminCharges.ToString()); } else if (PrepaidAirtime.Any(n => description.IndexOf(n) != -1)) { return(Enumerators.TransactionType.PrepaidAirtime.ToString()); } else if (MonthlyAccountCharges.Any(n => description.IndexOf(n) != -1)) { return(Enumerators.TransactionType.MonthlyAccountCharges.ToString()); } // Extend transaction type here else { return(Enumerators.TransactionType.Unknown.ToString()); } }
public void GetCartValue_WhenNoClubbedOffer_ShouldReturnOfferValue() { // Arrange var pos = new PointOfSale(this.backOffice); pos.AddItemToCart("A", 5); pos.AddItemToCart("B", 5); pos.AddItemToCart("C", 1); // Act var cartValue = pos.GetCartValue(); // Assertions Assert.AreEqual(370, cartValue); }
private async void DeleteTapGesture_Tapped(object sender, EventArgs e) { int ID = Int32.Parse(((((((sender as Image).Parent as StackLayout).Parent as Grid).Parent as StackLayout).Parent as Grid).Parent as StackLayout).ClassId); PointOfSale pointOfSale = pastryShop.PointOfSales.FirstOrDefault(p => p.ID == ID); if (pointOfSale != null) { RestClient <PointOfSale> pointOfSaleRC = new RestClient <PointOfSale>(); if (!(await pointOfSaleRC.DeleteAsync(pointOfSale.ID))) { return; } load(); } }
public IHttpActionResult DeletePointOfSale(int id) { PointOfSale pointOfSale = db.PointOfSales.Find(id); if (pointOfSale == null) { return(NotFound()); } var phoneNumbers = new List <PhoneNumber>(pointOfSale.PhoneNumbers); db.PointOfSales.Remove(pointOfSale); phoneNumbers.ForEach(p => db.PhoneNumbers.Remove(p)); db.Addresses.Remove(db.Addresses.Find(pointOfSale.Address_FK)); db.SaveChanges(); return(Ok(pointOfSale)); }
static void Main(string[] args) { string[] fruitlist = { "Apple", "Apple", "Orange", "Apple" }; PointOfSale POS = new PointOfSale(fruitlist); Console.WriteLine("Billing "); Console.WriteLine("Item\t\t\tQty\tAmount"); double totalCost = 0; foreach (Bill bill in POS.Bills) { Console.WriteLine("{0}\t{1}\t{2}", bill.Description, bill.Quantity, bill.Cost); totalCost += bill.Cost; } Console.WriteLine("Total:\t\t\t\t{0}", totalCost); }
// GET: PointOfSale/Edit/5 public ActionResult Edit(int id) { PointOfSale cm = new PointOfSale(); cm = cs.Get(t => t.id == id); PointOfSaleModel c = new PointOfSaleModel(); c.id = cm.id; c.nom = cm.nom; c.Adress = cm.Adress; c.phone = cm.phone; c.Type = cm.Type; return(View(c)); }
public ActionResult Create(PointOfSale item) { if (!ModelState.IsValid) { return(PartialView("_Create", item)); } item.Store = Store.Find(item.StoreId); item.Warehouse = Warehouse.Find(item.WarehouseId); using (var scope = new TransactionScope()) { item.CreateAndFlush(); } return(PartialView("_CreateSuccesful", item)); }
public ActionResult Edit(int id, PointOfSale cm) { PointOfSale c = new PointOfSale(); c = cs.Get(t => t.id == id); c.id = cm.id; c.Adress = cm.Adress; c.nom = cm.nom; c.phone = cm.phone; c.Type = cm.Type; cs.Update(c); cs.Commit(); return(RedirectToAction("Index")); }
public ActionResult Edit(PointOfSale item) { if (!ModelState.IsValid) return PartialView ("_Edit", item); var entity = PointOfSale.Find (item.Id); entity.Code = item.Code; entity.Name = item.Name; entity.Comment = item.Comment; using (var scope = new TransactionScope ()) { entity.UpdateAndFlush (); } return PartialView ("_Refresh"); }