protected void Application_AcquireRequestState(Object sender, EventArgs e) { if (!(Context.Handler is IRequiresSessionState)) return; if (Context.User == null || !Context.User.Identity.IsAuthenticated || Context.Session == null) return; try { User user = null; if (Context.Session["User"] != null) { user = Context.Session["User"] as User; } else { UserService userService = new UserService(); user = userService.GetByUsername(Context.User.Identity.Name); if (user == null) { FormsAuthentication.SignOut(); return; } Context.Session.Add("User", user); } Thread.CurrentPrincipal = Context.User = user; } catch { } }
public ActionResult GetUsersToBeVerified(int numOnePage, int pageIndex) { EnumUserApproveStatus approveStatus = EnumUserApproveStatus.UnApproved; UserService userService = new UserService(); List<User> list = new List<User>(); list = userService.FindUsersByApproveStatus(approveStatus, numOnePage, pageIndex); UserViewModel uvm; List<UserViewModel> uvmlist = new List<UserViewModel>(); for (int i = 0; i < list.Count; i++ ) { uvm = new UserViewModel(); uvm.Id = list[i].Id; uvm.NickName = list[i].NickName; uvm.PersonalDescription = list[i].PersonalDescription; uvm.RegisterName = list[i].RegisterName; uvm.RealName = list[i].RealName; uvm.Gender = list[i].Gender; uvmlist.Add(uvm); } string result = JsonConvert.SerializeObject(uvmlist);//到这里获取当前所有待审核的用户并序列化 //以下获取所有待审核用户的总数 UserService userService2 = new UserService(); int n = userService2.GetUserCount(EnumUserApproveStatus.UnApproved); string numberS = n.ToString(); result = result + "ContentAndCount" + numberS; return Content(result); }
public JsonResult AddUser([DataSourceRequest] DataSourceRequest request, UserModel userModel) { try { if (userModel != null) { this.userService = new UserService(); var user = DataTransfer.Transfer<User>(userModel, typeof(UserModel)); userModel.ID = this.userService.AddUser(user); if (userModel.ID <= 0) { return this.Json(string.Empty); } userModel.UserLevelName = "普通会员"; userModel.StateName = "锁定会员"; LogUtils.Log("用户" + this.SystemUserSession.LoginName + "成功添加会员" + userModel.Email, "AddUser", Category.Info, Session.SessionID); return this.Json(new[] { userModel }.ToDataSourceResult(request, this.ModelState)); } return this.Json(string.Empty); } catch (Exception exception) { throw new Exception(exception.Message, exception); } }
/// <summary> /// 传入项目ID 分组ID 得到此条件下的全部任务 列表 /// </summary> /// <param name="projId"></param> /// <param name="groupId"></param> /// <returns></returns> public ActionResult GetTaskByProjIdAndGroupId(int projId, int groupId) { RRWMEntities er = new RRWMEntities(); //获取这个groupID下的全部的用户ID List<string> idString = new List<string>(); UserService us = new UserService(); List<User> userList = us.FindUsersByGroupId(groupId); foreach (var u in userList) { idString.Add(u.Id); } //过滤结果 TaskService ts = new TaskService(er); List<Task> list = ts.FindByProjectID(projId).ToList(); List<Task> resultList = new List<Task>(); foreach (var l in list) { if (idString.Contains(l.TaskerID) && l.TaskProcessStatus == EnumTaskProcessStatus.None) { resultList.Add(l); } } List<ComplexTask> comList = ConvertToComplexTaskList(resultList); return Json(comList); }
//public string getMemberById(string userId) { // UserService userservice = new UserService(); // User user = userservice.FindById(userId); // MemberViewModel mvm = new MemberViewModel(user); // UserGroupService ugs = new UserGroupService(); // List<UserGroup> list = ugs.FindAll(); // string memberResult = JsonConvert.SerializeObject(mvm); // List<UserGroupViewModel> ugvlist = new List<UserGroupViewModel>(); // UserGroupViewModel ugv; // for (int i = 0; i < list.Count; i++) // { // ugv = new UserGroupViewModel(list[i]); // ugvlist.Add(ugv); // } // string result = JsonConvert.SerializeObject(ugvlist); // return memberResult+"MemberAndGroupList"+result; //} public string getMemberById(string userId) { using (RRDLEntities db = new RRDLEntities()) { UserService userservice = new UserService(); User user = userservice.FindById(userId); MemberViewModel mvm = new MemberViewModel(user); int approvedcount = 0; int allcount = 0; AriticleService ariticleService = new AriticleService(); Expression<Func<Ariticle, bool>> condition = a => a.Approve.ApproveStatus == EnumAriticleApproveStatus.Approved && a.UserId == user.Id; approvedcount = ariticleService.GetAriticleCount(condition); condition = a => a.UserId == user.Id; allcount = ariticleService.GetAriticleCount(condition); mvm.approvedArticleCount = approvedcount; mvm.allArticleCount = allcount; UserGroupService ugs = new UserGroupService(); List<UserGroup> list = ugs.FindAll(); string memberResult = JsonConvert.SerializeObject(mvm); List<UserGroupViewModel> ugvlist = new List<UserGroupViewModel>(); UserGroupViewModel ugv; for (int i = 0; i < list.Count; i++) { ugv = new UserGroupViewModel(list[i]); ugvlist.Add(ugv); } string result = JsonConvert.SerializeObject(ugvlist); return memberResult + "MemberAndGroupList" + result; } }
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { try { UserDetails userDetails = new UserDetails(); userDetails.userID = GridView1.Rows[e.RowIndex].Cells[0].Text; userDetails.firstName = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[1].Controls[0])).Text; userDetails.lastName = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[2].Controls[0])).Text; userDetails.phone = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[5].Controls[0])).Text; userDetails.cityID = int.Parse(((DropDownList)(GridView1.Rows[e.RowIndex].Cells[3].FindControl("DropDownList1"))).SelectedValue); userDetails.address = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[6].FindControl("TextBox1"))).Text; userDetails.state = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[6].FindControl("TextBox3"))).Text; userDetails.zipCode = ((TextBox)(GridView1.Rows[e.RowIndex].Cells[6].FindControl("TextBox2"))).Text; UserService userService = new UserService(); userService.UpdateUserDetails(userDetails); GridView1.EditIndex = -1; populateGrid(); } catch (Exception ex) { Label1.Text = ex.Message; } }
public ActionResult ToggleFavorite(int id) { var userService = new UserService(); var snippet = _snippetService.GetById(id); var user = userService.GetByUsername(User.Identity.Name); var favorite = user.Favorites.SingleOrDefault(s => s.Snippet.SnippetId == snippet.SnippetId); if (favorite != null) { snippet.Favorited--; user.Favorites.Remove(favorite); } else { snippet.Favorited++; user.Favorites.Add(new Favorite { DateCreated = DateTime.Now, Snippet = snippet, User = user }); } userService.Save(); if (Request.IsAjaxRequest()) return Json(new {success = true }); return Redirect(snippet.Link); }
//无参数传入,返回当前所有会员的序列化字符串和当前会员总数 public ActionResult GetMembers(int numOnePage, int pageIndex) { UserService userservice = new UserService(); List<User> list = new List<User>(); list = userservice.FindUsersByApproveStatus(EnumUserApproveStatus.Approved, numOnePage, pageIndex); //因为需要返回的用户属性信息只是一部分,所以要新建一个类型来保存User的部分属性即可 List<MemberViewModel> memberList = new List<MemberViewModel>(); for (int i = 0; i < list.Count; i++) { if ((list[i].AuthorityCategory == EnumUserCategory.Superman && list[i].RealName != "雷磊") || (list[i].AuthorityCategory != EnumUserCategory.Superman) ) { MemberViewModel member = new MemberViewModel(list[i]); member.RealName = list[i].RealName; member.AuthorityCategory = list[i].AuthorityCategory; //member.ContentGroup = list[i].ContentGroup; member.Id = list[i].Id; memberList.Add(member); } } string result = JsonConvert.SerializeObject(memberList); //以下获取所有会员的总个数 UserService userservice1 = new UserService(); int number = userservice1.GetUserCount(EnumUserApproveStatus.Approved); result = result + "ContentAndCount" + number; return Content(result); }
// Use this for initialization void Start() { //nao executa o resto da função caso haja um estado salvo // if (LevelSerializer.IsDeserializing) return; _UserService = WebService.GetComponent<UserService>(); }
/// <summary> /// 保存用户评论数据 /// </summary> /// <param name="context"></param> public void SaveUserPosts(HttpContext context) { ZwJson zwJson = new ZwJson(); UserPostsService userPostsService = new UserPostsService(_session); UserService userService = new UserService(_session); var postid = context.Request.Params["postid"]; var khtml = context.Request.Params["khtml"]; var name = context.Session["UserName"]; if (name != null) { var data = userService.FindByName(name.ToString()); Posts posts = new Posts() { Id = postid }; UserPosts userPosts = new UserPosts() { Id = Guid.NewGuid().ToString(), Contents = khtml, CreateDt = DateTime.Now, Posts = posts, User = data[0] }; userPostsService.Save(userPosts); zwJson.IsSuccess = true; zwJson.JsExecuteMethod = "ajax_SaveUserPosts"; } else { zwJson.IsSuccess = false; zwJson.Msg = "请先登录!"; } context.Response.Write(_jss.Serialize(zwJson)); }
public void Configure(IApplicationBuilder app, IApplicationEnvironment env) { var certFile = env.ApplicationBasePath + "\\idsrv3test.pfx"; app.Map("/core", core => { var factory = InMemoryFactory.Create( clients: Clients.Get(), scopes: Scopes.Get()); var userService = new UserService(); factory.UserService = new Registration<IUserService>(resolver => userService); // factory.ViewService = new Registration<IViewService>(typeof(CustomViewService)); var idsrvOptions = new IdentityServerOptions { IssuerUri = "", Factory = factory, RequireSsl = false, LoggingOptions = // SigningCertificate = new X509Certificate2(certFile, "idsrv3test") }; core.UseIdentityServer(idsrvOptions); });
public string DetelteTheUser(string userId) { //用户Id已经拿到,删除暂不处理 ZHAOs 2013年10月30日16:58:12 UserService userService = new UserService(); userService.Drop(userId); return "success"; }
public void GetByIdTest() { var modelContainer = new TimeTrackerContext(); var service = new UserService(modelContainer); var user = service.GetById(2); Assert.IsNotNull(user); }
void Awake() { menus = GetComponentInParent<MenusController>(); userService = FindObjectOfType<UserService>(); signupButton.onClick.AddListener(Signup); backButton.onClick.AddListener(Back); }
private void Load_Friends_And_Contacts() { UserService userService = new UserService(); DataSet dataSet = new DataSet(); dataSet = userService.GetFriendsAndContacts(user); Session["DataSet"] = dataSet; }
public void GetByEnabled() { // disabled UserService target = new UserService(); for (int i = 0; i < 5; i++) { User user = (User) CreateRecord(); user.Enabled = false; Insert(user); } // enabled for (int i = 0; i < 4; i++) { User user = (User) CreateRecord(); user.Enabled = true; Insert(user); } Collection<User> disabled = target.GetByEnabled(false); Assert.IsTrue(disabled.Count >= 5); foreach (User user in disabled) { Assert.AreEqual(false, user.Enabled); } Collection<User> enabled = target.GetByEnabled(true); Assert.IsTrue(enabled.Count >= 4); foreach (User user in enabled) { Assert.AreEqual(true, user.Enabled); } }
public UserApiController(UserQueries queries, UserService service, IUserPermissionContext permissionContext, IEntryThumbPersister thumbPersister) { this.queries = queries; this.service = service; this.permissionContext = permissionContext; this.thumbPersister = thumbPersister; }
public void Init() { TestUtils utils = new TestUtils(); userService = (UserService) user.GetService(DfpService.v201511.UserService); salespersonId = utils.GetSalesperson(user).id; traffickerId = utils.GetTrafficker(user).id; }
protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (_db == null) _db = new EpiloggerDB(); if (_es == null) _es = new EventService(); if (_us == null) _us = new UserService(); base.Initialize(requestContext); }
public ActivityService(RallyNowDbContext dbContext) { _dbContext = dbContext; _moxtraService = new MoxtraService(dbContext); _userService = new UserService(dbContext); _mapper = new MoxtraConversationsDtoToActivityModelsMapper(); }
TestResult DeleteUser() { using (var unitOfWork = new UnitOfWork(new AuthorizationModuleFactory(false))) { var UserService = new UserService(unitOfWork); var testUser = UserService.Get(user => user.Login == "ivan_test++").FirstOrDefault(); UserService.Delete(testUser); try { var result = unitOfWork.Commit(); if (result.Count > 0) return new TestResult(TestResultType.Failure, MethodBase.GetCurrentMethod().Name, result.First().ErrorMessage); } catch (Exception ex) { while (ex.InnerException != null) ex = ex.InnerException; return new TestResult(TestResultType.Failure, MethodBase.GetCurrentMethod().Name, ex.Message); } } using (var unitOfWork = new UnitOfWork(new AuthorizationModuleFactory(false))) { var UserService = new UserService(unitOfWork); User testUser = UserService.Get(user => user.Login == "ivan_test++").FirstOrDefault(); if (testUser != null) return new TestResult(TestResultType.Failure, MethodBase.GetCurrentMethod().Name, "Can find deleted user."); else return new TestResult(TestResultType.Success, MethodBase.GetCurrentMethod().Name, "User deleted successfully."); } }
// // GET: /MemberManageSearch/ //会员的NickName、RealName、用户组名 public ActionResult MemberManageSearch(int numOnePage, int pageIndex, string keyword) { keyword = System.Web.HttpUtility.UrlDecode(keyword); UserService userService = new UserService(); List<User> list = new List<User>(); list = userService.FindMembersByKeyword(keyword, numOnePage, pageIndex); int count = userService.FindMembersByKeywordCount(keyword); UserViewModel uvm; List<UserViewModel> uvmlist = new List<UserViewModel>(); for (int i = 0; i < list.Count; i++) { if ((list[i].AuthorityCategory == EnumUserCategory.Superman && list[i].RealName != "雷磊") || (list[i].AuthorityCategory != EnumUserCategory.Superman)) { uvm = new UserViewModel(); uvm.Id = list[i].Id; uvm.AuthorityCategory = list[i].AuthorityCategory; uvm.NickName = list[i].NickName; uvm.PersonalDescription = list[i].PersonalDescription; uvm.RegisterName = list[i].RegisterName; uvm.RealName = list[i].RealName; uvm.Gender = list[i].Gender; uvmlist.Add(uvm); } } string result = JsonConvert.SerializeObject(uvmlist);//到这里获取当前所有待审核的用户并序列化 result = result + "ContentAndCount" + count; return Content(result); }
/// <summary> /// Job that updates the JobPulse setting with the current date/time. /// This will allow us to notify an admin if the jobs stop running. /// /// Called by the <see cref="IScheduler" /> when a /// <see cref="ITrigger" /> fires that is associated with /// the <see cref="IJob" />. /// </summary> public virtual void Execute(IJobExecutionContext context) { // get the job map JobDataMap dataMap = context.JobDetail.JobDataMap; // delete accounts that have not been confirmed in X hours int userExpireHours = Int32.Parse( dataMap.GetString( "HoursKeepUnconfirmedAccounts" ) ); DateTime userAccountExpireDate = DateTime.Now.Add( new TimeSpan( userExpireHours * -1,0,0 ) ); UserService userService = new UserService(); foreach (var user in userService.Queryable().Where(u => u.IsConfirmed == false && u.CreationDate < userAccountExpireDate)) { userService.Delete( user, null ); } userService.Save( null, null ); // purge exception log int exceptionExpireDays = Int32.Parse( dataMap.GetString( "DaysKeepExceptions" ) ); DateTime exceptionExpireDate = DateTime.Now.Add( new TimeSpan( userExpireHours * -1, 0, 0 ) ); ExceptionLogService exceptionLogService = new ExceptionLogService(); foreach ( var exception in exceptionLogService.Queryable().Where( e => e.ExceptionDate < exceptionExpireDate ) ) { exceptionLogService.Delete( exception, null ); } exceptionLogService.Save( null, null ); }
public void HttpErrorThrownWhenCreatingUserAlreadyExists() { // Arrange _userByEmailQuery .Execute(Arg.Any<UserByEmailParameters>()) .Returns(new VouchercloudUser()); var service = new UserService(_userByEmailQuery, _createUserCommand, _deleteUserCommand); var request = new CreateUser { DateOfBirth = new DateTime(1980, 1, 1), Email = "*****@*****.**", FirstName = "James", LastName = "Harper", Password = "******" }; // Act, Assert service .Invoking(s => s.Post(request)) .ShouldThrow<HttpError>().And.Message.Should().Be("User already exists"); _createUserCommand .DidNotReceive() .Execute(Arg.Any<CreateUserParameters>()); }
public static void AddUserService(UserService userService) { using (var hdc = new WebserviceDataContext()) { hdc.UserServices.InsertOnSubmit(new DataModelLib.UserService { ServiceId = userService.ServiceId, UserId = userService.UserId, UpdateUser = userService.UpdateUser, UpdateDateTime = DateTime.Now, Ips = userService.Ips, Status = userService.Status }); try { hdc.SubmitChanges(); } catch (SqlException ex) { if (ex.Number == 2601 || ex.Number == 2627) { throw; } } } }
public static IUserService Factory() { var repo = new DefaultUserAccountRepository(); var userAccountService = new UserAccountService(config, repo); var userSvc = new UserService<UserAccount>(userAccountService, repo); return userSvc; }
public FormAdmin(Form backForm, UserService.UserService service) { this._backForm = backForm; _service = service; InitializeComponent(); cBoxRoles.DataSource = _roles; }
public void CanCreateUserWhenUserNotFound() { // Arrange _userByEmailQuery .Execute(Arg.Any<UserByEmailParameters>()) .Returns((VouchercloudUser)null); _createUserCommand.Execute(Arg.Any<CreateUserParameters>()) .Returns( new VouchercloudUser { UserId = 1 }); var service = new UserService(_userByEmailQuery, _createUserCommand, _deleteUserCommand); var request = new CreateUser { DateOfBirth = new DateTime(1980, 1, 1), Email = "*****@*****.**", FirstName = "James", LastName = "Harper", Password = "******" }; // Act var response = service.Post(request); // Assert _createUserCommand .Received(1) .Execute(Arg.Any<CreateUserParameters>()); response.Should().NotBeNull(); response.UserId.Should().Be(1); }
public string GeTeamRank() { UserGroupService usergSerivice = new UserGroupService(); UserService userService = new UserService(); List<UserGroup> usergList = usergSerivice.FindAll(); List<RankListTeam> rankListTeam = new List<RankListTeam>(); List<User> userList = new List<User>(); for (int i = 2; i < usergList.Count; i++) { userList = userService.FindUsersByGroupId(usergList[i].Id); int count = 0; for (int j = 0; j < userList.Count; j++) { //获取每个用户的发表的知识数量,并求和 AriticleService ariticleService = new AriticleService(); int n = ariticleService.GetAriticleCount(userList[j].Id); count += n; } RankListTeam rlt = new RankListTeam(); rlt.Title = usergList[i].Title; rlt.AriticleCount = count; rankListTeam.Add(rlt); } //对结果排序 var queryResults = from n in rankListTeam orderby n.AriticleCount descending select n; List<RankListTeam> rktList = new List<RankListTeam>(); foreach (var n in queryResults) { rktList.Add(n); } string result = JsonConvert.SerializeObject(rktList); return result; }
public int CheckPasswd(string username, string password) { UserService userService = new UserService(); int type; type = userService.CheckPasswd(username, password); return type; }
public HomeController(PreventiveMaintenanceService pmServices, PreventiveReviewHistoryService prhServices, PreventiveHoldHistoryService phhServices, BreakdownService breakDownService, PlantService plantService, MaintenanceRequestServices mrServices, StatusServices statusService, LineService lineService, UserService userService, FormulationRequestService formulationRequestService) { this._pmServices = pmServices; this._prhServices = prhServices; this._phhServices = phhServices; this._breakDownService = breakDownService; this._plantService = plantService; this._mrServices = mrServices; this._statusService = statusService; this._lineService = lineService; this._userService = userService; this._formulationRequestService = formulationRequestService; }
public LogController() { userService = new UserService(); }
public static void Init(string customUserAgent = null) { if (Inited) { return; } Inited = true; var platformUtilsService = Resolve <IPlatformUtilsService>("platformUtilsService"); var storageService = Resolve <IStorageService>("storageService"); var secureStorageService = Resolve <IStorageService>("secureStorageService"); var cryptoPrimitiveService = Resolve <ICryptoPrimitiveService>("cryptoPrimitiveService"); var i18nService = Resolve <II18nService>("i18nService"); var messagingService = Resolve <IMessagingService>("messagingService"); SearchService searchService = null; var stateService = new StateService(); var cryptoFunctionService = new PclCryptoFunctionService(cryptoPrimitiveService); var cryptoService = new CryptoService(storageService, secureStorageService, cryptoFunctionService); var tokenService = new TokenService(storageService); var apiService = new ApiService(tokenService, platformUtilsService, (bool expired) => { messagingService.Send("logout", expired); return(Task.FromResult(0)); }, customUserAgent); var appIdService = new AppIdService(storageService); var userService = new UserService(storageService, tokenService); var settingsService = new SettingsService(userService, storageService); var cipherService = new CipherService(cryptoService, userService, settingsService, apiService, storageService, i18nService, () => searchService); var folderService = new FolderService(cryptoService, userService, apiService, storageService, i18nService, cipherService); var collectionService = new CollectionService(cryptoService, userService, storageService, i18nService); searchService = new SearchService(cipherService); var lockService = new LockService(cryptoService, userService, platformUtilsService, storageService, folderService, cipherService, collectionService, searchService, messagingService, null); var environmentService = new EnvironmentService(apiService, storageService); var cozyClientService = new CozyClientService(tokenService, apiService, environmentService); var syncService = new SyncService(userService, apiService, settingsService, folderService, cipherService, cryptoService, collectionService, storageService, messagingService, cozyClientService, (bool expired) => { messagingService.Send("logout", expired); return(Task.FromResult(0)); }); var passwordGenerationService = new PasswordGenerationService(cryptoService, storageService, cryptoFunctionService); var totpService = new TotpService(storageService, cryptoFunctionService); var authService = new AuthService(cryptoService, apiService, userService, tokenService, appIdService, i18nService, platformUtilsService, messagingService, lockService); var exportService = new ExportService(folderService, cipherService); var auditService = new AuditService(cryptoFunctionService, apiService); var eventService = new EventService(storageService, apiService, userService, cipherService); Register <IStateService>("stateService", stateService); Register <ICryptoFunctionService>("cryptoFunctionService", cryptoFunctionService); Register <ICryptoService>("cryptoService", cryptoService); Register <ITokenService>("tokenService", tokenService); Register <IApiService>("apiService", apiService); Register <IAppIdService>("appIdService", appIdService); Register <IUserService>("userService", userService); Register <ISettingsService>("settingsService", settingsService); Register <ICipherService>("cipherService", cipherService); Register <IFolderService>("folderService", folderService); Register <ICollectionService>("collectionService", collectionService); Register <ISearchService>("searchService", searchService); Register <ISyncService>("syncService", syncService); Register <ILockService>("lockService", lockService); Register <IPasswordGenerationService>("passwordGenerationService", passwordGenerationService); Register <ITotpService>("totpService", totpService); Register <IAuthService>("authService", authService); Register <IExportService>("exportService", exportService); Register <IAuditService>("auditService", auditService); Register <IEnvironmentService>("environmentService", environmentService); Register <IEventService>("eventService", eventService); Register <ICozyClientService>("cozyClientService", cozyClientService); }
public TestController(UserService userService) { this.userService = userService; }
public AdministrationController() { _userService = new UserService(GetConnection()); }
public UserServiceTests() { _userService = new UserService(_unitOfWork); }
/// <summary> /// Registers user on XMPP server based on user's phone number using User Service. /// </summary> /// <param name="phoneNumber">A string containing the phone number.This is used to register user on XMPP server.</param> /// <param name="deviceVenderID">A string containing device specific vender id.</param> /// <returns>true if user account is successfully registered on XMPP server; otherwise, false.</returns> private static void RegisterUserOnXmpp(string phoneNumber, string deviceVenderID, string applicationID) { string deviceKey = GenerateDeviceKey(phoneNumber, deviceVenderID, applicationID); UserService.AddUser(phoneNumber, deviceKey, string.Empty, NeeoUtility.ConvertToJid(phoneNumber)); }
public AccountController(IADService adService, UserService userService, ILogger <AccountController> logger) { _adService = adService; _userService = userService; _logger = logger; }
public AdministrationController() { _userService = new UserService(Data); _storeService = new StoreService(Data); _adminService = new AdministrationService(Data); }
/// <summary> /// Конструктор контроллера комнат /// </summary> /// <param name="roomService"> Сервис работы с комнатами </param> /// <param name="deckService"> Сервис работы с колодами </param> /// <param name="userService"> Сервис работы с пользователями </param> public RoomsController(RoomService roomService, DeckService deckService, UserService userService) { this.roomService = roomService; this.deckService = deckService; this.userService = userService; }
public UserController(IConfiguration config, UserService userService, ILogger <UserController> logger) { _config = config; _logger = logger; _userService = userService; }
public PasswordUpdateForm(User user) { _user = user; _service = new UserService(); InitializeComponent(); }
public UniversController(dbcontext context) { unvS = new UniversityService(context); uS = new UserService(context); }
public AuthController() { userService = new UserService(); userProfileService = new UserProfileService(); }
public UserController(UserService userService) { _userService = userService; }
public UsersController(UserService userSvc) { this.userSvc = userSvc; this.pageSize = WebUtil.PageSize(); }
public AccessService(IPermissionResolverService permissionResolverService, UserService userService, ILogger logger) { _permissionResolverService = permissionResolverService ?? throw new ArgumentNullException(nameof(permissionResolverService)); _userService = userService ?? throw new ArgumentNullException(nameof(userService)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
public UserController(IHttpContextAccessor accessor) : base(accessor) { context = new ToBuyContext(); service = new UserService(context); }
/// <summary> /// Search movies asynchronously /// </summary> public override async Task LoadMoviesAsync(bool reset = false) { await LoadingSemaphore.WaitAsync(CancellationLoadingMovies.Token); await Task.Run(async() => { StopLoadingMovies(); if (reset) { DispatcherHelper.CheckBeginInvokeOnUI(() => { Movies.Clear(); Page = 0; VerticalScroll = 0d; }); } var watch = Stopwatch.StartNew(); Page++; if (Page > 1 && Movies.Count == MaxNumberOfMovies) { Page--; LoadingSemaphore.Release(); return; } Logger.Info( $"Loading search page {Page} with criteria: {SearchFilter}"); HasLoadingFailed = false; try { IsLoadingMovies = true; var result = await MovieService.SearchMoviesAsync(SearchFilter, Page, MaxMoviesPerPage, Genre, Rating, CancellationLoadingMovies.Token); DispatcherHelper.CheckBeginInvokeOnUI(() => { Movies.AddRange(result.movies.Except(Movies, new MovieLightComparer())); IsLoadingMovies = false; IsMovieFound = Movies.Any(); CurrentNumberOfMovies = Movies.Count; MaxNumberOfMovies = result.nbMovies; UserService.SyncMovieHistory(Movies); }); } catch (Exception exception) { Page--; Logger.Error( $"Error while loading search page {Page} with criteria {SearchFilter}: {exception.Message}"); HasLoadingFailed = true; Messenger.Default.Send(new ManageExceptionMessage(exception)); } finally { watch.Stop(); var elapsedMs = watch.ElapsedMilliseconds; Logger.Info( $"Loaded search page {Page} with criteria {SearchFilter} in {elapsedMs} milliseconds."); LoadingSemaphore.Release(); } }); }
public UserController() { userservice = new UserService(); }
public UsersController() { this.service = new UserService(); }
public void DefaultCtorWillUsedCustomDataContext() { IUserService userService = new UserService(); Assert.IsType <CustomDataContext>(userService.DataContext); }
public ResetPasswordMailController(ApplicationSignInManager signinManager, ApplicationUserManager userManager, UserService userService) : base(signinManager, userManager, userService) { }
public AppUser GetMe() { us = new UserService((ClaimsIdentity)User.Identity, db); return(us.GetUser()); }
/// <summary> /// Changes the user account's device key on XMPP server. /// </summary> /// <param name="userID">A string containing the phone number as user id.</param> /// <param name="deviceVenderID">A string containing device specific vender id.</param> /// <returns>true if user account's device key is successfully changed on XMPP server; otherwise, false.</returns> private static void ChangeUserDeviceKey(string userID, string deviceVenderID, string applicationID) { string deviceKey = GenerateDeviceKey(userID, deviceVenderID, applicationID); UserService.UpdateUser(userID, deviceKey, null, null); }
public UserLogoutCommand(UserService userService) { this.userService = userService; }
public AlohaService() { LogHelper.Configure(); log = LogHelper.GetLogger(); if (!MapperInited) { try { Mapper.Initialize(cfg => { //cfg.CreateMap<ServiceDataContracts.Dish, Entities.Dish>().ReverseMap(); cfg.CreateMap <ServiceDataContracts.Dish, Entities.Dish>().ReverseMap(); cfg.CreateMap <ServiceDataContracts.DishPackageToGoOrder, Entities.DishPackageToGoOrder>() .ForMember(m => m.Dish, opt => opt.Ignore()) .ForMember(m => m.OrderToGo, opt => opt.Ignore()); cfg.CreateMap <Entities.DishPackageToGoOrder, ServiceDataContracts.DishPackageToGoOrder>() .ForMember(m => m.Dish, opt => opt.Ignore()) .ForMember(m => m.OrderToGo, opt => opt.Ignore()); cfg.CreateMap <ServiceDataContracts.DishPackageFlightOrder, Entities.DishPackageFlightOrder>() .ForMember(m => m.Dish, opt => opt.Ignore()) .ForMember(m => m.OrderFlight, opt => opt.Ignore()) .ReverseMap(); cfg.CreateMap <ServiceDataContracts.User, Entities.User>() .ForMember(m => m.UserRole, opt => opt.Ignore()) //.ForMember(m => m.OrderFlight, opt => opt.Ignore()) .ReverseMap(); /* * cfg.CreateMap<ServiceDataContracts.OrderToGo, Entities.OrderToGo>() * //.ForMember(m => m., opt => opt.Ignore()) * //.ForMember(m => m.OrderFlight, opt => opt.Ignore()) * .ReverseMap(); */ cfg.CreateMap <ServiceDataContracts.Driver, Entities.Driver>() .ReverseMap(); cfg.CreateMap <ServiceDataContracts.OrderFlight, Entities.OrderFlight>() .ForMember(m => m.AirCompany, opt => opt.Ignore()) .ForMember(m => m.ContactPerson, opt => opt.Ignore()) .ForMember(m => m.CreatedBy, opt => opt.Ignore()) .ForMember(m => m.DeliveryPlace, opt => opt.Ignore()) .ForMember(m => m.PaymentType, opt => opt.Ignore()) .ForMember(m => m.SendBy, opt => opt.Ignore()) .ForMember(m => m.WhoDeliveredPersonPerson, opt => opt.Ignore()) .ReverseMap(); cfg.CreateMap <ServiceDataContracts.OrderToGo, Entities.OrderToGo>() .ForMember(m => m.DishPackages, opt => opt.MapFrom(a => a.DishPackages.ToList())) //.ForMember(m => m.DishPackages, a=> a.MapFrom<List<Entities.DishPackageToGoOrder>, List<ServiceDataContracts.DishPackageToGoOrder>>(a.)) .ReverseMap(); cfg.CreateMap <ServiceDataContracts.OrderCustomer, Entities.OrderCustomer>() .ReverseMap(); cfg.CreateMap <ServiceDataContracts.OrderCustomerPhone, Entities.OrderCustomerPhone>() .ReverseMap(); cfg.CreateMap <ServiceDataContracts.OrderCustomerAddress, Entities.OrderCustomerAddress>() .ReverseMap(); cfg.CreateMap <ServiceDataContracts.OrderCustomerInfo, Entities.OrderCustomerInfo>() .ReverseMap(); }); //Mapper.Initialize(cfg => cfg.CreateMap<ServiceDataContracts.DishPackageFlightOrder, Entities.DishPackageFlightOrder>().ReverseMap()); //Mapper.Initialize(cfg => cfg.CreateMap<ServiceDataContracts.DishPackageToGoOrder, Entities.DishPackageToGoOrder>().ReverseMap()); //Mapper.Initialize(cfg => cfg.CreateMap<ServiceDataContracts.Dish, Entities.Dish>().ReverseMap()); //Mapper.Initialize(cfg => cfg.CreateMap<Entities.Dish, ServiceDataContracts.Dish>()); MapperInited = true; log.Debug("Mapper.Initialize ok"); } catch (Exception e) { log.Error("Mapper.Initialize error " + e.Message); } } userService = new UserService(new AlohaDb()); orderService = new OrderService(new AlohaDb()); airCompanyService = new AirCompanyService(new AlohaDb()); userGroupService = new UserGroupService(new AlohaDb()); contactPersonService = new ContactPersonService(new AlohaDb()); curierService = new CurierService(new AlohaDb()); deliveryPersonService = new DeliveryPersonService(new AlohaDb()); deliveryPlaceService = new DeliveryPlaceService(new AlohaDb()); marketingChannelService = new MarketingChannelService(new AlohaDb()); dishPackageFlightOrderService = new DishPackageFlightOrderService(new AlohaDb()); dishPackageToGoOrderService = new DishPackageToGoOrderService(new AlohaDb()); dishService = new DishService(new AlohaDb()); driverService = new DriverService(new AlohaDb()); itemLabelInfoService = new ItemLabelInfoService(new AlohaDb()); orderCustomerService = new OrderCustomerService(new AlohaDb()); orderFlightService = new OrderFlightService(new AlohaDb()); orderToGoService = new OrderToGoService(new AlohaDb()); discountService = new DiscountService(new AlohaDb()); alertService = new AlertService(new AlohaDb()); paymentService = new PaymentService(new AlohaDb()); paymentGroupService = new PaymentGroupService(new AlohaDb()); dishLogicGroupService = new DishLogicGroupService(new AlohaDb()); dishKitchenGroupService = new DishKitchenGroupService(new AlohaDb()); logItemService = new LogItemService(new AlohaDb()); orderCustomerAddressService = new OrderCustomerAddressService(new AlohaDb()); orderCustomerPhoneService = new OrderCustomerPhoneService(new AlohaDb()); updaterService = new UpdaterService(new AlohaDb()); }
private async void SaveNoteButton_OnClicked(object sender, EventArgs e) { if (ProgenyCollectionView.SelectedItem is Progeny progeny) { _viewModel.IsBusy = true; _viewModel.IsSaving = true; Note saveNote = new Note(); saveNote.ProgenyId = progeny.Id; saveNote.AccessLevel = _viewModel.AccessLevel; saveNote.Progeny = progeny; DateTime noteTime = new DateTime(NoteDatePicker.Date.Year, NoteDatePicker.Date.Month, NoteDatePicker.Date.Day, NoteTimePicker.Time.Hours, NoteTimePicker.Time.Minutes, 0); saveNote.CreatedDate = noteTime; string userEmail = await UserService.GetUserEmail(); UserInfo userinfo = await UserService.GetUserInfo(userEmail); saveNote.Owner = userinfo.UserId; saveNote.Title = TitleEntry.Text; saveNote.Category = CategoryEntry.Text; string noteContent = await ContentWebView.EvaluateJavaScriptAsync("getContent()"); noteContent = noteContent.Replace(@"\u003C", "<"); // Todo: Proper string encoding/decoding. saveNote.Content = noteContent; // saveNote.Content = ContentEditor.Text; if (ProgenyService.Online()) { saveNote = await ProgenyService.SaveNote(saveNote); _viewModel.IsBusy = false; _viewModel.IsSaving = false; if (saveNote.NoteId == 0) { var ci = CrossMultilingual.Current.CurrentCultureInfo; ErrorLabel.Text = resmgr.Value.GetString("ErrorNoteNotSaved", ci); ErrorLabel.BackgroundColor = Color.Red; } else { var ci = CrossMultilingual.Current.CurrentCultureInfo; ErrorLabel.Text = resmgr.Value.GetString("NoteSaved", ci) + saveNote.NoteId; ErrorLabel.BackgroundColor = Color.Green; SaveNoteButton.IsVisible = false; CancelNoteButton.Text = "Ok"; CancelNoteButton.BackgroundColor = Color.FromHex("#4caf50"); await Shell.Current.Navigation.PopModalAsync(); } } else { // Todo: Translate message. ErrorLabel.Text = $"Error: No internet connection. Measurement for {progeny.NickName} was not saved. Try again later."; ErrorLabel.BackgroundColor = Color.Red; } _viewModel.IsBusy = false; _viewModel.IsSaving = false; ErrorLabel.IsVisible = true; } }
public SetCultureController() { userService = new UserService(); }
public LoginController(UserService userApp) => UserApp = userApp;