public static UsersInRolesCollection Search(SearchFilter value) { UsersInRolesCollection items = new UsersInRolesCollection(); string key = string.Format(SETTINGS_Search_KEY, value.CompanyID + value.Keyword + value.Page + value.PageSize + value.OrderBy + value.OrderDirection); if (SystemConfig.AllowSearchCache) { object obj2 = HttpCache.Get(key); if ((obj2 != null)) { return((UsersInRolesCollection)obj2); } } using (var client = WebApiHelper.myclient(HouseEndpoint, SystemConst.APIJosonReturnValue)) { HttpResponseMessage response = client.PostAsJsonAsync(Resource + "?method=search", value).GetAwaiter().GetResult(); if (response.IsSuccessStatusCode) { items = response.Content.ReadAsAsync <UsersInRolesCollection>().GetAwaiter().GetResult(); } } if (SystemConfig.AllowSearchCache) { HttpCache.Max(key, items); } return(items); }
public static UsersInRolesCollection Search(SearchFilter SearchKey) { UsersInRolesCollection collection = new UsersInRolesCollection(); using (var reader = SqlHelper.ExecuteReader("UsersInRoles_Search", SearchFilterManager.SqlSearchParam(SearchKey))) { while (reader.Read()) { UsersInRoles obj = new UsersInRoles(); obj = GetItemFromReader(reader); collection.Add(obj); } } return(collection); }
/// <summary> /// get Roles from table UserInRole /// /// create by pham thanh /// </summary> /// <param name="UserName"></param> /// <returns></returns> public static UsersInRolesCollection GetRolesbyUserName(string UserName, int companyID) { UsersInRolesCollection collection = new UsersInRolesCollection(); UsersInRoles obj; var par = new SqlParameter[] { new SqlParameter("@UserName", UserName), new SqlParameter("@CompanyID", companyID) }; using (var reader = SqlHelper.ExecuteReader("UserInRoles_GetByUserName", par)) { while (reader.Read()) { obj = GetItemFromReader(reader); collection.Add(obj); } } return(collection); }
public static UsersInRolesCollection GetAllItem(int CompanyID) { UsersInRolesCollection collection = new UsersInRolesCollection(); var sqlParams = new SqlParameter[] { new SqlParameter("@CompanyID", CompanyID), }; using (var reader = SqlHelper.ExecuteReader("UsersInRoles_GetAll", sqlParams)) { while (reader.Read()) { UsersInRoles obj = new UsersInRoles(); obj = GetItemFromReader(reader); collection.Add(obj); } } return(collection); }
public static UsersInRolesCollection GetbyUser(string CreatedUser, int CompanyID) { UsersInRolesCollection collection = new UsersInRolesCollection(); UsersInRoles obj; var sqlParams = new SqlParameter[] { new SqlParameter("@CreatedUser", CreatedUser), new SqlParameter("@CompanyID", CompanyID) }; using (var reader = SqlHelper.ExecuteReader("UsersInRoles_GetAll_byUser", sqlParams)) { while (reader.Read()) { obj = GetItemFromReader(reader); collection.Add(obj); } } return(collection); }
public static UsersInRolesCollection GetByUsername(string userName, int companyID) { UsersInRolesCollection items = new UsersInRolesCollection(); string key = string.Format(SETTINGS_User_KEY, userName, companyID); object obj2 = HttpCache.Get(key); if ((obj2 != null)) { return((UsersInRolesCollection)obj2); } using (var client = WebApiHelper.myclient(HouseEndpoint, SystemConst.APIJosonReturnValue)) { HttpResponseMessage response = client.GetAsync(string.Format(Resource + "?usr={0}&companyID={1}&getBy=username", userName, companyID)).GetAwaiter().GetResult(); if (response.IsSuccessStatusCode) { items = response.Content.ReadAsAsync <UsersInRolesCollection>().GetAwaiter().GetResult(); } } HttpCache.Max(key, items); return(items); }
public static UsersInRolesCollection GetAllByUser(string CreatedUser) { UsersInRolesCollection items = new UsersInRolesCollection(); string key = String.Format(SETTINGS_User_KEY, CreatedUser); object obj2 = HttpCache.Get(key); if ((obj2 != null)) { return((UsersInRolesCollection)obj2); } using (var client = WebApiHelper.myclient(HouseEndpoint, SystemConst.APIJosonReturnValue)) { HttpResponseMessage response = client.GetAsync(string.Format(Resource + "/GetbyUser?usr={0}", CreatedUser)).GetAwaiter().GetResult(); if (response.IsSuccessStatusCode) { items = response.Content.ReadAsAsync <UsersInRolesCollection>().GetAwaiter().GetResult(); } } HttpCache.Max(key, items); return(items); }