/// <summary> /// Loads last state from storage and works out the new state /// </summary> private void LoadState() { try { this._launchCount = StorageHelper.GetSetting <int>(LAUNCH_COUNT); this._reviewed = StorageHelper.GetSetting <bool>(REVIEWED); if (!this._reviewed) { this._launchCount++; if (this._launchCount == FIRST_COUNT) { this._state = FeedbackState.FirstReview; } else if (this._launchCount == SECOND_COUNT) { this._state = FeedbackState.SecondReview; } this.StoreState(); } } catch (Exception ex) { Debug.WriteLine(string.Format("FeedbackHelper.LoadState - Failed to load state, Exception: {0}", ex.ToString())); } }
private FeedbackState CreateFeedbackState(ITAlertPhotonClient photonClient) { var input = new FeedbackStateInput(photonClient, _director); var state = new FeedbackState(input, photonClient); var onLobbyStateSync = new OnMessageTransition( photonClient, ITAlertChannel.GameState, typeof(LobbyMessage), LobbyState.StateName); var onSendAndSimulationSummaryTransition = new OnEventTransition( SimulationSummaryState.StateName, () => _simulationSummary.HasData); var onSendAndNoSimulationSummaryTransition = new OnEventTransition( MenuState.StateName, () => !_simulationSummary.HasData); input.FeedbackSendClickedEvent += onSendAndSimulationSummaryTransition.ChangeState; input.FeedbackSendClickedEvent += onSendAndNoSimulationSummaryTransition.ChangeState; state.AddTransitions( onLobbyStateSync, onSendAndSimulationSummaryTransition, onSendAndNoSimulationSummaryTransition); return(state); }
/// <summary> /// Loads last state from storage and works out the new state /// </summary> private void LoadState() { try { this._launchCount = storageHelper.GetSetting <int>(App.LaunchCountKey); this._reviewed = storageHelper.GetSetting <bool>(App.ReviewedKey); if (!this._reviewed) { this._launchCount++; if (this._launchCount == FirstCount) { this._state = FeedbackState.FirstReview; } else if (this._launchCount == SecondCount) { this._state = FeedbackState.SecondReview; } this.StoreState(); } } catch (Exception ex) { Debug.WriteLine(string.Format("FeedbackHelper.LoadState - Failed to load state, Exception: {0}", ex.ToString())); } }
/// <summary> /// 根据学生Id和仓库Id取学生发放计划 /// </summary> /// <param name="studentId"></param> /// <param name="storageId"></param> /// <returns></returns> public IEnumerable <ViewModels.ReleaseBookForStudentQueryView> GetStudentBookByStudentId(string studentId, string storageId) { //类型转换 var stId = studentId.ConvertToGuid(); //根据学生Id取班级Id var classId = _stuRepo.First(s => s.ID == stId).ProfessionalClass_Id; const FeedbackState feedbackState = FeedbackState.征订成功; //取学生教材待发放信息信息 //var releaseStudentBookPlans = // _declarationRepository.Find(dt => dt.ProfessionalClass_Id == classId&&dt.Subscription.FeedbackState==feedbackState) // .Select(dt => new ReleaseBookForStudentQueryView() // { // YearTerm = dt.Term, //学年学期 // CourseName = // _teachingTaskRepository.First( // t => t.TeachingTaskNum == dt.TeachingTask_Num).Course.Name, //课程名称 // TextbookId = dt.Textbook_Id.ToString(), //教材Id // TextbookName = dt.Textbook.Name,//教材名称 // PlanCount = dt.DeclarationCount.ToString(), //计划数 // ShelfNum = _inventoryRepository.First(i=>i.Textbook_Id==dt.Textbook_Id).ShelfNumber,//架位号 // InventoryId = _inventoryRepository.First(i=>i.Textbook_Id==dt.Textbook_Id).InventoryId.ToString(),//库存Id // InventoryCount = _inventoryRepository.First(i=>i.Textbook_Id==dt.Textbook_Id).InventoryCount.ToString(),//库存数量 // StorageId =_inventoryRepository.First( // i=>i.InventoryId==_inventoryRepository.First(s=>s.Textbook_Id==dt.Textbook_Id).InventoryId).Storage_Id.ToString(),//库存Id // Students=_stuRepo.Find(s=>s.ProfessionalClass_Id==classId).Select(s=>new StudentView() // { // Id=s.StudentId.ToString() // }) // }).Where(dt => dt.YearTerm==new TermAppl().GetCurrentTerm().ToString()&&dt.StorageId == storageId&&!string.IsNullOrEmpty(dt.Students.First(st=>st.Id==studentId).Id)); // return releaseStudentBookPlans; return(new List <ViewModels.ReleaseBookForStudentQueryView>()); }
public void WhenFeedbackApprovedUiShowsRelevantItems() { FeedbackState state = FeedbackState.GetUiState(FeedbackStatusFlag.Approved); Assert.AreEqual("Comments", state.HeaderText); Assert.IsFalse(state.Approvable); Assert.IsFalse(state.Destroyable); Assert.IsTrue(state.Deletable); Assert.AreEqual("", state.DeleteToolTip); Assert.IsTrue(state.Spammable); Assert.IsFalse(state.Emptyable); Assert.AreEqual("", state.EmptyToolTip); Assert.AreEqual("<em>There are no approved comments to display.</em>", state.NoCommentsHtml); }
/// <summary> /// 向订单添加回告 /// </summary> /// <param name="subscriptionPlan">订单</param> /// <param name="feedBackState">回告状态,成功或失败</param> /// <param name="remark">回告说明</param> /// <param name="feedbackPerson">回告人</param> /// <returns></returns> public static Feedback CreateFeedback(string feedbackPerson, FeedbackState feedBackState, string remark) { //创建回告 var feedback = new Feedback { ID = Guid.NewGuid(), FeedbackDate = DateTime.Now, //true为征订成功 FeedbackState = feedBackState, Remark = remark, Person = feedbackPerson, //教材科审核中 ApprovalState = ApprovalState.教材科审核中 /*订单添加回告*/ }; return feedback; }
/// <summary> /// 向订单添加回告 /// </summary> /// <param name="subscriptionPlan">订单</param> /// <param name="feedBackState">回告状态,成功或失败</param> /// <param name="remark">回告说明</param> /// <param name="feedbackPerson">回告人</param> /// <returns></returns> public static Feedback CreateFeedback(string feedbackPerson, FeedbackState feedBackState, string remark) { //创建回告 var feedback = new Feedback { ID = Guid.NewGuid(), FeedbackDate = DateTime.Now, //true为征订成功 FeedbackState = feedBackState, Remark = remark, Person = feedbackPerson, //教材科审核中 ApprovalState = ApprovalState.教材科审核中 /*订单添加回告*/ }; return(feedback); }
public void WhenFeedbackDeletedUiShowsRelevantItems() { FeedbackState state = FeedbackState.GetUiState(FeedbackStatusFlag.Deleted); Assert.AreEqual("Comments In The Trash Bin", state.HeaderText); Assert.IsTrue(state.Approvable); Assert.AreEqual("Undelete", state.ApproveText); Assert.IsTrue(state.Destroyable); Assert.IsFalse(state.Deletable); Assert.AreEqual("Trashes checked spam", state.DeleteToolTip); Assert.IsFalse(state.Spammable); Assert.IsTrue(state.Emptyable); Assert.AreEqual("Destroy all trash, not just checked", state.EmptyToolTip); Assert.AreEqual("<em>No Entries in the Trash.</em>", state.NoCommentsHtml); }
public void WhenFeedbackFlaggedAsSpamUiShowsRelevantItems() { FeedbackState state = FeedbackState.GetUiState(FeedbackStatusFlag.FlaggedAsSpam); Assert.AreEqual("Comments Flagged as SPAM", state.HeaderText); Assert.IsTrue(state.Approvable); Assert.AreEqual("Approve", state.ApproveText); Assert.IsFalse(state.Destroyable); Assert.IsTrue(state.Deletable); Assert.AreEqual("Trashes checked spam", state.DeleteToolTip); Assert.IsFalse(state.Spammable); Assert.IsTrue(state.Emptyable); Assert.AreEqual("Destroy all spam, not just checked", state.EmptyToolTip); Assert.AreEqual("<em>No Entries Flagged as SPAM.</em>", state.NoCommentsHtml); }
public void WhenFeedbackNeedsModerationUiShowsRelevantItems() { FeedbackState state = FeedbackState.GetUiState(FeedbackStatusFlag.NeedsModeration); Assert.AreEqual("Comments Pending Moderator Approval", state.HeaderText); Assert.IsTrue(state.Approvable); Assert.AreEqual("Approve", state.ApproveText); Assert.IsFalse(state.Destroyable); Assert.IsTrue(state.Deletable); Assert.AreEqual("", state.DeleteToolTip); Assert.IsTrue(state.Spammable); Assert.IsFalse(state.Emptyable); Assert.AreEqual("", state.EmptyToolTip); Assert.AreEqual("<em>No Entries Need Moderation.</em>", state.NoCommentsHtml); }
/// <summary> /// This should only be called when the app is Launching /// </summary> public void Launching() { _launchCount = new LaunchCountQuery().Get(); _reviewed = new ReviewedQuery().Get(); if (!_reviewed) { _launchCount++; if (_launchCount == FIRST_COUNT) _state = FeedbackState.FirstReview; else if (_launchCount == SECOND_COUNT) _state = FeedbackState.SecondReview; StoreState(); } }
public ResponseView SubmitFeedback(IEnumerable <SubscriptionForFeedbackView> subscriptions, string loginName, string feedbackState, string remark) { //回告意见 var sugg = feedbackState.ConvertToBool(); //订单ID var ids = subscriptions.Select(t => t.SubscriptionId.ConvertToGuid()); //回告状态 FeedbackState state = FeedbackState.未征订; Enum.TryParse(feedbackState, out state); //返回消息 var result = new ResponseView(); //创建回告 var feedback = SubscriptionService.CreateFeedback(loginName, state, remark); //修改订单,增加回告 var subs = _subscriptionRepo.Find(t => ids.Contains(t.ID)); foreach (var item in subs) { //添加回告 item.Feedback = feedback; //修改订单状态 item.SubscriptionState = state; _subscriptionRepo.Modify(item); } //_subscriptionRepo.Modify( // t => ids.Contains(t.ID), // d => new Subscription { Feedback = feedback } // ); try { _subscriptionRepo.Context.Commit(); } catch (Exception e) { result.IsSuccess = false; result.Message = "回告失败"; } return(result); }
public IEnumerable <SubscriptionForFeedbackView> GetSubscriptionByBooksellerId(string term, string booksellerId, string feedbackStateName) { //书商ID var id = booksellerId.ConvertToGuid(); //回告状态 FeedbackState state = FeedbackState.未征订; Enum.TryParse(feedbackStateName, out state); IEnumerable <Subscription> subs = new List <Subscription>(); subs = GetSubscriptionByState(term, id, state); //switch (state) //{ // case FeedbackState.征订中: // subs = _subscriptionRepo.Find(t => // t.SchoolYearTerm.Year == yearTerm.Year && // t.SchoolYearTerm.Term == yearTerm.Term && // t.Bookseller_Id == id // ).Where(t => // !t.Feedback_Id.HasValue // ); // break; // case FeedbackState.征订成功: // subs = GetSubscriptionByState(term, id, FeedbackState.征订成功); // break; // case FeedbackState.征订失败: // subs = GetSubscriptionByState(term, id, FeedbackState.征订失败); // break; // case FeedbackState.未知状态: // case FeedbackState.未征订: // default: // break; //} return(_adapter.Adapt <SubscriptionForFeedbackView>(subs)); }
private ITAlertRoomStateController CreateStateController() { // TODO: handle the lifecyclemanager changestate event in the case of error -> kick players back to lobby. var lifecycleStoppedErrorTransition = new LifecycleStoppedTransition(ErrorState.StateName, ExitCode.Error, ExitCode.Undefined, ExitCode.Abort); var lifecycleManager = InitializeSimulationRoot(); lifecycleManager.Exception += _exceptionHandler.OnException; lifecycleManager.Stopped += lifecycleStoppedErrorTransition.OnLifecycleStopped; var initializingState = new InitializingState(lifecycleManager, PhotonPlugin, Messenger, PlayerManager, RoomSettings, Analytics); var initializedTransition = new CombinedPlayersStateTransition(ClientState.Initialized, PlayingState.StateName); initializingState.PlayersInitialized += initializedTransition.OnPlayersStateChange; initializingState.AddTransitions(initializedTransition, lifecycleStoppedErrorTransition); var playingState = new PlayingState(lifecycleManager, PhotonPlugin, Messenger, PlayerManager, RoomSettings, Analytics); var lifecycleCompleteTransition = new LifecycleStoppedTransition(FeedbackState.StateName, ExitCode.Complete); lifecycleManager.Stopped += lifecycleCompleteTransition.OnLifecycleStopped; playingState.AddTransitions(lifecycleCompleteTransition, lifecycleStoppedErrorTransition); var feedbackState = new FeedbackState(lifecycleManager, PhotonPlugin, Messenger, PlayerManager, RoomSettings, Analytics); var feedbackStateTransition = new CombinedPlayersStateTransition(ClientState.FeedbackSent, ExitState.StateName); feedbackState.PlayerFeedbackSentEvent += feedbackStateTransition.OnPlayersStateChange; feedbackState.AddTransitions(feedbackStateTransition); var exitState = new ExitState(lifecycleManager, PhotonPlugin, Messenger, PlayerManager, RoomSettings, Analytics); var controller = new ITAlertRoomStateController(initializingState, playingState, feedbackState, exitState); controller.SetParent(ParentStateController); return(controller); }
/// <summary> /// Loads last state from storage and works out the new state /// </summary> private void LoadState() { try { this._launchCount = StorageHelper.GetSetting<int>(LAUNCH_COUNT); this._reviewed = StorageHelper.GetSetting<bool>(REVIEWED); if (!this._reviewed) { this._launchCount++; if (this._launchCount == FIRST_COUNT) this._state = FeedbackState.FirstReview; else if (this._launchCount == SECOND_COUNT) this._state = FeedbackState.SecondReview; this.StoreState(); } } catch (Exception ex) { Debug.WriteLine(string.Format("FeedbackHelper.LoadState - Failed to load state, Exception: {0}", ex.ToString())); } }
/// <summary> /// Method used for updating the state of an existing feedback entry. /// </summary> /// <param name="id">The id of the feedback entry to update.</param> /// <param name="feedbackState">The new state of the feedback entry.</param> public void UpdateFeedback(string id, FeedbackState feedbackState) { // Validate input data Validation.IdCheck(id); // Convert the textual representation of the id to an integer int iFeedbackId = Convert.ToInt32(id); using (IntelliCloudContext context = new IntelliCloudContext()) { // Get the feedback entity from the context FeedbackEntity feedback = context.Feedbacks .Include(f => f.Question) .Include(f => f.User) .Include(f => f.Answer) .SingleOrDefault(f => f.Id == iFeedbackId); if (feedback == null) throw new NotFoundException("No feedback entity exists with the specified ID."); // Update the state of the feedback entry feedback.FeedbackState = feedbackState; // Save the changes to the context context.SaveChanges(); } }
/// <summary> /// 根据回告状态,取订单 /// </summary> /// <param name="term"></param> /// <param name="booksellerId"></param> /// <param name="state"></param> /// <returns></returns> private IEnumerable<Subscription> GetSubscriptionByState(string term, Guid booksellerId, FeedbackState state) { var yearTerm = new SchoolYearTerm(term); return _subscriptionRepo.Find(t => t.SchoolYearTerm.Year == yearTerm.Year && t.SchoolYearTerm.Term == yearTerm.Term && t.Bookseller_Id == booksellerId && //t.Feedback.FeedbackState == state t.SubscriptionState == state ); }
/// <summary> /// 根据回告状态,取订单 /// </summary> /// <param name="term"></param> /// <param name="booksellerId"></param> /// <param name="state"></param> /// <returns></returns> private IEnumerable <Subscription> GetSubscriptionByState(string term, Guid booksellerId, FeedbackState state) { var yearTerm = new SchoolYearTerm(term); return(_subscriptionRepo.Find(t => t.SchoolYearTerm.Year == yearTerm.Year && t.SchoolYearTerm.Term == yearTerm.Term && t.Bookseller_Id == booksellerId && //t.Feedback.FeedbackState == state t.SubscriptionState == state )); }
/// <summary> /// Loads last state from storage and works out the new state. /// </summary> private void LoadState() { try { LaunchCount = StorageHelper.GetSetting<int>(LaunchCountKey); IsReviewed = StorageHelper.GetSetting<bool>(ReviewedKey); LastLaunchDate = StorageHelper.GetSetting<DateTime>(LastLaunchDateKey); if (!reviewed) { if (!CountDays || lastLaunchDate.Date < DateTime.Now.Date) { LaunchCount++; LastLaunchDate = DateTime.Now; } if (LaunchCount == FirstCount) { State = FeedbackState.FirstReview; } else if (LaunchCount == SecondCount) { State = FeedbackState.SecondReview; } else if (RecurrentCount != 0 && LaunchCount % RecurrentCount == 0) { State = FeedbackState.RecurrentReview; } StoreState(); } } catch (Exception ex) { Debug.WriteLine(string.Format("FeedbackHelper.LoadState - Failed to load state, Exception: {0}", ex.ToString())); } }
/// <summary> /// Loads last state from storage and works out the new state /// </summary> private void LoadState() { try { this._launchCount = storageHelper.GetSetting<int>(App.LaunchCountKey); this._reviewed = storageHelper.GetSetting<bool>(App.ReviewedKey); if (!this._reviewed) { this._launchCount++; if (this._launchCount == FirstCount) this._state = FeedbackState.FirstReview; else if (this._launchCount == SecondCount) this._state = FeedbackState.SecondReview; this.StoreState(); } } catch (Exception ex) { Debug.WriteLine(string.Format("FeedbackHelper.LoadState - Failed to load state, Exception: {0}", ex.ToString())); } }
public void UpdateFeedback(string id, FeedbackState feedbackState) { this.manager.UpdateFeedback(id, feedbackState); }