Example #1
0
        public static List <Model.UserLoginToken> GetUserLoginToken(string ids = null, long userID = 0, string token = null, byte platformType = 0, bool?isDel = false)
        {
            using (var mainContext = new MainDbContext())
            {
                var where = PredicateExtensionses.True <Model.UserLoginToken>();

                if (!string.IsNullOrEmpty(ids))
                {
                    var tmpWhere = PredicateExtensionses.True <Model.UserLoginToken>();
                    var idsArray = ids.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (var item in idsArray)
                    {
                        var tempItem = ConvertHelper.GetLong(item, 0);
                        if (tempItem > 0)
                        {
                            tmpWhere = tmpWhere.Or(value => value.ID == tempItem);
                        }
                    }
                    where = where.And(tmpWhere);
                }

                if (userID > 0)
                {
                    where = where.And(item => item.UserID == userID);
                }

                if (!string.IsNullOrEmpty(token))
                {
                    where = where.And(item => item.Token == token);
                }

                if (platformType > 0)
                {
                    where = where.And(item => item.PlatformType == platformType);
                }

                if (isDel != null)
                {
                    where = where.And(item => item.IsDel == isDel);
                }

                return(mainContext.FindAll(where));
            }
        }
Example #2
0
        public static List <Model.UserInfo> GetList(string ids        = null, Guid?userGuid = null, string userName = null, string userPass = null,
                                                    string userMobile = null, bool?userMobileActive = null,
                                                    string userEmail  = null, bool?userEmailActive  = null,
                                                    byte userStatus   = 0,
                                                    byte platformType = 0,
                                                    bool?isDel        = false)
        {
            using (var mainContext = new MainDbContext())
            {
                var where = PredicateExtensionses.True <Model.UserInfo>();

                if (!string.IsNullOrEmpty(ids))
                {
                    var tmpWhere = PredicateExtensionses.True <Model.UserInfo>();
                    var idsArray = ids.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
                    foreach (var item in idsArray)
                    {
                        var tempItem = ConvertHelper.GetLong(item, 0);
                        if (tempItem > 0)
                        {
                            tmpWhere = tmpWhere.Or(value => value.ID == tempItem);
                        }
                    }
                    where = where.And(tmpWhere);
                }

                if (userGuid != null && userGuid != Guid.Empty)
                {
                    where = where.And(item => item.UserGuid == userGuid);
                }

                if (!string.IsNullOrEmpty(userName))
                {
                    where = where.And(item => item.UserName == userName);
                }

                if (!string.IsNullOrEmpty(userPass))
                {
                    where = where.And(item => item.UserPass == userPass);
                }

                if (!string.IsNullOrEmpty(userMobile))
                {
                    where = where.And(item => item.UserMobile == userMobile);
                }

                if (userMobileActive != null)
                {
                    where = where.And(item => item.UserMobileActive == userMobileActive);
                }

                if (!string.IsNullOrEmpty(userEmail))
                {
                    where = where.And(item => item.UserEmail == userEmail);
                }

                if (userEmailActive != null)
                {
                    where = where.And(item => item.UserEmailActive == userEmailActive);
                }

                if (userStatus > 0)
                {
                    where = where.And(item => item.UserStatus == userStatus);
                }

                if (platformType > 0)
                {
                    where = where.And(item => item.PlatformType == platformType);
                }

                if (isDel != null)
                {
                    where = where.And(item => item.IsDel == isDel);
                }

                return(mainContext.FindAll(where));
            }
        }