public PartialViewResult UpdateMarketItemToShoppingList(int id, int units = 1) { AgenteShoppingList agente = new AgenteShoppingList(); MarketItem item = agente.AddOrUpdateMarketItemEnShoppingList(EstadoUsuario.CurrentListPublicId, id, units); return(PartialView("PVMarketItemEnShoppingList", item)); }
public ActionResult UseAssetsForDeltas(IEnumerable <JAssetDeltas> deltas) { string publicID = EstadoUsuario.CurrentListPublicId; IEnumerable <string> szdeltas = this.Request.Params.AllKeys.Where(k => k.StartsWith("deltas[")); List <KeyValuePair <int, int> > assets = new List <KeyValuePair <int, int> >(); int cont = 0; int id = 0; int units = 0; foreach (var item in szdeltas) { if (cont == 0) { id = int.Parse(this.Request.Params[item]); cont++; } else { units = int.Parse(this.Request.Params[item]); assets.Add(new KeyValuePair <int, int>(id, units)); cont = 0; } } AgenteShoppingList agente = new AgenteShoppingList(); agente.UseAssetsForDeltas(publicID, assets); return(null); }
public ActionResult MyAssets(string id = null) { if (id == null) { id = Guid.NewGuid().ToString(); return(RedirectToAction("New", new { id = id })); } EstadoUsuario.CurrentListPublicId = id; EDVMyAssets edv = new EDVMyAssets(); SetHeadCounters(); ViewBag.PublicID = id; AgenteShoppingList agente = new AgenteShoppingList(); edv.allowEdit = agente.IsShoppingListOwner(EstadoUsuario.CurrentListPublicId, this.User.Identity == null ? null : this.User.Identity.Name); //Guardamos la shopping list en las de un usuario si se indica en la url agente.SaveListInMyListsIfProceed(this.Request, this.User.Identity, id); EVListSummary summ = agente.SelectListSummaryPorPublicID(id); JavaScriptSerializer serializer = new JavaScriptSerializer(); string itemArray = serializer.Serialize(summ.Items); edv.Summary = summ; edv.IsShoppingListFree = agente.IsShoppingListFree(id); edv.ListNavMenu = new EDPVListNavMenu <Enumerados.StepsForPVPList>(Modelo.Enumerados.StepsForPVPList.MyAssets); return(View(edv)); }
public ActionResult GetList(string id) { SetHeadCounters(); AgenteShoppingList agente = new AgenteShoppingList(); EVListSummary summ = agente.SelectListSummaryPorPublicIDRead(id); ViewBag.PublicID = id; JavaScriptSerializer serializer = new JavaScriptSerializer(); string itemArray = serializer.Serialize(summ.Items); EDVSummary edv = new EDVSummary(); edv.ItemArray = itemArray; edv.Summary = summ; if (summ.PublicID == id) { //Guardamos la shopping list en las de un usuario si se indica en la url agente.SaveListInMyListsIfProceed(this.Request, this.User.Identity, id); edv.IsShoppingListFree = agente.IsShoppingListFree(id); return(View("Summary", edv)); } else { return(View("Public", edv)); } }
public ActionResult UseAnalysedFit(string fitName) { try { //Obtenemos la fit del diccionario guardado en sesión, si no está, lanzamos un error IDictionary <string, FittingAnalyzed> diccFits = (IDictionary <string, FittingAnalyzed>)Session["lastAnalysedFits"]; FittingAnalyzed fit = null; if ((diccFits != null) && diccFits.ContainsKey(fitName)) { fit = diccFits[fitName]; } if (fit == null) { throw new ApplicationException("The fit is not recorded in our archives, try to analyse it again."); } //Guardamos la fit en base de datos AgenteShoppingList agente = new AgenteShoppingList(); int fitID = agente.SaveAnalysedFit(null, User.Identity.Name, fit); AgenteFittings agenteFit = new AgenteFittings(); int groupId = agenteFit.GetFitMarketGroupID(fitID); return(NavigateMarketGroup(groupId, fitID, fitName)); } catch (Exception ex) { return(new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest, ex.Message)); } }
public ActionResult GetShoppingListsByListPublicID(string id) { AgenteShoppingList agente = new AgenteShoppingList(); IEnumerable <EVStaticList> sslist = agente.SelectStaticListsByShoppingListPublicID(id); return(PartialView("PVStaticShoppingLists", sslist)); }
public ActionResult NewStaticShoppingList() { AgenteShoppingList agente = new AgenteShoppingList(); agente.CreateStaticShoppingList(EstadoUsuario.CurrentListPublicId); return(GetShoppingListsByListPublicID(EstadoUsuario.CurrentListPublicId)); }
public ActionResult DeleteMarketItemToShoppingList(int id) { AgenteShoppingList agente = new AgenteShoppingList(); agente.DeleteMarketItemEnShoppingList(EstadoUsuario.CurrentListPublicId, id); return(null); }
public EmptyResult UpdateDeltaInSummary(int id, int units = 0) { AgenteShoppingList agente = new AgenteShoppingList(); agente.UpdateDeltaToSummary(EstadoUsuario.CurrentListPublicId, id, units); return(new EmptyResult()); }
public ActionResult SaveShoppingListHeader(string slName, string slDescription) { AgenteShoppingList agente = new AgenteShoppingList(); string publicID = EstadoUsuario.CurrentListPublicId; agente.ActualizarShoppingListHeader(publicID, slName, slDescription); return(new EmptyResult()); }
public PartialViewResult SetUnitsToFitInShoppingList(int id, int units) { AgenteShoppingList agente = new AgenteShoppingList(); string publicID = EstadoUsuario.CurrentListPublicId; EVFitting evfit = agente.SetUnitsToFitInShoppingList(publicID, id, units); return(PartialView("PVFitInShoppingList", evfit)); }
public ActionResult Static(string id) { SetHeadCounters(); EDVStatic list = new EDVStatic(); AgenteShoppingList agente = new AgenteShoppingList(); list.StaticLists = agente.SelectStaticListByPublicID(id); return(View(list)); }
public ActionResult DeleteFittingFromShoppingList(int id) { string publicID = EstadoUsuario.CurrentListPublicId; AgenteShoppingList agente = new AgenteShoppingList(); agente.DeleteFitPorID(publicID, id); return(Content(id.ToString())); //return Json(new { Result = id }); }
public EmptyResult UpdatePrices() { double horas = (DateTime.Now - EstadoAplicacion.LastPricesUpdateTime).TotalHours; if (horas >= 24) { EstadoAplicacion.LastPricesUpdateTime = DateTime.Now; AgenteShoppingList agente = new AgenteShoppingList(); agente.UpdatePrices(); } return(new EmptyResult()); }
public ActionResult ClearAllDelta(string id) { try { AgenteShoppingList agente = new AgenteShoppingList(); agente.ClearAllDeltaInSummary(id); return(new EmptyResult()); } catch (Exception ex) { return(new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest, ex.Message)); } }
private ActionResult CreateShoppingList(string slName, string slDescription) { AgenteShoppingList agente = new AgenteShoppingList(); string userName = null; if (Request.IsAuthenticated) { userName = User.Identity.Name; } string id = agente.CrearShoppingList(slName, slDescription, userName); return(RedirectToAction("ImportFits", new { id = id })); }
public PartialViewResult AnalyseAssetsForDeltas(string rawAssets) { string publicID = EstadoUsuario.CurrentListPublicId; AgenteShoppingList agente = new AgenteShoppingList(); IEnumerable <AssetImported> assets = agente.ImportAssetsForListDelta(publicID, rawAssets); EDPVImportAssetsForDelta edv = new EDPVImportAssetsForDelta() { Assets = assets }; return(PartialView("PVAnalyseAssetsForDeltas", edv)); }
public ActionResult Public(string id) { AgenteShoppingList agente = new AgenteShoppingList(); EVListSummary summ = agente.SelectListSummaryPorPublicIDRead(id); JavaScriptSerializer serializer = new JavaScriptSerializer(); string itemArray = serializer.Serialize(summ.Items); ViewBag.PublicID = id; EDVSummary edv = new EDVSummary(); edv.ItemArray = itemArray; edv.Summary = summ; return(View(edv)); }
public ActionResult MyLists() { AgenteShoppingList agente = new AgenteShoppingList(); IEnumerable <EVShoppingListHeader> lists = agente.SelectShoppingListsByUserName(User.Identity.Name); AgenteGroupLists agenteGroup = new AgenteGroupLists(); IEnumerable <EVShoppingListHeader> groupLists = agenteGroup.SelectGroupListsByUserName(User.Identity.Name); EDVMyLists edv = new EDVMyLists() { Lists = lists, GroupLists = groupLists }; SetHeadCounters(); return(View(edv)); }
public ActionResult UseFitInMyList(int id) { try { AgenteShoppingList agente = new AgenteShoppingList(); agente.UseFitInList(EstadoUsuario.CurrentListPublicId, id); EVFitting evfit = agente.SelectFitPorID(EstadoUsuario.CurrentListPublicId, id); return(PartialView("PVFitInShoppingList", evfit)); } catch (Exception ex) { return(new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest, ex.Message)); } }
public ActionResult DeleteShoppingList(string id) { try { AgenteShoppingList agente = new AgenteShoppingList(); string userName = null; if (Request.IsAuthenticated) { userName = User.Identity.Name; } agente.DeleteShoppingList(id, userName); return(new EmptyResult()); } catch (Exception ex) { return(new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest, "The shopping list doesnt exist or you don't have the right to delete it.")); } }
public ActionResult ImportFits(string id = null) { if (id == null) { id = Guid.NewGuid().ToString(); return(RedirectToAction("New", new { id = id })); } this.ViewBag.PublicID = id; EstadoUsuario.CurrentListPublicId = id; AgenteShoppingList agente = new AgenteShoppingList(); //Guardamos la shopping list en las de un usuario si se indica en la url agente.SaveListInMyListsIfProceed(this.Request, this.User.Identity, id); //cargamos las fits que puedan estar agregadadas a la shopping list IEnumerable <EVFitting> fits = agente.SelectFitsEnShoppingList(id); EDVImportFits edv = new EDVImportFits(); SetHeadCounters(); edv.allowEdit = agente.IsShoppingListOwner(EstadoUsuario.CurrentListPublicId, this.User.Identity == null ? null : this.User.Identity.Name); EDVFittingsList edvFitList = new EDVFittingsList(); edvFitList.Fittings = fits; edv.Fittings = edvFitList; edv.IsShoppingListFree = agente.IsShoppingListFree(id); if (Request.IsAuthenticated) { EDVMyFittings edvmyfit = FittingsController.GetEDVMyFittingsByUser(User.Identity.Name); edv.MyFittings = edvmyfit; SetupFitListForImportMenu(edvmyfit.Fittings); } edv.ListNavMenu = new EDPVListNavMenu <Enumerados.StepsForPVPList>(Modelo.Enumerados.StepsForPVPList.AddFits); return(View(edv)); }
public ActionResult UseAnalysedFit(string fitName) { try { //Obtenemos la fit del diccionario guardado en sesión, si no está, lanzamos un error IDictionary <string, FittingAnalyzed> diccFits = (IDictionary <string, FittingAnalyzed>)Session["lastAnalysedFits"]; FittingAnalyzed fit = null; if ((diccFits != null) && diccFits.ContainsKey(fitName)) { fit = diccFits[fitName]; } if (fit == null) { throw new ApplicationException("The fit is not recorded in our archives, try to analyse it again."); } //Guardamos la fit en base de datos AgenteShoppingList agente = new AgenteShoppingList(); string userName = null; if (Request.IsAuthenticated) { userName = User.Identity.Name; } int fitID; EVFitting evfit = null; try { fitID = agente.SaveAnalysedFit(EstadoUsuario.CurrentListPublicId, userName, fit); evfit = agente.SelectFitPorID(EstadoUsuario.CurrentListPublicId, fitID); } catch (Exception ex) { return(new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest, ex.Message)); } return(PartialView("PVFitInShoppingList", evfit)); } catch (Exception ex) { return(new HttpStatusCodeResult(System.Net.HttpStatusCode.BadRequest, ex.Message)); } }
public ActionResult AddMarketItems(string id) { if (id == null) { id = Guid.NewGuid().ToString(); return(RedirectToAction("New", new { id = id })); } this.ViewBag.PublicID = id; EstadoUsuario.CurrentListPublicId = id; if (string.IsNullOrEmpty(id)) { throw new ApplicationException(Messages.err_requestWithoutPublicID); } AgenteMarketItems agente = new AgenteMarketItems(); AgenteShoppingList agenteShList = new AgenteShoppingList(); //Guardamos la shopping list en las de un usuario si se indica en la url agenteShList.SaveListInMyListsIfProceed(this.Request, this.User.Identity, id); IEnumerable <EVMarketItem> marketItems = agente.SelectMarketGroupsByParentID(null); IEnumerable <MarketItem> marketItemsEnShoppingList = agenteShList.SelectMarketItemsEnShoppingList(id); EDVAddMarketItems edv = new EDVAddMarketItems(); edv.allowEdit = agenteShList.IsShoppingListOwner(EstadoUsuario.CurrentListPublicId, this.User.Identity == null ? null : this.User.Identity.Name); SetHeadCounters(); edv.MarketItems = marketItems; edv.IsShoppingListFree = agenteShList.IsShoppingListFree(id); edv.MarketItemsEnShoppingList = marketItemsEnShoppingList; edv.ListNavMenu = new EDPVListNavMenu <Enumerados.StepsForPVPList>(Modelo.Enumerados.StepsForPVPList.AddMarketItems); return(View(edv)); }