当前位置: 首页>>代码示例>>C#>>正文


C# UserRepository.GetPredicate方法代码示例

本文整理汇总了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);
        }
开发者ID:Stimulant-Software,项目名称:HarvestSelect,代码行数:41,代码来源:UserController.cs

示例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);
        }
开发者ID:Stimulant-Software,项目名称:HarvestSelect,代码行数:62,代码来源:UserController.cs


注:本文中的UserRepository.GetPredicate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。