public static UserResult InterpretMessageBody(GithubDocument document) { var result = new UserResult(); foreach (var property in document.Properties) { switch (property.Key) { case "login": result.Login = (string) property.Value; break; case "following": result.Following = (int)property.Value; break; case "followers": result.Followers = (int)property.Value; break; case "hireable": result.Hireable = (bool)property.Value; break; } } foreach (var link in document.Links.Values) { if (link is AvatarLink) { result.AvatarLink = (AvatarLink)link; } } return result; }
public ActionResult Vote(int id) { var match = _bookieContext.Matches.FirstOrDefault(x => x.Id == id); ViewBag.match = match; BookieDatabase.UserResult result = new UserResult(); result.MatchId = match.Id; result.Match = match; return View(result); }
private async static Task <UserResult> ShowContentDialog( StyleableWindow window, string title, string primaryText, string secondaryText, string primaryButton, string secondaryButton, string closeButton, int iconSymbol, UserResult primaryButtonResult = UserResult.Ok) { UserResult result = UserResult.None; ContentDialog contentDialog = window.ContentDialog; await ShowDialog(); async Task ShowDialog() { if (contentDialog != null) { contentDialog.Title = title; contentDialog.PrimaryButtonText = primaryButton; contentDialog.SecondaryButtonText = secondaryButton; contentDialog.CloseButtonText = closeButton; contentDialog.Content = CreateDialogTextContent(primaryText, secondaryText, iconSymbol); contentDialog.PrimaryButtonCommand = MiniCommand.Create(() => { result = primaryButtonResult; }); contentDialog.SecondaryButtonCommand = MiniCommand.Create(() => { result = UserResult.No; }); contentDialog.CloseButtonCommand = MiniCommand.Create(() => { result = UserResult.Cancel; }); await contentDialog.ShowAsync(ContentDialogPlacement.Popup); } ; } return(result); }
public async Task TestPasswordReset() { var(result, code) = await userService.ForgotPassword("*****@*****.**"); Assert.False(result.Succeeded); Assert.Null(code); string testEmail = GetTestEmail(); UserResult testUserCreation = await userService.CreateUser( new NewUser() { Email = testEmail, FirstName = testEmail, LastName = testEmail, IsSubscribedNewsletter = false, Password = Guid.NewGuid().ToString() }); ApplicationUser user = testUserCreation.User; (result, code) = await userService.ForgotPassword(user.Email); Assert.True(result.Succeeded); Assert.NotNull(code); result = await userService.ResetPassword(user.Email, code, ""); Assert.False(result.Succeeded); result = await userService.ResetPassword(user.Email, "", "Test_0_tesT"); Assert.False(result.Succeeded); result = await userService.ResetPassword(user.Email, code, "Test_0_tesT"); Assert.True(result.Succeeded); var principal = await signInManager.CreateUserPrincipalAsync(user); result = await userService.ChangePassword(principal, "Test_0_tesT", ""); Assert.False(result.Succeeded); result = await userService.ChangePassword(new ClaimsPrincipal(), "Test_0_tesT", "Test_1_tesT"); Assert.False(result.Succeeded); result = await userService.ChangePassword(principal, "Test_0_tesT", "Test_1_tesT"); Assert.True(result.Succeeded); }
/// <summary> /// Обработчик события Завершения контрола Вступление. /// </summary> /// <param name="person"></param> private void Introduction_OnComplete(Person person) { MainManager.Instance.Person = person; MainManager.Instance.CurrentTaskID = 0; MainManager.Instance.AnswerAttempt = 0; UserResult ur = new UserResult() { Date = DateTime.Now.ToString("dd.MM.yyyy HH:mm"), Person = UniversalCatalog.PersonRusNames[MainManager.Instance.Person], CountQuestions = MainManager.Instance.PersonInfo.Tasks.Count }; MainManager.Instance.UserResults.Results.Add(ur); SetState(UIState.Tasks); }
public VacationInfoVM GetVacationInfo(long userId, UserResult userResult) { var userVacationLimits = userResult.UserDaysOff.Where(udo => udo.UserId == userId).ToList(); var usedTimesOff = userResult.TimesOff.Where(uto => uto.UserId == userId).ToList(); var limitGroups = userVacationLimits.GroupBy(udo => udo.TimeOffTypeId) .Select(g => new TimeOffWithCounterVM { TimeOffType = (TimeOffType)g.First().TimeOffTypeId, Count = (short)g.Sum(udo => udo.Total) }).ToList(); var usedTimeOffGroups = usedTimesOff.GroupBy(udo => udo.TimeOffTypeId) .Select(g => new TimeOffWithCounterVM { TimeOffType = (TimeOffType)g.First().TimeOffTypeId, Count = (short)g.Count() }).ToList(); return(GetVacationInfo(limitGroups, usedTimeOffGroups)); }
public void TestGetCurrentUserNoToken() { ServerConfiguration configuration = new ServerConfiguration() { JwtSecretKey = "secret" }; UserServices userServices = new UserServices(DataProviderMock); UserResult res = null; Task.Run(async() => { res = await userServices.GetCurrentUser(null, configuration); }).Wait(); Assert.AreEqual(res.Result, BlueDogResult.BadToken); }
public void Register(AccountParam param, HttpRequest request) { string[] credentials = GetHeaderCredentials(request); ValidateParameters(credentials[0], param.Email); UserParam userParam = new UserParam() { UserName = credentials[0], Password = credentials[1], StatusId = 1 }; UserResult user = UserProcessor.Create(userParam); param.UserId = user.Id; param.StatusId = 1; _accountProcessor.Create(param); }
private UserResult GetUserByUniqueIdentifier(string nameIdentifier) { var result = new UserResult(); // TODO: Try/Catch using (var proxy = new DynamicWebServiceProxy <IMembershipService> (_membershipServiceEndpointAddress)) { // TODO: Implement a GetByNameIdentifier var users = proxy.Client.GetAllUsers(0, 100); var user = users.Users.ToList().Where(u => u.NameIdentifier == nameIdentifier).SingleOrDefault(); result.Ok = users.Ok; result.User = user; return(result); } }
public override async Task <UserResult> AuthenticateAsync(HttpRequest request) { UserResult result = null; if (request.Headers.ContainsKey("Authorization")) { var authHeader = AuthenticationHeaderValue.Parse(request.Headers["Authorization"]); var credentialBytes = System.Convert.FromBase64String(authHeader.Parameter); var credentials = System.Text.Encoding.UTF8.GetString(credentialBytes).Split(new[] { ':' }, 2); var username = credentials[0]; var password = credentials[1]; result = await UserProcessor.GetByUsernameAndPasswordAsync(username, password); } return(result); }
/// <summary> /// 存储登录用户信息 /// </summary> private void SaveLoginUserInfo(UserResult userResult) { AppConfigInfos.CurrentUserInfos = userResult.UserInfos; if (IsLimitsInfo == "1") { AppConfigInfos.LimitsUserInfos = userResult.UserInfos; AppConfigInfos.LimitsUserInfos.OrgIDCodeStr = userResult.UserInfos.OrgID + ","; if (AppConfigInfos.LimitsUserInfos.OrgList != null && AppConfigInfos.LimitsUserInfos.OrgList.orgList != null) { foreach (OrgInfos oi in AppConfigInfos.LimitsUserInfos.OrgList.orgList) { AppConfigInfos.LimitsUserInfos.OrgIDCodeStr += oi.OrgID + ","; } AppConfigInfos.LimitsUserInfos.OrgIDCodeStr = AppConfigInfos.LimitsUserInfos.OrgIDCodeStr.Substring(0, AppConfigInfos.LimitsUserInfos.OrgIDCodeStr.Length - 1); } } }
/// <summary> /// Internal signin method that generates the cookie authentication for an UserResult in the NudesIdentity schema /// </summary> internal static Task SignInAsync(this HttpContext context, UserResult user, AuthenticationProperties properties) { var clock = context.RequestServices.GetRequiredService <ISystemClock>(); var identityUser = new IdentityServerUser(user.SubjectId) { DisplayName = user.Username, AuthenticationTime = clock.UtcNow.UtcDateTime, }; if (user.Claims != null) { identityUser.AdditionalClaims = user.Claims; } return(context.SignInAsync(IdentityServerConstants.DefaultCookieAuthenticationScheme, identityUser.CreatePrincipal(), properties)); }
internal void SetResults(UserResult mvp, BattleResultForClient battleResultForClient, bool mvpIsPlayer) { if (ShowCounter > 0) { this.continueTimer.gameObject.SetActive(false); } else { this.continueTimer.gameObject.SetActive(true); this.continueTimer.CurrentTime = !mvpIsPlayer ? this.timeIfMvpIsNotPlayer : this.timeIfMvpIsPlayer; } this.userInfo.Set(mvp); this.mainStat.Set(mvp, battleResultForClient); this.otherStat.Set(mvp, battleResultForClient); this.tankInfo.Set(mvp); this.modulesInfo.Set(mvp.Modules); }
private void PrintNextQuestion() { if (game.IsEnd()) { game.CalculateDiagnose(numberOfQuestions); var newUserResult = new UserResult(user.Name, user.Surname, user.CountRightAnswers, user.Diagnose); game.AddNewUserResult(newUserResult); MessageBox.Show(user.Diagnose); } else { userAnswerTextBox.Focus(); questionTextLabel.Text = game.PopRandomeQuestion().Text; questionNumberLabel.Text = game.GetCurrentQuestionNumberInfo(); userAnswerTextBox.Clear(); } }
public string GetAuthToken(HttpContext httpContext) { var userId = httpContext.User.FindFirst (claim => claim.Type == ClaimTypes.NameIdentifier) .Value; byte[] salt = Salt.GenerateSalt(); string authToken = System.Guid.NewGuid().ToString("N"); string hashedAuthToken = Hash.Compute(authToken, salt); hashedAuthToken = TrimToken(hashedAuthToken); UserResult userResult = UserProcessor.FindByField("id", userId).SingleOrDefault(); ApiSessionResult sessionResult = CreateApiSession(userResult, hashedAuthToken); return(sessionResult.AuthToken); }
public Result DeleteUser(string userId) { try { InitCusRelContext(); var user = cusRelContext.AuthorizedUsers.FirstOrDefault(u => u.UserId.Trim() == userId) ?? cusRelContext.AuthorizedUsers.FirstOrDefault(u => u.UserName.Trim() == userId); var result = Delete(user); return(result); } catch (Exception e) { var result = new UserResult(); result.SetFail(e); return(result); } }
public async Task <IActionResult> getRecommendedUsers() { //FUNC_RECOMMEND_USER(search_result out sys_refcursor) //return INTEGER return(await Wrapper.wrap(async (OracleConnection conn) => { string procudureName = "FUNC_RECOMMEND_USER"; OracleCommand cmd = new OracleCommand(procudureName, conn); cmd.CommandType = CommandType.StoredProcedure; //Add return value OracleParameter p1 = new OracleParameter(); p1 = cmd.Parameters.Add("state", OracleDbType.Int32); p1.Direction = ParameterDirection.ReturnValue; //Add input parameter search_result OracleParameter p5 = new OracleParameter(); p5 = cmd.Parameters.Add("search_result", OracleDbType.RefCursor); p5.Direction = ParameterDirection.Output; OracleDataAdapter DataAdapter = new OracleDataAdapter(cmd); DataTable dt = new DataTable(); await Task.FromResult(DataAdapter.Fill(dt)); if (int.Parse(p1.Value.ToString()) == 0) { throw new Exception("failed"); } //dt: user\_id,user\_nickname,user\_avatar\_image\_id UserResult[] receivedUsers = new UserResult[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; ++i) { receivedUsers[i] = new UserResult(); receivedUsers[i].user_id = int.Parse(dt.Rows[i][0].ToString()); receivedUsers[i].user_nickname = dt.Rows[i][1].ToString(); receivedUsers[i].followers_num = int.Parse(dt.Rows[i][2].ToString()); string avatarUrl = await UserController.getAvatarUrl(receivedUsers[i].user_id); receivedUsers[i].avatar_url = avatarUrl; } RestfulResult.RestfulArray <UserResult> rr = new RestfulResult.RestfulArray <UserResult>(); rr.Code = 200; rr.Data = receivedUsers; rr.Message = "success"; return new JsonResult(rr); })); }
public UserResult Register(string username, string password, string title, string name, string surname, string rolename = "", bool isAvtive = false) { UserResult result = null; try { var checkUser = Context.Users.SingleOrDefault(x => x.Username == username); if (checkUser != null) { result = new UserResult(UserResultType.NotConfirmed, null, "Böyle bir kullanıcı mevcut.", BusinessResultType.Warning); return(result); } ApplicationUser user = new ApplicationUser { Username = username, Password = password.GetMD5Hash(), Title = title, Name = name, Surname = surname, IsActive = isAvtive }; this.Insert(user); using (IRoleRepository roleRepo = new RoleRepository(new BeamDeflectionDbContext())) { Role role = null; if (rolename == "") { role = roleRepo.Get(x => x.Name == "guest").Result; } else { role = roleRepo.Get(x => x.Name == rolename).Result; } this.InsertUserRoles(user, role); } result = new UserResult(UserResultType.Authenticated, user, "Kayıt başarılı.", BusinessResultType.Success); } catch (Exception ex) { result = new UserResult(UserResultType.NotConfirmed, null, "Hata:" + ex.GetOriginalException().Message, BusinessResultType.Error); } return(result); }
public async Task <IActionResult> AlterarSenha(UserUpdatePassword user) { if (!ModelState.IsValid) { return(View(user)); } UserResult result = await _service.UpdatePassword(user); if (result.Success == false) { var notifications = Agrupar.GroupNotifications(result); ModelState.AddModelError(string.Empty, notifications); return(View(user)); } return(View("Mensagem")); }
public TopicResult(Entity.Topic topic) { Id = topic.Id; Title = topic.Title; Status = topic.Status; Deadline = topic.Deadline; Description = topic.Description; Requirements = topic.Requirements; CreatedAt = topic.CreatedAt; UpdatedAt = topic.UpdatedAt; if (topic.CreatedBy != null) { CreatedBy = new UserResult(topic.CreatedBy); } // TODO this.CreatedBy = topic.UpdatedBy; }
public ActionResult Index(User user) { try { UserResult result = user.Login(); if (result.Status == UserResult.Statuses.Success) { return(RedirectToAction("Index", "Home")); } ViewBag.ErrorMsg = result.Message; return(View()); } catch (Exception exception) { Logger.WriteToLog(exception); throw; } }
public override decimal Calculate(UserResultVM user, UserResult initialUserResult, DateTime startDate, DateTime endDate) { var baseRate = 0M; var userRuleIds = initialUserResult.UserRules.Where(ur => ur.UserId == user.Id).Select(ur => ur.RuleId); var rules = initialUserResult.Rules.Where(r => userRuleIds.Contains(r.Id)); foreach (var rule in rules) { var dateFrom = rule.StartDate > startDate ? rule.StartDate : startDate; var dateTo = rule.EndDate.HasValue && rule.EndDate < endDate ? rule.EndDate.Value : endDate; var calculator = CalculatorFactory.GetRuleCalculator(user, initialUserResult, rule.RuleTypeId); baseRate += calculator.Calculate(rule.Bonus, dateFrom, dateTo); } return(baseRate + Proceed(user, initialUserResult, startDate, endDate)); }
public UserResult UserDTO(int ID) { using (MyDbContext db = new MyDbContext()) { UserResult User = new UserResult(); UserEntity U = new UserEntity(); //U = db.User.Where(p => p.ID == ID).Select(p=> new UserEntity {ID=p.ID }).SingleOrDefault(); var a = db.User.Where(p => p.ID == ID).ToArray().AsQueryable(); var s = a.ToList().ToArray(); var b = db.User.Where(p => p.ID == ID).OrderByDescending(p => p.ID == ID); User.UserListDTO = db.User.Where(p => p.ID == ID).ToList().Select(p => ToDTO(p)); return(User); } }
public static InitUserViewModel ToDataViewModel(this UserResult entity) { return(new InitUserViewModel { Id = entity.Id, UserName = entity.UserName, ChucVuId = entity.ChucVuId, ChucVuInfo = entity.ChucVuInfo, FullName = entity.HoVaTen, Password = entity.Password, IsLocked = entity.IsLocked, CreateDate = entity.CreateDate, CreatedBy = entity.CreatedBy, IsDeleted = entity.IsDeleted, LastUpdated = entity.LastUpdated, LastUpdatedBy = entity.LastUpdatedBy }); }
public async Task <IActionResult> AdicionarUsuario(UserRegister model) { if (!ModelState.IsValid) { return(View(model)); } UserResult result = await _service.RegisterAdmin(model); if (result.Success == false) { ModelState.AddModelError(string.Empty, result.Message); return(View(model)); } TempDataUtil.Put(TempData, "mensagem", result.Message); return(RedirectToAction("ListaUsuarios")); }
public async Task <IActionResult> AlterarSenha(UserUpdatePassword user) { if (!ModelState.IsValid) { return(View(user)); } UserResult result = await _service.UpdatePassword(user); if (result.Success == false) { ModelState.AddModelError(string.Empty, result.Message); return(View(user)); } TempDataUtil.Put(TempData, "mensagem", result.Message); return(RedirectToAction("Index", "HomeInternal")); }
public string Post([FromBody] UserResult ur) { string query = $"insert into Result (QuestionId, Answer, UserId) values ({ur.QuestionId}, \'{ur.Answer}\', {ur.UserId})"; string query1 = $"select top(1) Id from Question where Id > {ur.QuestionId} " + $"and ServeyId = (select ServeyId from Question where Id = {ur.QuestionId})"; string postResult = ""; using (SqlConnection con = new SqlConnection(sql)) { con.Open(); string commandResult = DoCommand(query, con); postResult = DoCommand(query1, con); } return(postResult); }
internal static async Task <UserResult> CreateConfirmationDialog( string primaryText, string secondaryText, string acceptButtonText, string cancelButtonText, string title, UserResult primaryButtonResult = UserResult.Yes) { return(await ShowContentDialog( string.IsNullOrWhiteSpace(title)?LocaleManager.Instance["DialogConfirmationTitle"] : title, primaryText, secondaryText, acceptButtonText, "", cancelButtonText, (int)Symbol.Help, primaryButtonResult)); }
public UserResult checkSession() { string userName = HttpContext.Session.GetString(UsersController.SessionName); UserResult res = new UserResult(); if (userName != null) { res.isLogin = true; res.userName = userName; } else { res.isLogin = false; } return(res); }
public UserResult UserLogin(User user) { var userResult = new UserResult(); userResult.Message = ""; userResult.Result = true; var ruser = dal.CheckUser(user.UserName, user.Company, user.SiteName); if (ruser != null) { userResult.Result = false; userResult.Message = "非常抱歉,贵公司已有用户使用该软件,暂时无法登陆。详询QQ:278815541。"; } else { userResult.Data = dal.GetUser(user.UserName, user.Company, user.SiteName); if (userResult.Data == null) { user.UserType = 0; //var duetime = dal.GetDic("体验时间"); //user.DueTime = DateTime.Now.AddHours(Convert.ToDouble(duetime.Value)); dal.AddUser(user); userResult.Data = dal.GetUser(user.UserName, user.Company, user.SiteName); } userResult.Data.DueTime = dal.UpdateLoginLogByLogin(userResult.Data.Id); var num = dal.GetQueryAndNewsNum(userResult.Data.Id); userResult.Data.QueryNum = num[0]; userResult.Data.NewsNum = num[1]; if (userResult.Data.UserType != 0) { if (!dal.CheckDueTime(user.UserName, user.Company, user.SiteName)) { userResult.Result = false; userResult.Message = "非常抱歉,该用户使用时间已到,暂时无法登陆。详询QQ:278815541。"; } } } return(userResult); }
public IEnumerable <UserResult> GetUsers() { Database db = new DatabaseProviderFactory().Create("JIRA"); List <UserResult> result = new List <UserResult>(); using (DbCommand cmd = db.GetStoredProcCommand("[dbo].[GetUsers]")) { cmd.CommandTimeout = dbTimeout; DataSet ds = db.ExecuteDataSet(cmd); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { UserResult user = new UserResult(); user.Id = (int)ds.Tables[0].Rows[i]["UserId"]; user.Name = (string)ds.Tables[0].Rows[i]["Name"]; result.Add(user); } } return(result); }
private void namegrid_CellClick(object sender, DataGridViewCellEventArgs e) { int index = e.RowIndex; string selectName = this.namegrid.Rows[index].Cells[0].Value.ToString(); string firstName = this.firstNameInput.Text; string suffixName = selectName.Replace(firstName, ""); string year = this.birthDayInput.Value.Year.ToString(); string month = this.birthDayInput.Value.Month.ToString(); string day = this.birthDayInput.Value.Day.ToString(); string genderCode = "1";//默认为男 if (this.girl.Checked) { genderCode = "2"; } //TODO 调用接口 string jsonData = user2str(firstName, suffixName, genderCode, year, month, day); string result = postApi("http://27953499sv.zicp.vip:28177/api/name/parse", jsonData); if (result == "") { MessageBox.Show("请求超时..."); return; } if (!this.center_panel.Visible) { this.center_panel.Visible = true; } UserResult userResult = str2userResult(result); if (userResult.resultstatus != "1") { MessageBox.Show(userResult.errorinfo); } score_insert(userResult.numbers); sici_insert(userResult.verseArr); bttom_panel_insert(userResult.detailArr); }
public void GetPointStyleDictTest_1() { List<UserResult> userList = new List<UserResult>(); UserResult ur = new UserResult(); ur.BcchCir = 12f; ur.BcchRxPower = 33f; ur.BestServerName = "Trx1"; ur.DlGeometry = -15f; ur.DlTchRxPower = 33f; ur.UserX = 115f; ur.UserY = 120f; ur.UserState = UserStateType.DLSatisfied; userList.Add(ur); StyleStruct ss = new StyleStruct(); GeoPointStyle style1 = new GeoPointStyle(); style1.Name = "DLSatisfied"; ss.Styles.Add(style1); GSMSimulationVectorData gvd = new GSMSimulationVectorData(ss); gvd.UserResult = userList; List<GeoXYPoint> pointList = new List<GeoXYPoint>(); List<GeoPointStyle> styleList = new List<GeoPointStyle>(); gvd.UpadateStyles(ss); gvd.GetPointStyleDict(pointList, styleList); string output; Assert.IsTrue(gvd.TryGetPointInfo(pointList[0], out output)); Assert.AreEqual(115, pointList[0].X); Assert.AreEqual(style1.Name, styleList[0].Name); Assert.IsFalse(gvd.TryGetPointInfo(new GeoXYPoint(112, 115), out output)); //Assert.IsNull(gvd.GetAllStyles()); Assert.AreEqual(style1.Name, gvd.GetAllStyles()[0].Name); }
/// <summary> /// Update the user's password in the DB /// </summary> /// <returns>true/false</returns> public bool ChangePassword() { bool loginResult = false; UserResult result = new UserResult(); MsgLabel = "Password not changed!"; IsError = true; SessionDetails sd = SDKHelper.GetSessionDetails<AquariumUserManagement.SessionDetails>("User"); int UserID = SDKHelper.GetUserSession<AquariumUserManagement.LoggedOnUserResult>("User").User.ClientPersonnelID; result = sdk.SetNewUserPasswordCheckOriginal(sd, UserID, this.Password, this.OldPassword); if (result.ResultInfo.ReturnCode == AquariumUserManagement.BasicCode.OK) { loginResult = true; MsgLabel = "Password changed Successfully!"; IsError = false; } else if (result.ResultInfo.ReturnCode == AquariumUserManagement.BasicCode.Failed) { MsgLabel = "Error ID:" + result.ResultInfo.Errors[0].ResultCodeID + ", Description:" + result.ResultInfo.Errors[0].Description; IsError = true; } return loginResult; }
/// <summary> /// Sets the user info to the DB from the UI /// </summary> /// <returns>true/false</returns> public bool UpdateUser() { bool loginResult = false; UserResult result = new UserResult(); MsgLabel = "Account not Updated!"; IsError = true; SessionDetails sd = SDKHelper.GetSessionDetails<AquariumUserManagement.SessionDetails>("User"); result = sdk.UpdateUsersInformation(sd, this.LoginResultDetails.User); if (result.ResultInfo.ReturnCode == AquariumUserManagement.BasicCode.OK) { loginResult = true; MsgLabel = "Account Updated Successfully!"; IsError = false; } else if (result.ResultInfo.ReturnCode == AquariumUserManagement.BasicCode.Failed) { MsgLabel = "Error ID:" + result.ResultInfo.Errors[0].ResultCodeID + ", Description:" + result.ResultInfo.Errors[0].Description; IsError = true; } return loginResult; }
/// <summary> /// Adds the User to the DB using SDK /// </summary> /// <returns>true/false</returns> public bool Register() { bool loginResult = false; UserResult result = new UserResult(); MsgLabel = "Account not Added!"; IsError = true; this.LoginResultDetails.User.AccountDisabled = false; this.LoginResultDetails.User.IsAquarium = false; this.LoginResultDetails.User.AttemptedLogins = 0; this.LoginResultDetails.User.UserName = this.LoginResultDetails.User.FirstName + " " + this.LoginResultDetails.User.LastName; this.LoginResultDetails.ClientID = 74; this.LoginResultDetails.User.ClientPersonnelID = new ClientPersonnel().ClientPersonnelID; SessionDetails sd = SDKHelper.GetSessionDetails<AquariumUserManagement.SessionDetails>("User"); result = sdk.CreateUser(sd, this.LoginResultDetails.User, this.Password); if (result.ResultInfo.ReturnCode == AquariumUserManagement.BasicCode.OK) { loginResult = true; MsgLabel = "Account added Successfully!"; IsError = false; } else if (result.ResultInfo.ReturnCode == AquariumUserManagement.BasicCode.Failed) { MsgLabel = "Error ID:" + result.ResultInfo.Errors[0].ResultCodeID + ", Description:" + result.ResultInfo.Errors[0].Description; IsError = true; } return loginResult; }
/// <summary> /// Get list of all Users in the DB /// </summary> public void GetAllUsers() { UserResult result = new UserResult(); SessionDetails sd = SDKHelper.GetSessionDetails<AquariumUserManagement.SessionDetails>("User"); int UserID = SDKHelper.GetUserSession<AquariumUserManagement.LoggedOnUserResult>("User").User.ClientPersonnelID; result = sdk.GetUsers(sd, false); if (result.ResultInfo.ReturnCode == AquariumUserManagement.BasicCode.OK) { AllUsers = result.Users.ToList(); } else if (result.ResultInfo.ReturnCode == AquariumUserManagement.BasicCode.Failed) { throw new System.ApplicationException("Error ID:" + result.ResultInfo.Errors[0].ResultCodeID + ", Description:" + result.ResultInfo.Errors[0].Description); } }
private void GetUserResult() { foreach (GSMSimUser user in m_AllUsers) { UserResult result = new UserResult(); result.BcchCir = user.BcchCir; result.BcchRxPower = user.Bcch; result.DlGeometry = user.ResultStatistic.DLGeometry; result.DlTchRxPower = user.ResultStatistic.DLTCHRxPower; result.UserID = user.TrafficUser.Id; result.LinkType = user.TrafficUser.LinkType; if (user.BestServer != null) { result.BestServerName = user.BestServer.Cell.Name; } else { result.BestServerName = ""; } if (user.IsCs) { result.CodingScheme = user.CsCodeScheme; } else { result.CodingScheme = user.PsCodeScheme.ToString(); } //if (user.ResultStatistic.DlThorughput.Count != 0)应该是用户被服务才有吞吐率 if (user.DlTs.Count != 0) { result.LastDLThroughput = user.ResultStatistic.DlThorughput.Last(); result.LastDLTDInterf = user.ResultStatistic.DLTDInterf.Last(); result.LastDLUMTSInterf = user.ResultStatistic.DLUMTSInterf.Last(); result.UserDLCir = user.ResultStatistic.DLCir; result.UserDLInterf = user.ResultStatistic.UserDLInterf; } else { result.LastDLThroughput = float.NegativeInfinity; result.LastDLTDInterf = float.NegativeInfinity; result.LastDLUMTSInterf = float.NegativeInfinity; result.UserDLCir = float.NegativeInfinity; result.UserDLInterf = float.NegativeInfinity; } if (user.UlTs.Count != 0) { result.LastULThroughput = user.ResultStatistic.UlThorughput.Last(); result.LastTDInterf = user.ResultStatistic.ULTDInterf.Last(); result.LastUMTSInterf = user.ResultStatistic.ULUMTSInterf.Last(); result.UserULCir = user.ResultStatistic.ULCir; result.UserULInterf = user.ResultStatistic.UserULInterf; } else { result.LastULThroughput = float.NegativeInfinity; result.LastTDInterf = float.NegativeInfinity; result.LastUMTSInterf = float.NegativeInfinity; result.UserULCir = float.NegativeInfinity; result.UserULInterf = float.NegativeInfinity; } //result.UlThroughput = user.ResultStatistic.UlThorughput; //result.DlThroughput = user.ResultStatistic.DlThorughput; result.UserState = user.ResultStatistic.UserState; result.ServiceName = user.TrafficUser.Service.Name; result.IsIndoor = user.TrafficUser.IsIndoor; //result.ULTxPowerList = user.ResultStatistic.ULPowerList; result.AccessFailType = user.ResultStatistic.FailType; //result.ULTDInterf = user.ResultStatistic.ULTDInterf; //result.ULUMTSInterf = user.ResultStatistic.ULUMTSInterf; //result.DLTDInterf = user.ResultStatistic.DLTDInterf; //result.DLUMTSInterf = user.ResultStatistic.DLUMTSInterf; //result.DLTxPowerList = user.ResultStatistic.DLPowerList; result.UserX = user.X; result.UserY = user.Y; result.UserLatitude = user.Latitude; result.UserLongitude = user.Longitude; result.FinalTxPower = user.ResultStatistic.TxPower; result.UlBsPower = user.ResultStatistic.ULBsPower; m_GSMResult.m_UserResult.Add(result); } }
public ActionResult NotPaid(int? id, int userId, int matchId) { int idInt = 0; if (id.HasValue) { idInt = id.Value; var hasResult = _bookieContext.UserResults.FirstOrDefault(ur => ur.Id == idInt); hasResult.GivenMoney = false; hasResult.GivenMoneyByBookie = false; } else { var result = new UserResult(); result.Home = null; result.Away = null; result.GivenMoney = false; result.GivenMoneyByBookie = false; _bookieContext.UserResults.Add(result); } _bookieContext.SaveChanges(); return RedirectToAction("ActiveMatches", "home"); }
public ActionResult Vote(int id) { var match = _bookieContext.Matches.FirstOrDefault(x => x.Id == id); var user = _bookieContext.Users.FirstOrDefault(x=>x.Username == User.Identity.Name); ViewBag.match = match; BookieDatabase.UserResult result = _bookieContext.UserResults.FirstOrDefault(x => x.MatchId == id && x.UserId == user.Id); if (result == null) { result = new UserResult(); result.MatchId = match.Id; result.Match = match; } return View(result); }