本文整理汇总了C#中UserRepository.GetPredicate方法的典型用法代码示例。如果您正苦于以下问题:C# UserRepository.GetPredicate方法的具体用法?C# UserRepository.GetPredicate怎么用?C# UserRepository.GetPredicate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UserRepository
的用法示例。
在下文中一共展示了UserRepository.GetPredicate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Users
internal HttpResponseMessage Users(HttpRequestMessage request, UserDTO cqDTO)
{
string key;
var aur = new AppUserRepository();
var companyId = 0;
var userId = aur.ValidateUser(cqDTO.Key, out key, ref companyId);
if (userId > 0)
{
var ur = new UserRepository();
var u = new User();
cqDTO.CompanyId = companyId.ToString();
var predicate = ur.GetPredicate(cqDTO, u, companyId);
var data = ur.GetByPredicate(predicate);
var col = new Collection<Dictionary<string, string>>();
foreach (var item in data)
{
var dic = new Dictionary<string, string>();
dic.Add("UserId", item.UserId.ToString());
dic.Add("FirstName", item.FirstName);
dic.Add("LastName", item.LastName);
dic.Add("EmailAddress", item.EmailAddress);
dic.Add("Phone", item.Phone);
dic.Add("StatusId", item.StatusId.ToString());
col.Add(dic);
var ufdic = new Dictionary<string, string>();
}
var retVal = new GenericDTO
{
Key = key,
ReturnData = col
};
return Request.CreateResponse(HttpStatusCode.OK, retVal);
}
var message = "validation failed";
return request.CreateResponse(HttpStatusCode.NotFound, message);
}
示例2: UserDetail
internal HttpResponseMessage UserDetail(HttpRequestMessage request, UserDTO cqDTO)
{
string key;
var aur = new AppUserRepository();
var companyId = 0;
var userId = aur.ValidateUser(cqDTO.Key, out key, ref companyId);
if (userId > 0)
{
var ur = new UserRepository();
var u = new User();
var predicate = ur.GetPredicate(cqDTO, u, companyId);
var data = ur.GetByPredicate(predicate);
var col = new Collection<Dictionary<string, string>>();
string ufarms = "";
string uroles = "";
foreach (var item in data)
{
var dic = new Dictionary<string, string>();
dic.Add("UserId", item.UserId.ToString());
dic.Add("FirstName", item.FirstName);
dic.Add("LastName", item.LastName);
dic.Add("EmailAddress", item.EmailAddress);
dic.Add("Phone", item.Phone);
dic.Add("StatusId", item.StatusId.ToString());
foreach (var farmitem in item.UserFarms)
{
ufarms = ufarms + farmitem.FarmId.ToString() + ",";
}
if (ufarms.Length > 0)
{
//ufarms = ufarms.Remove(uroles.Length - 1);
dic.Add("Farms", ufarms);
}
foreach (var roleitem in item.UserRoles)
{
uroles = uroles + roleitem.RoleId.ToString() + ",";
}
if (uroles.Length > 0)
{
//uroles = uroles.Remove(uroles.Length - 1) ;
dic.Add("Roles", uroles);
}
col.Add(dic);
}
var retVal = new GenericDTO
{
Key = key,
ReturnData = col
};
return Request.CreateResponse(HttpStatusCode.OK, retVal);
}
var message = "validation failed";
return request.CreateResponse(HttpStatusCode.NotFound, message);
}