public static async Task <bool> Logging() { var user = UserOptions.GetUser(); if (string.IsNullOrEmpty(user)) { return(false); } var model = new LoginModel { email = user, password = UserOptions.GetPassword(), }; UIFunc.ShowLoading(U.StandartLoggingText); var result = await WebServiceFunc.SubmitLogin(model); UIFunc.HideLoading(); if (!result.Item1) { return(false); } var aspxauth = result.Item4; UserOptions.SetAspxauth(aspxauth); return(true); }
public IActionResult Index(int userID) { string loginID = User.Identity.Name.ToString(); User user = UserOptions.GetUser(loginID); return(View(user)); }
public IActionResult ManageQuery(int queryID) { var username = User.Identity.Name.ToString(); var user = UserOptions.GetUser(username); var query = QueryOptions.Load(user, queryID); return(View("LoadQuery", query)); }
public IActionResult ManageQuestion(int queryNumber, int questionNumber) { var username = User.Identity.Name.ToString(); var user = UserOptions.GetUser(username); Query query = QueryOptions.Load(user, queryNumber); Question question = QuestionOptions.Load(query, questionNumber); return(View("LoadQuestion", question)); }
public IActionResult ManageAnswer() { var username = User.Identity.Name.ToString(); var user = UserOptions.GetUser(username); Query query = QueryOptions.Load(user, 1); Question question = QuestionOptions.Load(query, 1); Answer answer = AnswerOptions.Load(question, 1); return(View("LoadAnswer", answer)); }
public IActionResult LoadAnswer(int queryNumber, int questionNumber, int answerNumber) { var username = User.Identity.Name.ToString(); var user = UserOptions.GetUser(username); Query query = QueryOptions.Load(user, queryNumber); Question question = QuestionOptions.Load(query, questionNumber); Answer answer = AnswerOptions.Load(question, answerNumber); return(View("LoadAnswer", answer)); }
public IActionResult DeleteQuestionLive(int queryID, int questionNumber) { var username = User.Identity.Name.ToString(); var user = UserOptions.GetUser(username); var query = QueryOptions.Load(user, queryID); QueryOptions.DeleteQuestion(query, questionNumber); return(RedirectToAction("LoadNextQuestion", "Active", new { queryID = queryID, questionNumber = questionNumber })); }
public IActionResult DeleteQuestion(int queryID, int questionNumber) { var username = User.Identity.Name.ToString(); var user = UserOptions.GetUser(username); var query = QueryOptions.Load(user, queryID); QueryOptions.DeleteQuestion(query, questionNumber); return(View("LoadQuery", query)); }
public IActionResult InsertAnswer(int queryNumber, int questionNumber) { var username = User.Identity.Name.ToString(); var user = UserOptions.GetUser(username); var query = QueryOptions.Load(user, queryNumber); var question = QuestionOptions.Load(query, questionNumber); QuestionOptions.AddAnswer(question); return(RedirectToAction("LoadAnswer", "Answer", new { queryNumber = question.QueryNumber, questionNumber = question.Number, answerNumber = question.Answers.Max(x => x.Number) })); }
public IActionResult DeleteQuery(int queryNumber, int userId) { var username = User.Identity.Name.ToString(); var user = UserOptions.GetUser(username); var query = QueryOptions.Load(user, queryNumber); UserOptions.DeleteQuery(user, queryNumber); user = UserOptions.GetUser(username); return(View("Index", user)); }
public IActionResult CloseQuery(int queryID) { var username = User.Identity.Name.ToString(); var user = UserOptions.GetUser(username); var query = QueryOptions.Load(user, queryID); query.Questions = query.Questions.OrderBy(q => q.Order).ToList(); QueryOptions.Close(query); return(RedirectToAction(nameof(UserController.Index), "User")); }
public IActionResult InsertQuestion(int queryID) { var username = User.Identity.Name.ToString(); var user = UserOptions.GetUser(username); var query = QueryOptions.Load(user, queryID); QueryOptions.AddQuestion(query); var questionNumber = query.Questions.Max(x => x.Number); var question = QuestionOptions.Load(query, questionNumber); return(RedirectToAction("LoadQuestion", "Question", question)); }
public IActionResult ClientView() { var username = User.Identity.Name.ToString(); var user = UserOptions.GetUser(username); var test = user.Queries[0]; var queryNumber = test.Number; Query query = QueryOptions.Load(user, queryNumber); var t = query.Questions[0]; var questionNumber = t.Number; Question question = QuestionOptions.Load(query, questionNumber); return(View("ClientView", question)); }
public IActionResult AddAnswer(int queryNumber, int number, string answerName) { var username = User.Identity.Name.ToString(); var user = UserOptions.GetUser(username); var query = QueryOptions.Load(user, queryNumber); query.Questions = query.Questions.OrderBy(q => q.Order).ToList(); var question = QuestionOptions.Load(query, number); question.Answers = question.Answers.OrderBy(a => a.Order).ToList(); QuestionOptions.AddAnswer(question, 0, answerName); return(RedirectToAction("LoadActiveQuery", new { queryID = queryNumber })); }
public IActionResult Create(int userID) { var username = User.Identity.Name.ToString(); var user = UserOptions.GetUser(username); //var queryID = query.Number; //return RedirectToAction("ManageQuery","Query", queryID); UserOptions.AddQuery(user); var queryid = user.Queries.Max(x => x.Number); var query = QueryOptions.Load(user, queryid); return(RedirectToAction("LoadQuery", "Query", query)); }
public IActionResult LoadNextQuestion(int queryNumber, int questionNumber, bool fromDelete = false) { var username = User.Identity.Name.ToString(); var user = UserOptions.GetUser(username); var query = QueryOptions.Load(user, queryNumber); query.Questions = query.Questions.OrderBy(q => q.Order).ToList(); var question = QuestionOptions.Load(query, questionNumber); question.Answers = question.Answers.OrderBy(a => a.Order).ToList(); int index = 0; for (int i = 0; i < query.Questions.Count; ++i) { if (query.Questions[i].Number == question.Number) { index = i; } } try { if (fromDelete) { QuestionOptions.SetNextActive(question, query.Questions[index].Number); } else { QuestionOptions.SetNextActive(question, query.Questions[index + 1].Number); } } catch (ArgumentOutOfRangeException ex) { } try { //var nextQuestionNumber = query.Questions.First(x => x.Number > questionNumber).Number; //var nextQuestion = QuestionOptions.Load(query, nextQuestionNumber); var nextQuestion = QuestionOptions.GetActive(query.Questions[index + 1].Number, query.Code, false); question.Answers = question.Answers.OrderBy(a => a.Order).ToList(); return(View("LoadActiveQuestion", nextQuestion)); } catch { QueryOptions.Close(query); return(RedirectToAction(nameof(UserController.Index), "User")); } }
public IActionResult LoadQueryStartPage(int queryID) { var username = User.Identity.Name.ToString(); var user = UserOptions.GetUser(username); var query = QueryOptions.Load(user, queryID); query.Questions = query.Questions.OrderBy(q => q.Order).ToList(); QueryOptions.Open(query); query = QueryOptions.Load(user, queryID); // reload to get code query.Questions = query.Questions.OrderBy(q => q.Order).ToList(); QueryOptions.ResetScores(query); return(View("QueryStartView", query)); }
public IActionResult InsertQuestion(int queryNumber, int Order, string NewQuestionName) { var username = User.Identity.Name.ToString(); var user = UserOptions.GetUser(username); var query = QueryOptions.Load(user, queryNumber); query.Questions = query.Questions.OrderBy(q => q.Order).ToList(); QueryOptions.AddQuestion(query, NewQuestionName, Order + 1); var questionNumber = query.Questions.Max(x => x.Number); var question = QuestionOptions.Load(query, questionNumber); question.Answers = question.Answers.OrderBy(a => a.Order).ToList(); return(View("LoadActiveQuestion", question)); }
async public static Task <bool> SendErrorServer() { var dir = GetErrorDir(); if (Directory.Exists(dir)) { var files = Directory.EnumerateFiles(dir).Where(q => !q.Contains(GetLastErrorFile())).OrderBy(q => q).ToArray(); if (files.Length > 0) { var arg = new PushErrorLogArgument { UserRowId = UserOptions.GetUserRowId(), UserName = UserOptions.GetUser(), LogFiles = new List <PushErrorLogArgumentFile>(), BusinessRowId = UserOptions.GetBusinessRowId(), }; foreach (var file in files) { var errtext = File.ReadAllText(file); arg.LogFiles.Add(new PushErrorLogArgumentFile { ErrorFile = file, ErrorText = errtext }); } UIFunc.ShowLoading("Send error log..."); var ret = await WebServiceFunc.PushErrorLog(arg); if (!string.IsNullOrEmpty(ret)) { UIFunc.HideLoading(); return(false); } foreach (var file in files) { File.Delete(file); } } } UIFunc.HideLoading(); return(true); }
public IActionResult LoadActiveQuery(int queryID) { var username = User.Identity.Name.ToString(); var user = UserOptions.GetUser(username); var query = QueryOptions.Load(user, queryID); query.Questions = query.Questions.OrderBy(q => q.Order).ToList(); if (query.Questions.Count > 0) { var question = QuestionOptions.Load(query, query.Questions.First().Number); question.Answers = question.Answers.OrderBy(a => a.Order).ToList(); QuestionOptions.SetFirstActive(query); question.Code = query.Code; return(View("LoadActiveQuestion", question)); } return(RedirectToAction(nameof(UserController.Index), "User")); }
public IActionResult DisplayResults(int queryNumber, int questionNumber) { var username = User.Identity.Name.ToString(); var user = UserOptions.GetUser(username); var query = QueryOptions.Load(user, queryNumber); query.Questions = query.Questions.OrderBy(q => q.Order).ToList(); if (query != null) { var question = QuestionOptions.Load(query, questionNumber); question.Answers = question.Answers.OrderBy(a => a.Order).ToList(); /*var username = User.Identity.Name.ToString(); * var user = UserOptions.GetUser(username); * var query = QueryOptions.Load(user, 3); * DataManager.Question question = new Question(); */ /*foreach (DataManager.Question item in query.Questions) * { * if(item != null) * { * question = item; * } * }*/ if (question == null) { return(RedirectToAction(nameof(UserController.Index), "User")); } return(View("DisplayResults", question)); } //var q = QuestionOptions.Load(query, question.Number); //question.Answers = question.Answers.OrderBy(a => a.Order).ToList(); return(RedirectToAction(nameof(UserController.Index), "User")); }