public void When(GoalSet e) { _writer.Add(e.Id, new GoalHierarchalView { Description = e.Description, GoalId = e.Id, User = e.User }); }
public void When(GoalSet e) { this.Created = true; this.Description = e.Description; this.Id = e.Id; this.LengthOfGoalInDays = e.LengthOfGoalInDays; this.StartDate = e.StartDate; this.User = e.User; }
public void When(GoalSet e) { this.Created = true; this.Description = e.Description; this.Id = e.Id; this.LengthOfGoalInDays = e.LengthOfGoalInDays; this.StartDate = e.StartDate; this.User = e.User; }
public void When(GoalSet e) { _writer.Add(e.Id, new GoalHierarchalView { Description = e.Description, GoalId = e.Id, User = e.User }); }
public void When(GoalSet e) { _writer.Add(e.Id, new GoalCalendarView { GoalId = e.Id, DateStarted = e.StartDate, GoalDescription = e.Description, User = e.User }); }
public void When(GoalSet e) { Func<UserGoalsView> CreateView; CreateView = () => { var view = new UserGoalsView(); view.Goals.Add(e.Id); view.User = e.User; return view; }; _writer.AddOrUpdate(e.User,CreateView(),g=> g.Goals.Add(e.Id)); }
public void When(GoalSet e) { Func <UserGoalsView> CreateView; CreateView = () => { var view = new UserGoalsView(); view.Goals.Add(e.Id); view.User = e.User; return(view); }; _writer.AddOrUpdate(e.User, CreateView(), g => g.Goals.Add(e.Id)); }
/// <summary> /// /// </summary> /// <param name="ctx"></param> /// <param name="entityName"></param> /// <param name="dataMsg"></param> /// <returns></returns> public Message SaveLookup(WebOperationContext ctx, string entityName, Message dataMsg) { Message responseMsg = null; string jsonData = JSON.GetPayload(dataMsg); try { switch (entityName) { case "EntityLinks": EntityLinks entityLinks = this.SaveLookup <EntityLinks>(entityName, jsonData); responseMsg = HttpUtilities.GenerateResponse <EntityLinks>(ctx, entityLinks, this.timer); break; case "EventLogging": EventLogger eventLogger = this.SaveLookup <EventLogger>(entityName, jsonData); responseMsg = HttpUtilities.GenerateResponse <EventLogger>(ctx, eventLogger, this.timer); break; case "KPAdmins": Admin kpAdmin = this.SaveLookup <Admin>(entityName, jsonData); responseMsg = HttpUtilities.GenerateResponse <Admin>(ctx, kpAdmin, this.timer); break; case "KPCategoryL1": CategoryL1 kpCatL1 = this.SaveLookup <CategoryL1>(entityName, jsonData); responseMsg = HttpUtilities.GenerateResponse <CategoryL1>(ctx, kpCatL1, this.timer); break; case "KPCategoryL2": CategoryL2 kpCatL2 = this.SaveLookup <CategoryL2>(entityName, jsonData); responseMsg = HttpUtilities.GenerateResponse <CategoryL2>(ctx, kpCatL2, this.timer); break; case "KPConfigList": ConfigList kpConfigList = this.SaveLookup <ConfigList>(entityName, jsonData); responseMsg = HttpUtilities.GenerateResponse <ConfigList>(ctx, kpConfigList, this.timer); break; //case "KPCountry": // Country kpCountry = this.SaveLookup<Country>(entityName, jsonData); // responseMsg = ctx.CreateJsonResponse<Country>(kpCountry); // break; case "KPCustomers": Customer kpCustomers = this.SaveLookup <Customer>(entityName, jsonData); responseMsg = HttpUtilities.GenerateResponse <Customer>(ctx, kpCustomers, this.timer); break; //case "KPEffortInstances": // EffortInstance kpEffortInstances = this.SaveLookup<EffortInstance>(entityName, jsonData); // responseMsg = ctx.CreateJsonResponse<EffortInstance>(kpEffortInstances); // break; //case "KPEfforts": // Effort kpEfforts = this.SaveLookup<Effort>(entityName, jsonData); // responseMsg = ctx.CreateJsonResponse<Effort>(kpEfforts); // break; case "KPGoalSetLocks": GoalSetLock kpGoalSetLock = this.SaveLookup <GoalSetLock>(entityName, jsonData); responseMsg = HttpUtilities.GenerateResponse <GoalSetLock>(ctx, kpGoalSetLock, this.timer); break; case "KPGoalSets": GoalSet kpGoalSet = this.SaveLookup <GoalSet>(entityName, jsonData); responseMsg = HttpUtilities.GenerateResponse <GoalSet>(ctx, kpGoalSet, this.timer); break; //case "KPPerspectives": // Perspective kpPerspective = this.SaveLookup<Perspective>(entityName, jsonData); // responseMsg = ctx.CreateJsonResponse<Perspective>(kpPerspective); // break; case "KPPerspectiveInstances": PerspectiveInstance kpPerspectiveInstance = this.SaveLookup <PerspectiveInstance>(entityName, jsonData); responseMsg = HttpUtilities.GenerateResponse <PerspectiveInstance>(ctx, kpPerspectiveInstance, this.timer); break; case "KingpinLockdown": KingpinLockdown lockdown = this.SaveLookup <KingpinLockdown>(entityName, jsonData); responseMsg = HttpUtilities.GenerateResponse <KingpinLockdown>(ctx, lockdown, this.timer); break; case "Announcements": Announcement announcement = this.SaveLookup <Announcement>(entityName, jsonData); responseMsg = HttpUtilities.GenerateResponse <Announcement>(ctx, announcement, this.timer); break; case "KPTeams": Team kpTeam = this.SaveLookup <Team>(entityName, jsonData); responseMsg = HttpUtilities.GenerateResponse <Team>(ctx, kpTeam, this.timer); break; case "KPVPs": VP kpVP = this.SaveLookup <VP>(entityName, jsonData); responseMsg = HttpUtilities.GenerateResponse <VP>(ctx, kpVP, this.timer); break; case "OneOffConfigurations": OneOffConfiguration oneOffConfiguration = this.SaveLookup <OneOffConfiguration>(entityName, jsonData); responseMsg = HttpUtilities.GenerateResponse <OneOffConfiguration>(ctx, oneOffConfiguration, this.timer); break; case "UserEventLogging": UserLogging userEvent = this.SaveLookup <UserLogging>(entityName, jsonData); responseMsg = HttpUtilities.GenerateResponse <UserLogging>(ctx, userEvent, this.timer); break; default: string errMsg = string.Format("Error: No lookup list found with the name: {0}", entityName); responseMsg = HttpUtilities.GenerateExceptionResponse(ctx, new Exception(errMsg), "POST/PUT", HttpStatusCode.BadRequest); break; } } catch (Exception ex) { responseMsg = HttpUtilities.GenerateExceptionResponse(ctx, ex, "POST/PUT", HttpStatusCode.InternalServerError); } this.timer.Stop(); return(responseMsg); }
public void When(GoalSet e) { _writer.Add(e.Id, new GoalCalendarView { GoalId = e.Id, DateStarted = e.StartDate, GoalDescription = e.Description, User = e.User }); }
/// <summary> /// Gets the lookup value for an item field /// TODO: Create an IRespository /// </summary> /// <param name="fieldName"></param> /// <param name="fieldValue"></param> /// <returns></returns> public string GetLookupValue(string fieldName, string fieldValue, string lookupField) { string value = string.Empty; switch (fieldName) { case "KPTeam": Team team = this.spDataAccess.Teams.Find(i => i.Nick == fieldValue || i.Title == fieldValue); value = (team != null) ? team.KPID.ToString() : string.Empty; break; case "GoalSet": GoalSet goalSet = this.GoalSetRepository.Items.Find(i => i.Title == fieldValue); value = (goalSet != null) ? goalSet.KPID.ToString() : string.Empty; break; case "KPPrimaryVP": VP vp = this.VPRepository.Items.Find(i => i.Nick == fieldValue); value = (vp != null) ? vp.KPID.ToString() : string.Empty; break; case "KPSecondaryVPs": // handle multiple string[] values; List <string> newValues = new List <string>(); if (fieldValue.Contains(",")) { values = fieldValue.Split(','); foreach (string val in values) { VP svp = this.VPRepository.Items.Find(i => i.Nick == val); value = (svp != null) ? svp.KPID.ToString() : string.Empty; // leave loop since we have a value mismatch if (string.IsNullOrEmpty(value)) { break; } // otherwise we'll continue adding values newValues.Add(value); value = string.Join(",", newValues.ToArray()); } } else { VP svp = this.VPRepository.Items.Find(i => i.Nick == fieldValue); value = (svp != null) ? svp.KPID.ToString() : string.Empty; } break; case "CategoryL1": CategoryL1 catL1 = this.CategoryL1Repository.Items.Find(i => i.Title == fieldValue); value = (catL1 != null) ? catL1.KPID.ToString() : string.Empty; break; case "CategoryL2": CategoryL2 catL2 = this.CategoryL2Repository.Items.Find(i => i.Title == fieldValue); value = (catL2 != null) ? catL2.KPID.ToString() : string.Empty; break; } return(value); }