///<summary>Inserts one UserQuery into the database. Provides option to use the existing priKey.</summary> public static long Insert(UserQuery userQuery,bool useExistingPK){ if(!useExistingPK && PrefC.RandomKeys) { userQuery.QueryNum=ReplicationServers.GetKey("userquery","QueryNum"); } string command="INSERT INTO userquery ("; if(useExistingPK || PrefC.RandomKeys) { command+="QueryNum,"; } command+="Description,FileName,QueryText) VALUES("; if(useExistingPK || PrefC.RandomKeys) { command+=POut.Long(userQuery.QueryNum)+","; } command+= "'"+POut.String(userQuery.Description)+"'," +"'"+POut.String(userQuery.FileName)+"'," +DbHelper.ParamChar+"paramQueryText)"; if(userQuery.QueryText==null) { userQuery.QueryText=""; } OdSqlParameter paramQueryText=new OdSqlParameter("paramQueryText",OdDbType.Text,userQuery.QueryText); if(useExistingPK || PrefC.RandomKeys) { Db.NonQ(command,paramQueryText); } else { userQuery.QueryNum=Db.NonQ(command,true,paramQueryText); } return userQuery.QueryNum; }
///<summary>Inserts one UserQuery into the database. Returns the new priKey.</summary> internal static long Insert(UserQuery userQuery) { if(DataConnection.DBtype==DatabaseType.Oracle) { userQuery.QueryNum=DbHelper.GetNextOracleKey("userquery","QueryNum"); int loopcount=0; while(loopcount<100){ try { return Insert(userQuery,true); } catch(Oracle.DataAccess.Client.OracleException ex){ if(ex.Number==1 && ex.Message.ToLower().Contains("unique constraint") && ex.Message.ToLower().Contains("violated")){ userQuery.QueryNum++; loopcount++; } else{ throw ex; } } } throw new ApplicationException("Insert failed. Could not generate primary key."); } else { return Insert(userQuery,false); } }
public UserModule(IMediate mediator) { Get["/"] = _ => "Hi Earth People!"; //404 if not found!!!! Get["/{id:int}"] = parameters => { var userQuery = new UserQuery((int)parameters.id); try { var person = mediator.Request(userQuery); return person; } catch (InvalidOperationException ex) { return HttpStatusCode.NotFound; } }; Put["/{id:int}"] = parameters => { var user = this.Bind<User>(); var updateUserCmd = new UpdateUserCommand(user); try { var id = mediator.Send(updateUserCmd); return Negotiate.WithStatusCode(HttpStatusCode.NoContent); } catch (ValidationException ex) { return Negotiate.WithModel(ex.Errors.Select(x => new{x.PropertyName, x.ErrorMessage})).WithStatusCode(HttpStatusCode.UnprocessableEntity); } catch (InvalidOperationException ex) { return HttpStatusCode.NotFound; } }; Post["/"] = parameters => { var user = this.Bind<User>(); var insertUserCmd = new InsertUserCommand(user); try { var id = mediator.Send(insertUserCmd); return Negotiate.WithStatusCode(HttpStatusCode.Created).WithHeader("Location", Context.Request.Url + "/" + id); } catch (ValidationException ex) { return Negotiate.WithModel(ex.Errors.Select(x => new{x.PropertyName, x.ErrorMessage})).WithStatusCode(HttpStatusCode.UnprocessableEntity); } }; }
public static UsersViewModel Create(UserQuery query, Page<User> users) { return new UsersViewModel { SortOptions = new GridSortOptions { Column = query.SortColumn, Direction = (MvcContrib.Sorting.SortDirection)query.SortDirection }, Items = UserViewModel.Create(users) }; }
///<summary>Converts a DataTable to a list of objects.</summary> public static List<UserQuery> TableToList(DataTable table){ List<UserQuery> retVal=new List<UserQuery>(); UserQuery userQuery; for(int i=0;i<table.Rows.Count;i++) { userQuery=new UserQuery(); userQuery.QueryNum = PIn.Long (table.Rows[i]["QueryNum"].ToString()); userQuery.Description= PIn.String(table.Rows[i]["Description"].ToString()); userQuery.FileName = PIn.String(table.Rows[i]["FileName"].ToString()); userQuery.QueryText = PIn.String(table.Rows[i]["QueryText"].ToString()); retVal.Add(userQuery); } return retVal; }
public string GetPasswordByPhone(string phoneNumber) { UserQuery userQuery = new UserQuery(language); System.Data.DataTable dataTable = conn_db.ReadTable(userQuery.GetPasswordByPhoneNumber(phoneNumber)); string password = ""; if (dataTable.Rows.Count == 0) { throw new EmptyViewException(language); } password = dataTable.Rows[0][0].ToString(); return(password); }
public LoginDTO LoginControl(string phoneNumber, string password) { UserQuery userQuery = new UserQuery(language); var status = false; System.Data.DataTable dataTable; dataTable = conn_db.ReadTable(userQuery.GetObjectByColname("users", "phoneNumber", phoneNumber)); if (dataTable.Rows.Count == 0) { throw new EmptyViewException(language); } if (PasswordHash.ValidatePassword(password, dataTable.Rows[0]["PASSWORD"].ToString())) { status = true; } LoginDTO user = new LoginDTO { user_id = dataTable.Rows[0]["id"].ToString(), accessToken = dataTable.Rows[0]["accessToken"].ToString(), username = dataTable.Rows[0]["username"].ToString(), userType = dataTable.Rows[0]["USER_TYPE_ID"] is DBNull ? 0 : Convert.ToInt32(dataTable.Rows[0]["USER_TYPE_ID"]) }; if (status) { return(user); } else { return(null); } }
public int GetUserUserTypeByPhone(string phoneNumber) { UserQuery userQuery = new UserQuery(language); System.Data.DataTable dataTable = conn_db.ReadTable(userQuery.GetUserTypeByPhone(phoneNumber)); int UserType = 1; if (dataTable.Rows.Count > 0) { UserType = Convert.ToInt16(dataTable.Rows[0][0].ToString()); } else { return(1); } return(UserType); }
private async Task <UserRecord> GetUserAsync( UserQuery query, CancellationToken cancellationToken) { var response = await this.PostAndDeserializeAsync <GetAccountInfoResponse>( "accounts:lookup", query.Build(), cancellationToken).ConfigureAwait(false); var result = response.Result; if (result == null || result.Users == null || result.Users.Count == 0) { throw new FirebaseAuthException( ErrorCode.NotFound, $"Failed to get user with {query.Description}", AuthErrorCode.UserNotFound, response: response.HttpResponse); } return(new UserRecord(result.Users[0])); }
/// <summary> /// 保存 /// </summary> private void Save() { UserEntity entity = new UserEntity(); entity.OUID = this.OUID; entity.UserName = txtUserName.Text; entity.MobilePhone = txtMobilePhone.Text; entity.OfficePhone = txtOfficePhone.Text; entity.Email = txtEmail.Text; entity.Sex = NDConvert.ToInt16(rdolstSex.SelectedValue); entity.Account = txtAccount.Text.Trim(); entity.Password = Security.EncryptQueryString(txtPassword1.Text.Trim()); entity.AddDate = DateTime.Now; entity.Status = 1; entity.UserType = (int)CommonEnum.UserType.InnerUser; entity.SortIndex = UserQuery.GetMaxSortIndex(); new UserRule().Add(entity); }
private ProjectEntryFormData CreateFormData(ProjectDTO projectDTO) { if (projectDTO == null) { return(new ProjectEntryFormData()); } ProjectEntryFormData formData = new ProjectEntryFormData(); var _operator = new OperatorQuery(this.Db).GetByPrimaryKey(projectDTO.Operator_FK); if (_operator != null) { formData.Operators.Add(_operator); } var deliveryArea = new DeliveryAreaQuery(this.Db).GetByPrimaryKey(projectDTO.DeliveryArea_FK); if (deliveryArea != null) { formData.DeliveryAreas.Add(deliveryArea); } var vendor = new VendorQuery(this.Db).GetByPrimaryKey(projectDTO.Vendor_FK); if (vendor != null) { formData.Vendors.Add(vendor); } bool projectManagerIsExist = (projectDTO.User_FK != null); if (projectManagerIsExist) { var user = new UserQuery(this.Db).GetByPrimaryKey((int)projectDTO.User_FK); if (user != null) { formData.Users.Add(user); } } return(formData); }
public async Task <ActionResult <LoginReturn> > PostLogin(UserQuery uq) { var reqData = await _context.Users .Where(s => s.UserName == uq.uname) .FirstOrDefaultAsync(); var rd = new LoginReturn(); if (reqData == null) { rd.password = ""; } else { rd.password = reqData.Password; rd.id = reqData.UserId; } return(rd); }
public async Task <IEnumerable <UserDisplay> > Execute(UserQuery request) { var query = Context.Users.AsQueryable(); if (request.Username != null) { query = query.Where(u => u.UserName.Contains(request.Username)); } return(await query.Select(u => new UserDisplay { UserID = u.Id, Username = u.UserName, IsLogged = u.IsLoged, ImagePath = u.ImagePath, LogoutTime = u.LogoutTime }).OrderBy(u => !u.IsLogged).ToListAsync()); }
public PartialViewResult PartialPeople(UserQuery query, IEnumerable <int> users) { UserSearchResult model = null; // get selected users ViewBag.Selected = new List <User>(); if (users != null && users.Any()) { ViewBag.Selected = UserService.Get(users); } // no search criteria, try to fetch most recently contacted people instead if (query.Text.IsNullOrEmpty()) { var conversations = ConversationService.Search(new ConversationQuery { UserId = User.Id, SearchRooms = false, OrderBy = "LastMessageAt DESC", Top = 10 }); List <int> ids = new List <int>(); foreach (var c in conversations) { ids.Add(c.MemberIds.FirstOrDefault(x => x != User.Id)); } var recent = UserService.Get(ids).Where(x => !x.IsSuspended && !x.IsTrashed()); if (recent.Any()) { model = new UserSearchResult(new UserQuery(), recent, recent.Count()); } } // perform normal search if (model == null) { query.Suspended = false; query.Trashed = false; query.OrderBy = "Name"; query.Count = true; query.Top = 10; model = UserService.Search(query); } return(PartialView("_People", model)); }
///<summary>Updates one UserQuery in the database. Uses an old object to compare to, and only alters changed fields. This prevents collisions and concurrency problems in heavily used tables.</summary> public static void Update(UserQuery userQuery, UserQuery oldUserQuery) { string command = ""; if (userQuery.Description != oldUserQuery.Description) { if (command != "") { command += ","; } command += "Description = '" + POut.String(userQuery.Description) + "'"; } if (userQuery.FileName != oldUserQuery.FileName) { if (command != "") { command += ","; } command += "FileName = '" + POut.String(userQuery.FileName) + "'"; } if (userQuery.QueryText != oldUserQuery.QueryText) { if (command != "") { command += ","; } command += "QueryText = " + DbHelper.ParamChar + "paramQueryText"; } if (command == "") { return; } if (userQuery.QueryText == null) { userQuery.QueryText = ""; } OdSqlParameter paramQueryText = new OdSqlParameter("paramQueryText", OdDbType.Text, userQuery.QueryText); command = "UPDATE userquery SET " + command + " WHERE QueryNum = " + POut.Long(userQuery.QueryNum); Db.NonQ(command, paramQueryText); }
public UserManagementTableDto GetAll(UserManagementTableFilterModelDto filter) { if (!CurrentUserId.HasValue) { throw new Exception("User is not logged in."); } var currentUser = _userManagementApiService.GetUserById(CurrentUserId.Value); UserQuery userQuery = _mapper.Map <UserQuery>(filter); IPagedList <User> users = _userManagementApiService.GetAllUsers(userQuery, currentUser.Email); List <UserManagementTableRowDto> rows = _mapper.Map <IEnumerable <User>, IEnumerable <UserManagementTableRowDto> >(users).ToList(); return(new UserManagementTableDto { UserManagmentTableRows = rows, TotalDisplayedRecords = users.TotalCount, TotalRecords = users.TotalCount }); }
//public UserDb GetUserByPhoneNumber(string phoneNumber) //{ // UserQuery userQuery = new UserQuery(); // System.Data.DataTable dataTable = conn_db.ReadTable(userQuery.GetObjectByColname<string>("users_v", "phoneNumber", phoneNumber)); // UserDb userdb = new UserDb(); // if (dataTable.Rows.Count > 0) // { // userdb.userId = Convert.ToInt32(dataTable.Rows[0]["USER_ID"].ToString()); // userdb.username = dataTable.Rows[0]["USERNAME"].ToString(); // userdb.fullname = dataTable.Rows[0]["FULLNAME"].ToString(); // userdb.email = dataTable.Rows[0]["EMAIL"].ToString(); // userdb.password = dataTable.Rows[0]["PASSWORD"].ToString(); // userdb.phoneNumber = dataTable.Rows[0]["PHONENUMBER"].ToString(); // userdb.countryCode = dataTable.Rows[0]["countryCode"].ToString(); // userdb.isActive =Convert.ToInt32( dataTable.Rows[0]["isActive"].ToString()); // userdb.rating = Convert.ToDouble(dataTable.Rows[0]["RATING"].ToString()); // userdb.userType = Convert.ToInt32(dataTable.Rows[0]["USERTYPE"].ToString()); // userdb.accessToken = dataTable.Rows[0]["ACCESSTOKEN"].ToString(); // userdb.img = dataTable.Rows[0]["IMG"].ToString(); // userdb.socialId = dataTable.Rows[0]["SOCIAL_ID"].ToString(); // } // else // return null; // return userdb; //} //public UserDb GetUserById(string user_id) //{ // UserQuery userQuery = new UserQuery(); // System.Data.DataTable dataTable = conn_db.ReadTable(userQuery.GetObjectByColname<string>("users_v", "user_id", user_id)); // UserDb userdb = new UserDb(); // if (dataTable.Rows.Count > 0) // { // userdb.userId = Convert.ToInt32(dataTable.Rows[0]["USER_ID"].ToString()); // userdb.username = dataTable.Rows[0]["USERNAME"].ToString(); // userdb.fullname = dataTable.Rows[0]["FULLNAME"].ToString(); // userdb.email = dataTable.Rows[0]["EMAIL"].ToString(); // userdb.password = dataTable.Rows[0]["PASSWORD"].ToString(); // userdb.phoneNumber = dataTable.Rows[0]["PHONENUMBER"].ToString(); // userdb.countryCode = dataTable.Rows[0]["countryCode"].ToString(); // userdb.isActive = Convert.ToInt32(dataTable.Rows[0]["isActive"].ToString()); // userdb.rating = Convert.ToDouble(dataTable.Rows[0]["RATING"].ToString()); // userdb.userType = Convert.ToInt32(dataTable.Rows[0]["USERTYPE"].ToString()); // userdb.accessToken = dataTable.Rows[0]["ACCESSTOKEN"].ToString(); // userdb.img = dataTable.Rows[0]["IMG"].ToString(); // userdb.socialId = dataTable.Rows[0]["SOCIAL_ID"].ToString(); // } // else // return null; // return userdb; //} public UserDb GetPhoneInfoByUsername(string username) { UserQuery userQuery = new UserQuery(language); System.Data.DataTable dataTable = conn_db.ReadTable(userQuery.GetObjectByColname <string>("users_v", "username", username)); UserDb userdb = new UserDb(); if (dataTable.Rows.Count == 0) { throw new EmptyViewException(language); } userdb.phoneNumber = dataTable.Rows[0]["PHONENUMBER"].ToString(); userdb.countryCode = dataTable.Rows[0]["countryCode"].ToString(); return(userdb); }
void BindUsers() { User u = Profile.AccountInfo; if (u.UserType == UserType.InnerUser || u.IsManager == 2) { lbNewRole.Visible = false; mbNC.ShowMsg("内部用户或非领导级别用户无法查看此页面!", System.Drawing.Color.Red); } else { UserQuery q = new UserQuery(); q.CompanyID = u.CompanyID; q.UserType = UserType.CompanyUser; q.AccountStatus = AccountStatus.Authenticated; List <User> users = Users.GetUsers(q).Records; rpList.DataSource = users; rpList.DataBind(); } }
public HttpResponseMessage UpdateQuery(int id, UserQuery model) { try { if (id == model.SlNo) { db.Entry(model).State = EntityState.Modified; db.SaveChanges(); return(new HttpResponseMessage(HttpStatusCode.OK)); } else { return(new HttpResponseMessage(HttpStatusCode.NotFound)); } } catch (Exception ex) { return(new HttpResponseMessage(HttpStatusCode.InternalServerError)); } }
public void FindUsers_ReturnsValue_WithMatchingUsers(UserQuery queryString, IEnumerable <User> expectedUsers) { // Arrange var mockUserService = new Mock <IUserStore>(MockBehavior.Strict); mockUserService.Setup(o => o.GetUsers()).Returns(new User[] { RootUser, KyleUser }); var controller = new UsersController(mockUserService.Object); // Act var result = controller.FindUsers(queryString); // Assert mockUserService.Verify(o => o.GetUsers(), Times.Once()); Assert.NotNull(result); Assert.Null(result.Result); Assert.Equal(expectedUsers, result.Value); }
public string CheckAccessTokenUser(string AccessToken) { System.Data.DataTable dataTable; try { UserQuery UserQuery = new UserQuery(language); dataTable = conn_db.ReadTable(UserQuery.CheckAccessTokenUser(AccessToken)); } catch { throw new EmptyViewException(language); } if (dataTable.Rows.Count == 0) { throw new EmptyViewException(language); } return(dataTable.Rows[0]["ID"].ToString()); }
public HttpResponseMessage DeleteQuery(int id) { try { UserQuery model = db.UserQueries.Find(id); if (model != null) { db.UserQueries.Remove(model); db.SaveChanges(); return(new HttpResponseMessage(HttpStatusCode.OK)); } else { return(new HttpResponseMessage(HttpStatusCode.NotFound)); } } catch (Exception ex) { return(new HttpResponseMessage(HttpStatusCode.InternalServerError)); } }
public IUserModel CreateUser(string userName, string password) { var message = new UserSignUp { UserName = userName, Password = password, Id = Guid.NewGuid() }; var newUser = new UserQuery(); newUser.UserName = message.UserName; newUser.Password = message.Password; newUser.RebellionBoosterPacks = 5; newUser.Id = message.Id; model.Users.Add(newUser); this.ServiceClient.PublishAsync <UserSignUp>(message); return(this.Users.FirstOrDefault(x => x.Id == message.Id)); }
public Expression <Func <User, bool> > FilterUsers(UserQuery query) { var predicate = PredicateBuilder.True <User>(); if (!string.IsNullOrEmpty(query.SearchText)) { string searchParameter = query.SearchText.ToLower(); var search = PredicateBuilder.False <User>(); search = search.Or(p => p.UserName.ToLower().Contains(searchParameter)); search = search.Or(p => p.PhoneNumber.ToLower().Contains(searchParameter)); search = search.Or(p => p.Email.ToLower().Contains(searchParameter)); predicate = predicate.And(search); } if (query.Role.HasValue) { predicate = predicate.And(p => p.UserGroup.Role == (Role)query.Role.Value); } return(predicate); }
/// <summary> /// Authenticate User with Email And Password /// </summary> /// <param name="Email">User Email</param> /// <param name="Password">User Password</param> /// <returns>User Data with Role Inof with User ID</returns> public static Login_ResponseModel LoginUserWithEmailAndPassword(string Email, string Password) { //TODO: //Step 1: Fetch User With given Email var responeUserData = UserQuery.FetchUserWithEmail(Email); //Step 2: If Data found match the password if (responeUserData != null) { if (responeUserData.Password.Equals(Password)) { //Step 3: Return User Role with UserID return(new Login_ResponseModel() { RoleName = "Organizer", UserID = responeUserData.ID }); } } return(null); }
public async Task <QueryResult <User> > GetUsers(UserQuery queryObj) { var result = new QueryResult <User>(); var query = context.Users.AsQueryable(); var columnsMap = new Dictionary <string, Expression <Func <User, object> > >() { ["FirstName"] = v => v.FirstName, ["LastName"] = v => v.LastName, }; query = query.ApplyOrdering(queryObj, columnsMap); result.TotalItems = await query.CountAsync(); query = query.ApplyPaging(queryObj); result.Items = await query.ToListAsync(); return(result); }
public override async Task <UserProfileResult> GetProfile(UserQuery request, ServerCallContext context) { var result = await _database.GetUserProfileAsync(request.Id); if (!result.Success) { return(new UserProfileResult { Status = Status.Failed }); } var output = new UserProfileResult { Status = Status.Success, Color = result.Value.Color, Money = result.Value.Money, Points = result.Value.Points, Reputations = result.Value.Reputations, Vault = result.Value.Vault, BannerId = result.Value.BannerId }; output.BadgeIds.AddRange(result.Value.BadgeIds); return(output); }
public IHttpActionResult postshit(decimal lat, decimal longi, string userid) { //UserQuery oo = new UserQuery(); //oo.latitude = x.lat; //oo.longitude = x.lon; //oo.Count = "2"; //oo.MessengerUserID = "2"; //_ctx.userQueries.Add(oo); //_ctx.SaveChanges(); //return Ok(); //var x = lat. UserQuery oo = new UserQuery(); oo.latitude = lat.ToString(); oo.longitude = longi.ToString(); oo.Count = "1"; oo.MessengerUserID = userid; _ctx.userQueries.Add(oo); _ctx.SaveChanges(); return(Ok()); }
public IEnumerable <UserData> GetUsers() { UserQuery query = new UserQuery(); List <UserModel> userModels = query.Execute().ToList(); return(from user in userModels select new UserData() { Id = user.Identity, ImageFileLocation = $@"{Configuration.Instance.UserImageDirectoryPath}\{user.ImageFilename}", Firstname = user.Firstname, Middlename = user.Middlename, Lastname = user.Lastname, Gender = user.Gender, BirthDate = user.BirthDate, ContactNumber = user.ContactNumber, Email = user.Email, Address = user.Address }); }
public async Task <QueryResult <User> > GetUsers(UserQuery queryObj) { var result = new QueryResult <User>(); var query = context.Users.Where(u => string.IsNullOrEmpty(queryObj.Name) || u.Name.Contains(queryObj.Name)).AsQueryable(); var columnsMap = new Dictionary <string, Expression <Func <User, object> > > { ["Name"] = u => u.Name, ["Email"] = u => u.Email }; query = query.ApplyOrdering(queryObj, columnsMap); result.TotalItems = await query.CountAsync(); query = query.ApplyPaging(queryObj); result.Items = await query.ToListAsync(); return(result); }
public void LoadParamValues(UserQuery query) { m_userQuery = query; string[] paramValueArray = m_userQuery.Params.Split(new char[] { ',' }); Dictionary <string, string> paramValues = new Dictionary <string, string>(); foreach (string s in paramValueArray) { paramValues.Add(s.Substring(0, s.IndexOf(":")), s.Substring(s.IndexOf(":") + 1, s.Length - s.IndexOf(":") - 1)); } IDictionaryEnumerator i = paramValues.GetEnumerator(); while (i.MoveNext()) { m_searchForm.StoredProcedure.Params[i.Key.ToString()].Value = i.Value.ToString(); m_searchForm.ParamEditors[i.Key.ToString()].EditValue = i.Value.ToString(); } }
public void AddQuery(UserQueryDto queryDto) { User user = Database.Users.Get(queryDto.UserId); // валидация if (user == null) { throw new Exception("User not found"); } // применяем скидку UserQuery query = new UserQuery { Date = DateTime.Now, UserId = queryDto.UserId, Path = queryDto.Path, }; Database.UserQueries.Create(query); Database.Save(); }
public async Task <IHttpActionResult> Get([FromUri] UserQuery query) { var serviceRes = await _userManagementService.GetAsync(new UserListRequest() { Query = query, RequestOwner = User }); IHttpActionResult res = BadRequest(serviceRes.Message); if (serviceRes.Access == ResponseAccess.Granted) { res = Ok(new { items = serviceRes.Users, count = serviceRes.Count }); } if (serviceRes.Access == ResponseAccess.Deny) { res = Unauthorized(serviceRes.Message); } return(res); }
public async Task <IActionResult> PutOne(int id, [FromBody] Users body) { await Db.Connection.OpenAsync(); var query = new UserQuery(Db); var result = await query.FindOneAsync(id); if (result is null) { return(new NotFoundResult()); } result.Name = body.Name; result.Password = body.Password; result.Age = body.Age; result.DateCreated = body.DateCreated; result.Deleted = body.Deleted; await result.UpdateAsync(id); return(new OkObjectResult(result)); }
public async Task <IActionResult> MatchResidentialProperty([FromBody] UserQuery query) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } else { switch (query.purpose) { case Purpose.Rent: return(Ok(await _matchHelper.MatchRentalProperty(query))); case Purpose.Sale: return(Ok(await _matchHelper.MatchOnSaleProperty(query))); default: return(Ok(await _matchHelper.MatchRentalProperty(query))); } } }
/// <summary> /// Creates any entity records that this sample requires. /// </summary> public void CreateRequiredRecords() { #region Create Accounts to query over Console.WriteLine(" Creating some sample accounts"); Account account = new Account() { Name = "Coho Vineyard" }; account.Id = _serviceProxy.Create(account); _accounts.Add(account); Console.WriteLine(" Created Account {0}", account.Name); account = new Account() { Name = "Coho Winery" }; account.Id = _serviceProxy.Create(account); _accounts.Add(account); Console.WriteLine(" Created Account {0}", account.Name); account = new Account() { Name = "Coho Vineyard & Winery" }; account.Id = _serviceProxy.Create(account); _accounts.Add(account); Console.WriteLine(" Created Account {0}", account.Name); #endregion #region Create a Saved Query Console.WriteLine(" Creating a Saved Query that retrieves all Account ids"); _savedQuery = new SavedQuery() { Name = "Fetch all Account ids", ReturnedTypeCode = Account.EntityLogicalName, FetchXml = @" <fetch mapping='logical'> <entity name='account'> <attribute name='name' /> </entity> </fetch>", QueryType = 0, }; _savedQuery.Id = _serviceProxy.Create(_savedQuery); #endregion #region Create a User Query Console.WriteLine( " Creating a User Query that retrieves all Account ids for Accounts with name 'Coho Winery'"); _userQuery = new UserQuery() { Name = "Fetch Coho Winery", ReturnedTypeCode = Account.EntityLogicalName, FetchXml = @" <fetch mapping='logical'> <entity name='account'> <attribute name='name' /> <filter> <condition attribute='name' operator='eq' value='Coho Winery' /> </filter> </entity> </fetch>", QueryType = 0 }; _userQuery.Id = _serviceProxy.Create(_userQuery); #endregion }
public UserQueryTest() { TestEnvironment.Init(); query = new UserQuery(); }
public ActionResult SearchTable(UserQuery query, int pageNum = 1) { var requestsModel = DB.GATE_MaterialRequest .Where(req => !query.HasEmployees || query.EmployeeIds.Contains(req.ConcernedEmployeeId)) .Where(req => !query.HasOffices || !req.AmarisOfficeId.HasValue || query.OfficeIds.Contains(req.AmarisOfficeId.Value)) .Where(req => !query.HasEmployeeStatuses || !req.ConcernedEmployee.EmployeeStatusId.HasValue || query.EmployeeStatusesIds.Contains(req.ConcernedEmployee.EmployeeStatusId.Value)) .Where(req => !query.HasType || req.ConcernedEmployee.EmployeeTypeId == query.TypeId) .Where(req => !query.HasFunctions || req.ConcernedEmployee.Employee_Scope.Any(sco => query.FunctionIds.Contains(sco.FunctionId))) .Where(req => req.OrderStatusId != OrderStatus.Cancelled) .Where(req => !query.HasOrderStatus || req.OrderStatusId == (OrderStatus?)query.OrderStatusId) .WithTreeSecurity(LoggedUser.EmployeeId, false); if (!query.HasEmployees) { requestsModel = requestsModel.Where(req => req.OrderStatusId != OrderStatus.Complete); } IEnumerable<RequestViewModel> model = requestsModel.Include(x => x.ConcernedEmployee).Select(RequestViewModel.ContructorForEF); if (query.OrderbyEntryDate) { model = query.OrderbyDesc ? model.OrderByDescending(req => req.ConcernedEmployee.EntryDate) : model.OrderBy(req => req.ConcernedEmployee.EntryDate); } else if (query.OrderbyDeliveryDate) { model = query.OrderbyDesc ? model.OrderByDescending(req => req.ExpectedDate) : model.OrderBy(req => req.ExpectedDate); } else { model = model.OrderBy(req => req.OrderId); } //var tableModel = new TableViewModel(DB.Packages, model.ToPagedList(pageNum, EntriesPerPage), query); var tableModel = new TableViewModel(DB.Packages, model, query); return PartialView("_PendingTable", tableModel); }
///<summary>Updates one UserQuery in the database.</summary> public static void Update(UserQuery userQuery){ string command="UPDATE userquery SET " +"Description= '"+POut.String(userQuery.Description)+"', " +"FileName = '"+POut.String(userQuery.FileName)+"', " +"QueryText = "+DbHelper.ParamChar+"paramQueryText " +"WHERE QueryNum = "+POut.Long(userQuery.QueryNum); if(userQuery.QueryText==null) { userQuery.QueryText=""; } OdSqlParameter paramQueryText=new OdSqlParameter("paramQueryText",OdDbType.Text,userQuery.QueryText); Db.NonQ(command,paramQueryText); }
private PartialViewResult List(UserQuery query) { Session.Set(query); var users = Context.Users.Search(query); var model = UsersViewModel.Create(query, users); model.CurrentUsername = Security.Username; var message = GetRedirectedMessage(); if (message != null) { model.Message = message; } return PartialView(MVC.Account.Views.List, model); }
private void butFormulate_Click(object sender, System.EventArgs e) {//is now the 'Favorites' button FormQueryFavorites FormQF=new FormQueryFavorites(); FormQF.UserQueryCur=UserQueryCur; FormQF.ShowDialog(); if(FormQF.DialogResult==DialogResult.OK){ textQuery.Text=FormQF.UserQueryCur.QueryText; //grid2.CaptionText=UserQueries.Cur.Description; textTitle.Text=FormQF.UserQueryCur.Description; UserQueryCur=FormQF.UserQueryCur; report=new ReportSimpleGrid(); report.Query=textQuery.Text; SubmitQuery(); //this.butSaveChanges.Enabled=true; } else{ //butSaveChanges.Enabled=false; } }
///<summary>Updates one UserQuery in the database. Uses an old object to compare to, and only alters changed fields. This prevents collisions and concurrency problems in heavily used tables.</summary> public static void Update(UserQuery userQuery,UserQuery oldUserQuery){ string command=""; if(userQuery.Description != oldUserQuery.Description) { if(command!=""){ command+=",";} command+="Description = '"+POut.String(userQuery.Description)+"'"; } if(userQuery.FileName != oldUserQuery.FileName) { if(command!=""){ command+=",";} command+="FileName = '"+POut.String(userQuery.FileName)+"'"; } if(userQuery.QueryText != oldUserQuery.QueryText) { if(command!=""){ command+=",";} command+="QueryText = "+DbHelper.ParamChar+"paramQueryText"; } if(command==""){ return; } if(userQuery.QueryText==null) { userQuery.QueryText=""; } OdSqlParameter paramQueryText=new OdSqlParameter("paramQueryText",OdDbType.Text,userQuery.QueryText); command="UPDATE userquery SET "+command +" WHERE QueryNum = "+POut.Long(userQuery.QueryNum); Db.NonQ(command,paramQueryText); }
private void list2_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e) { if(list2.IndexFromPoint(e.X,e.Y)<0){//>list2.Items.Count){ return; } UserQueryCur=QueryList[list2.IndexFromPoint(e.X,e.Y)]; textQuery.Text=UserQueryCur.QueryText; textTitle.Text=UserQueryCur.Description; textFileName.Text=UserQueryCur.FileName; }
/// <summary> /// 모든 유저의 정보 알아내기 /// </summary> /// <param name="AuthKey"></param> /// <param name="serviceURL"></param> /// <returns></returns> public UsersVO[] GetUsersInfo(string AuthKey, string serviceURL) { if (!securityManager.CheckSecurityToken(AuthKey)) { throw new Exception("인증된 사용자가 아닙니다"); } string query = new UserQuery().GetAllUsers(); DataTable dtUser = DBController.getInstance().GetData(serviceURL, query); IList<UsersVO> userList = new List<UsersVO>(); for (int i = 0; i < dtUser.Rows.Count; i++) { UsersVO uvo = new UsersVO(); uvo.UserID = dtUser.Rows[i]["userid"].ToString(); uvo.UserPassword = dtUser.Rows[i]["userpassword"].ToString(); uvo.UserAuth = JsonConvert.DeserializeObject<UserAuth>(dtUser.Rows[0]["userauth"].ToString()); uvo.UserType = (사용자등급)Enum.Parse(typeof(사용자등급),dtUser.Rows[0]["usertype"].ToString()); userList.Add(uvo); } UsersVO[] arrUV = new UsersVO[userList.Count]; for (int i = 0; i < userList.Count; i++) { arrUV[i] = userList[i]; } return arrUV; }
/// <summary> /// 사용자 정보 업데이트 /// 사용자ID는 바뀌지 않는다 /// </summary> /// <param name="AuthKey"></param> /// <param name="serviceURL"></param> /// <param name="userInfo"></param> /// <returns></returns> public int UpdateUserInfo(string AuthKey, string serviceURL,UsersVO userInfo) { string query = new UserQuery().UpdateUser(userInfo); int EffectedRow = DBController.getInstance().SetData(serviceURL, query); return EffectedRow; }
public HomeController(IUserService userService, UserQuery userQuery) { _userService = userService; _userQuery = userQuery; }
/// <summary> /// 로그인 /// </summary> /// <param name="AuthKey"></param> /// <param name="serviceURL"></param> /// <param name="id"></param> /// <param name="password"></param> /// <returns></returns> public UsersVO UserLogIn(string AuthKey, string serviceURL, string id, string password) { if (!securityManager.CheckSecurityToken(AuthKey)) { throw new Exception("인증된 사용자가 아닙니다"); } string query = new UserQuery().GetUserInfo(id); DataTable dtUser = DBController.getInstance().GetData(serviceURL, query); if (dtUser.Rows.Count > 0 && dtUser.Rows[0]["USERPASSWORD"].ToString() == password) { UsersVO uvo = new UsersVO(); uvo.UserID = id; uvo.UserPassword = password; uvo.UserAuth = JsonConvert.DeserializeObject<UserAuth>(dtUser.Rows[0]["UserAuth"].ToString()); uvo.UserType = (사용자등급)Enum.Parse(typeof(사용자등급), dtUser.Rows[0]["usertype"].ToString()); return uvo; } else { return null; } }