public BoxVM Add(BoxVM entity) { try { var box = _mapper.Map <Box>(entity); var boxType = _unitOfWork.Repository <BoxType>().GetById(box.BoxTypeID); box.SetBoxType(boxType); //if (box.ProductID != null && box.ProductID != Guid.Empty) // AddBoxHasProduct(entity.RangeProductsItems, box); //else AddBoxWithoutProduct(entity.ChildrenBoxesID, box); _unitOfWork.CommitSync(); return(entity); } catch (CustomException exc) { throw exc; } catch (Exception ex) { throw CustomException.Create <BoxApplicationService>("Unexpected error fetching add product", nameof(this.Add), ex); } }
void BoxTapped(object sender, EventArgs e) { if (IsLoading) { return; } if (sender != null) { BoxView boxTapped = sender as BoxView; if (boxTapped != null) { BoxVM VM = boxTapped.BindingContext as BoxVM; if (VM != null) { var Column = Grid.GetColumn(boxTapped); var Row = Grid.GetRow(boxTapped); SelectPage.boxTapped = VM; SelectPage.Column = Column; SelectPage.Row = Row; Navigation.PushModalAsync(SelectPage); //DisplayAlert("Box", $"type :{VM.Type},row :{Row},column :{Column}", "Cancel"); //VM.Type = BoxType.BlueSteel; } } else { return; } } else { return; } }
public IActionResult Create(BoxVM boxVM) { try { _boxApplicationService.Add(boxVM); return(RedirectToAction("Index")); } catch (CustomException exc) { throw exc; } catch (Exception ex) { throw ex; } }
private void Clear_All_Clicked(object sender, EventArgs eventArgs) { Number_Of_Move.Text = ""; Number_Of_Move.BackgroundColor = Color.Default; Solution = new List <HumanMoveArrow>(); BoxsToSolve = new Dictionary <TupleKey, BoxType>(); SelectPage = new SelectColorPage(this); foreach (var item in MainTableGrid.Children) { BoxView boxView = item as BoxView; if (boxView != null) { BoxVM boxVM = boxView.BindingContext as BoxVM; if (boxVM != null) { boxVM.Type = BoxType.Empty; } } } IsChange = false; }
public ActionResult Box(string id, string userId) { if (BifSessionData.UserStatus <= 0 || !BifSessionData.HasProfile) { ViewBag.Message = "Your user profile is still pending. An administrator will review and approve your profile before you can use the Box Builder. Please check back soon."; return(View("Message")); } int.TryParse(id, out int exchangeId); if (exchangeId == 0) { exchangeId = BifSessionData.ExchangeId; } if (exchangeId == 0) { ViewBag.Message = "No Exchange selected."; return(View("Message")); } userId = BifSessionData.IsInRole("ADMIN") ? userId ?? BifSessionData.Id : BifSessionData.Id; Exchange exchange = DAL.Context.SignUps.Where(s => s.UserId == userId && s.ExchangeId == exchangeId).Select(x => x.Exchange).FirstOrDefault(); if (exchange == null && exchangeId != 0) { return(RedirectToAction("", "Home")); } BoxVM vm = new BoxVM { UserId = userId, ExchangeId = exchangeId, ExchangeName = exchange?.Name ?? "Open", IsLocked = exchange?.ShipDate < DateTime.Now.AddDays(-14), Items = boxItems(userId, exchangeId), }; return(View(vm)); }
public Task <BoxVM> AddAsync(BoxVM entity) { throw new NotImplementedException(); }
public void GenarateBoxes(int nivel) { if (nivel == 1) { try { var boxType = _unitOfWork.Repository <BoxType>().GetById(new Guid("4FF493D4-118C-4925-A68C-BDC029D67F36")); for (int c = 0; c < 210; c++) { BoxVM boxEngradado = new BoxVM() { BoxTypeID = boxType.Id, Description = $"{c} - With 24 Coca-Cola", Status = Enum.GetName(typeof(EBoxStatus), EBoxStatus.Empty), ProductID = new Guid("45458722-5D7C-48F9-AE8D-96CDC4B31CE8"), RangeProductsItems = 24 }; var box = _mapper.Map <Box>(boxEngradado); box.SetBoxType(boxType); //if (box.ProductID != null && box.ProductID != Guid.Empty) // AddBoxHasProduct(boxEngradado.RangeProductsItems, box); //else AddBoxWithoutProduct(boxEngradado.ChildrenBoxesID, box); _unitOfWork.CommitSync(); } } catch (CustomException exc) { throw exc; } catch (Exception ex) { throw CustomException.Create <BoxApplicationService>("Unexpected error fetching add product", nameof(this.Add), ex); } } else if (nivel == 2) { try { ICollection <BoxVM> boxesEngradados = FindBoxesAvailableWithProducts(); var boxType = _unitOfWork.Repository <BoxType>().GetById(new Guid("BDDE455A-7BC0-499F-A41E-E67399A46901")); for (int p = 0; p < 5; p++) { BoxVM boxPallet = new BoxVM() { BoxTypeID = boxType.Id, Description = $"{p} - With 42 engrado Coca-Cola", Status = Enum.GetName(typeof(EBoxStatus), EBoxStatus.Empty), BoxesChildren = boxesEngradados.Take(42).ToList() }; boxPallet.ChildrenBoxesID = boxPallet.BoxesChildren.Select(x => x.DT_RowId).ToArray(); foreach (var item in boxPallet.BoxesChildren) { boxesEngradados.Remove(item); } var box = _mapper.Map <Box>(boxPallet); box.SetBoxType(boxType); //if (box.ProductID != null && box.ProductID != Guid.Empty) // AddBoxHasProduct(boxPallet.RangeProductsItems, box); //else AddBoxWithoutProduct(boxPallet.ChildrenBoxesID, box); _unitOfWork.CommitSync(); } } catch (CustomException exc) { throw exc; } catch (Exception ex) { throw CustomException.Create <BoxApplicationService>("Unexpected error fetching add product", nameof(this.Add), ex); } } else { try { ICollection <BoxVM> boxesPallets = FindBoxesAvailableByBoxType(new Guid("BDDE455A-7BC0-499F-A41E-E67399A46901")); var boxType = _unitOfWork.Repository <BoxType>().GetById(new Guid("31C60A03-DF38-4391-9ECF-AA29D9529255")); for (int i = 0; i < 1; i++) { BoxVM boxContainer = new BoxVM() { BoxTypeID = boxType.Id, Description = $"{i} - With 5 pallets Coca-Cola", Status = Enum.GetName(typeof(EBoxStatus), EBoxStatus.Empty), BoxesChildren = boxesPallets.Take(5).ToList(), }; boxContainer.ChildrenBoxesID = boxContainer.BoxesChildren.Select(x => x.DT_RowId).ToArray(); foreach (var item in boxContainer.BoxesChildren) { boxesPallets.Remove(item); } var box = _mapper.Map <Box>(boxContainer); box.SetBoxType(boxType); //if (box.ProductID != null && box.ProductID != Guid.Empty) // AddBoxHasProduct(boxContainer.RangeProductsItems, box); //else AddBoxWithoutProduct(boxContainer.ChildrenBoxesID, box); _unitOfWork.CommitSync(); } } catch (CustomException exc) { throw exc; } catch (Exception ex) { throw CustomException.Create <BoxApplicationService>("Unexpected error fetching add product", nameof(this.Add), ex); } } }
public Task <BoxVM> UpdateAsync(BoxVM updated) { throw new NotImplementedException(); }
public BoxVM Update(BoxVM updated) { throw new NotImplementedException(); }