public async Task<string> NextPageBlock(string sourceId, string set, string qexpr, string prevlast)
 {
     JavaScriptSerializer jser = new JavaScriptSerializer();
     dynamic sobj = jser.DeserializeObject(set) as dynamic;
     EntitySetType type;
     if (Enum.TryParse<EntitySetType>(sobj["set"], out type))
     {
         switch (type)
         {
             case EntitySetType.User:
                 {
                     DataContractJsonSerializer ser1 = new DataContractJsonSerializer(typeof(QueryExpresion));
                     DataContractJsonSerializer ser2 = new DataContractJsonSerializer(typeof(User));
                     DataContractJsonSerializer ser3 = new DataContractJsonSerializer(typeof(UserPageBlock));
                     System.IO.MemoryStream strm = new System.IO.MemoryStream();
                     byte[] sbf = System.Text.Encoding.UTF8.GetBytes(qexpr);
                     strm.Write(sbf, 0, sbf.Length);
                     strm.Position = 0;
                     var _qexpr = ser1.ReadObject(strm) as QueryExpresion;
                     UserServiceProxy svc = new UserServiceProxy();
                     UserSet _set = new UserSet();
                     _set.PageBlockSize = int.Parse(sobj["pageBlockSize"]);
                     _set.PageSize_ = int.Parse(sobj["pageSize"]);
                     if (sobj.ContainsKey("setFilter"))
                         _set.SetFilter = sobj["setFilter"];
                     User _prevlast = null;
                     if (!string.IsNullOrEmpty(prevlast))
                     {
                         strm = new System.IO.MemoryStream();
                         sbf = System.Text.Encoding.UTF8.GetBytes(prevlast);
                         strm.Write(sbf, 0, sbf.Length);
                         strm.Position = 0;
                         _prevlast = ser2.ReadObject(strm) as User;
                     }
                     var result = await svc.NextPageBlockAsync(ApplicationContext.ClientContext, _set, _qexpr, _prevlast);
                     strm = new System.IO.MemoryStream();
                     ser3.WriteObject(strm, result);
                     string json = System.Text.Encoding.UTF8.GetString(strm.ToArray());
                     return json;
                 }
             case EntitySetType.Role:
                 {
                     DataContractJsonSerializer ser1 = new DataContractJsonSerializer(typeof(QueryExpresion));
                     DataContractJsonSerializer ser2 = new DataContractJsonSerializer(typeof(Role));
                     DataContractJsonSerializer ser3 = new DataContractJsonSerializer(typeof(RolePageBlock));
                     System.IO.MemoryStream strm = new System.IO.MemoryStream();
                     byte[] sbf = System.Text.Encoding.UTF8.GetBytes(qexpr);
                     strm.Write(sbf, 0, sbf.Length);
                     strm.Position = 0;
                     var _qexpr = ser1.ReadObject(strm) as QueryExpresion;
                     RoleServiceProxy svc = new RoleServiceProxy();
                     RoleSet _set = new RoleSet();
                     _set.PageBlockSize = int.Parse(sobj["pageBlockSize"]);
                     _set.PageSize_ = int.Parse(sobj["pageSize"]);
                     if (sobj.ContainsKey("setFilter"))
                         _set.SetFilter = sobj["setFilter"];
                     Role _prevlast = null;
                     if (!string.IsNullOrEmpty(prevlast))
                     {
                         strm = new System.IO.MemoryStream();
                         sbf = System.Text.Encoding.UTF8.GetBytes(prevlast);
                         strm.Write(sbf, 0, sbf.Length);
                         strm.Position = 0;
                         _prevlast = ser2.ReadObject(strm) as Role;
                     }
                     var result = await svc.NextPageBlockAsync(ApplicationContext.ClientContext, _set, _qexpr, _prevlast);
                     strm = new System.IO.MemoryStream();
                     ser3.WriteObject(strm, result);
                     string json = System.Text.Encoding.UTF8.GetString(strm.ToArray());
                     return json;
                 }
             case EntitySetType.MemberNotification:
                 {
                     DataContractJsonSerializer ser1 = new DataContractJsonSerializer(typeof(QueryExpresion));
                     DataContractJsonSerializer ser2 = new DataContractJsonSerializer(typeof(MemberNotification));
                     DataContractJsonSerializer ser3 = new DataContractJsonSerializer(typeof(MemberNotificationPageBlock));
                     System.IO.MemoryStream strm = new System.IO.MemoryStream();
                     byte[] sbf = System.Text.Encoding.UTF8.GetBytes(qexpr);
                     strm.Write(sbf, 0, sbf.Length);
                     strm.Position = 0;
                     var _qexpr = ser1.ReadObject(strm) as QueryExpresion;
                     MemberNotificationServiceProxy svc = new MemberNotificationServiceProxy();
                     MemberNotificationSet _set = new MemberNotificationSet();
                     _set.PageBlockSize = int.Parse(sobj["pageBlockSize"]);
                     _set.PageSize_ = int.Parse(sobj["pageSize"]);
                     if (sobj.ContainsKey("setFilter"))
                         _set.SetFilter = sobj["setFilter"];
                     MemberNotification _prevlast = null;
                     if (!string.IsNullOrEmpty(prevlast))
                     {
                         strm = new System.IO.MemoryStream();
                         sbf = System.Text.Encoding.UTF8.GetBytes(prevlast);
                         strm.Write(sbf, 0, sbf.Length);
                         strm.Position = 0;
                         _prevlast = ser2.ReadObject(strm) as MemberNotification;
                     }
                     var result = await svc.NextPageBlockAsync(ApplicationContext.ClientContext, _set, _qexpr, _prevlast);
                     strm = new System.IO.MemoryStream();
                     ser3.WriteObject(strm, result);
                     string json = System.Text.Encoding.UTF8.GetString(strm.ToArray());
                     return json;
                 }
             case EntitySetType.ShortMessage:
                 {
                     DataContractJsonSerializer ser1 = new DataContractJsonSerializer(typeof(QueryExpresion));
                     DataContractJsonSerializer ser2 = new DataContractJsonSerializer(typeof(ShortMessage));
                     DataContractJsonSerializer ser3 = new DataContractJsonSerializer(typeof(ShortMessagePageBlock));
                     System.IO.MemoryStream strm = new System.IO.MemoryStream();
                     byte[] sbf = System.Text.Encoding.UTF8.GetBytes(qexpr);
                     strm.Write(sbf, 0, sbf.Length);
                     strm.Position = 0;
                     var _qexpr = ser1.ReadObject(strm) as QueryExpresion;
                     var svc = new ShortMessageServiceProxy();
                     var _set = new ShortMessageSet();
                     _set.PageBlockSize = int.Parse(sobj["pageBlockSize"]);
                     _set.PageSize_ = int.Parse(sobj["pageSize"]);
                     if (!sobj.ContainsKey("setFilter"))
                         throw new Exception("The page is not properly parameterized!");
                     else
                     {
                         Func<string, string, int> count = (s, p) =>
                         {
                             int _cnt = 0;
                             int i = 0;
                             while ((i = s.IndexOf(p, i)) != -1)
                             {
                                 _cnt++;
                                 i += p.Length;
                             }
                             return _cnt;
                         };
                         string filter = sobj["setFilter"];
                         if (filter.Contains("ToID is null") && filter.Contains("___usergroups___") && count(filter, "||") == 0)
                         {
                             string[] mbgrpIds = await GroupChatViewContext.UserGroupChatMembers(System.Web.HttpContext.Current.User.Identity.GetUserId());
                             if (mbgrpIds == null || mbgrpIds.Length == 0)
                                 throw new Exception(ResourceUtils.GetString("234038e6185f013e25d0213c06f5a0e9", "You are not a member of any chat group."));
                             string groupexpr = "";
                             foreach (var gid in mbgrpIds)
                                 groupexpr += (groupexpr != "" ? " || " : "") + "GroupID == \"" + gid + "\"";
                             _set.SetFilter = filter.Replace("___usergroups___", groupexpr);
                         }
                         else if (filter.EndsWith("&& ToID is not null && GroupID is null && ( ToID == \"{0}\" || FromID == \"{0}\" )") && count(filter, "||") == 1)
                         {
                             filter = string.Format(filter, System.Web.HttpContext.Current.User.Identity.GetUserId());
                             _set.SetFilter = filter;
                         }
                         else
                             throw new Exception("The page is not properly parameterized!");
                     }
                     ShortMessage _prevlast = null;
                     if (!string.IsNullOrEmpty(prevlast))
                     {
                         strm = new System.IO.MemoryStream();
                         sbf = System.Text.Encoding.UTF8.GetBytes(prevlast);
                         strm.Write(sbf, 0, sbf.Length);
                         strm.Position = 0;
                         _prevlast = ser2.ReadObject(strm) as ShortMessage;
                     }
                     var result = await svc.NextPageBlockAsync(ApplicationContext.ClientContext, _set, _qexpr, _prevlast);
                     strm = new System.IO.MemoryStream();
                     ser3.WriteObject(strm, result);
                     string json = System.Text.Encoding.UTF8.GetString(strm.ToArray());
                     return json;
                 }
         }
     }
     return null;
 }
예제 #2
0
        public async Task <string> NextPageBlock(string sourceId, string set, string qexpr, string prevlast)
        {
            JavaScriptSerializer jser = new JavaScriptSerializer();
            dynamic       sobj        = jser.DeserializeObject(set) as dynamic;
            EntitySetType type;

            if (Enum.TryParse <EntitySetType>(sobj["set"], out type))
            {
                switch (type)
                {
                case EntitySetType.User:
                {
                    DataContractJsonSerializer ser1 = new DataContractJsonSerializer(typeof(QueryExpresion));
                    DataContractJsonSerializer ser2 = new DataContractJsonSerializer(typeof(User));
                    DataContractJsonSerializer ser3 = new DataContractJsonSerializer(typeof(UserPageBlock));
                    System.IO.MemoryStream     strm = new System.IO.MemoryStream();
                    byte[] sbf = System.Text.Encoding.UTF8.GetBytes(qexpr);
                    strm.Write(sbf, 0, sbf.Length);
                    strm.Position = 0;
                    var _qexpr            = ser1.ReadObject(strm) as QueryExpresion;
                    UserServiceProxy svc  = new UserServiceProxy();
                    UserSet          _set = new UserSet();
                    _set.PageBlockSize = int.Parse(sobj["pageBlockSize"]);
                    _set.PageSize_     = int.Parse(sobj["pageSize"]);
                    if (sobj.ContainsKey("setFilter"))
                    {
                        _set.SetFilter = sobj["setFilter"];
                    }
                    User _prevlast = null;
                    if (!string.IsNullOrEmpty(prevlast))
                    {
                        strm = new System.IO.MemoryStream();
                        sbf  = System.Text.Encoding.UTF8.GetBytes(prevlast);
                        strm.Write(sbf, 0, sbf.Length);
                        strm.Position = 0;
                        _prevlast     = ser2.ReadObject(strm) as User;
                    }
                    var result = await svc.NextPageBlockAsync(ApplicationContext.ClientContext, _set, _qexpr, _prevlast);

                    strm = new System.IO.MemoryStream();
                    ser3.WriteObject(strm, result);
                    string json = System.Text.Encoding.UTF8.GetString(strm.ToArray());
                    return(json);
                }

                case EntitySetType.Role:
                {
                    DataContractJsonSerializer ser1 = new DataContractJsonSerializer(typeof(QueryExpresion));
                    DataContractJsonSerializer ser2 = new DataContractJsonSerializer(typeof(Role));
                    DataContractJsonSerializer ser3 = new DataContractJsonSerializer(typeof(RolePageBlock));
                    System.IO.MemoryStream     strm = new System.IO.MemoryStream();
                    byte[] sbf = System.Text.Encoding.UTF8.GetBytes(qexpr);
                    strm.Write(sbf, 0, sbf.Length);
                    strm.Position = 0;
                    var _qexpr            = ser1.ReadObject(strm) as QueryExpresion;
                    RoleServiceProxy svc  = new RoleServiceProxy();
                    RoleSet          _set = new RoleSet();
                    _set.PageBlockSize = int.Parse(sobj["pageBlockSize"]);
                    _set.PageSize_     = int.Parse(sobj["pageSize"]);
                    if (sobj.ContainsKey("setFilter"))
                    {
                        _set.SetFilter = sobj["setFilter"];
                    }
                    Role _prevlast = null;
                    if (!string.IsNullOrEmpty(prevlast))
                    {
                        strm = new System.IO.MemoryStream();
                        sbf  = System.Text.Encoding.UTF8.GetBytes(prevlast);
                        strm.Write(sbf, 0, sbf.Length);
                        strm.Position = 0;
                        _prevlast     = ser2.ReadObject(strm) as Role;
                    }
                    var result = await svc.NextPageBlockAsync(ApplicationContext.ClientContext, _set, _qexpr, _prevlast);

                    strm = new System.IO.MemoryStream();
                    ser3.WriteObject(strm, result);
                    string json = System.Text.Encoding.UTF8.GetString(strm.ToArray());
                    return(json);
                }

                case EntitySetType.MemberNotification:
                {
                    DataContractJsonSerializer ser1 = new DataContractJsonSerializer(typeof(QueryExpresion));
                    DataContractJsonSerializer ser2 = new DataContractJsonSerializer(typeof(MemberNotification));
                    DataContractJsonSerializer ser3 = new DataContractJsonSerializer(typeof(MemberNotificationPageBlock));
                    System.IO.MemoryStream     strm = new System.IO.MemoryStream();
                    byte[] sbf = System.Text.Encoding.UTF8.GetBytes(qexpr);
                    strm.Write(sbf, 0, sbf.Length);
                    strm.Position = 0;
                    var _qexpr = ser1.ReadObject(strm) as QueryExpresion;
                    MemberNotificationServiceProxy svc  = new MemberNotificationServiceProxy();
                    MemberNotificationSet          _set = new MemberNotificationSet();
                    _set.PageBlockSize = int.Parse(sobj["pageBlockSize"]);
                    _set.PageSize_     = int.Parse(sobj["pageSize"]);
                    if (sobj.ContainsKey("setFilter"))
                    {
                        _set.SetFilter = sobj["setFilter"];
                    }
                    MemberNotification _prevlast = null;
                    if (!string.IsNullOrEmpty(prevlast))
                    {
                        strm = new System.IO.MemoryStream();
                        sbf  = System.Text.Encoding.UTF8.GetBytes(prevlast);
                        strm.Write(sbf, 0, sbf.Length);
                        strm.Position = 0;
                        _prevlast     = ser2.ReadObject(strm) as MemberNotification;
                    }
                    var result = await svc.NextPageBlockAsync(ApplicationContext.ClientContext, _set, _qexpr, _prevlast);

                    strm = new System.IO.MemoryStream();
                    ser3.WriteObject(strm, result);
                    string json = System.Text.Encoding.UTF8.GetString(strm.ToArray());
                    return(json);
                }

                case EntitySetType.ShortMessage:
                {
                    DataContractJsonSerializer ser1 = new DataContractJsonSerializer(typeof(QueryExpresion));
                    DataContractJsonSerializer ser2 = new DataContractJsonSerializer(typeof(ShortMessage));
                    DataContractJsonSerializer ser3 = new DataContractJsonSerializer(typeof(ShortMessagePageBlock));
                    System.IO.MemoryStream     strm = new System.IO.MemoryStream();
                    byte[] sbf = System.Text.Encoding.UTF8.GetBytes(qexpr);
                    strm.Write(sbf, 0, sbf.Length);
                    strm.Position = 0;
                    var _qexpr = ser1.ReadObject(strm) as QueryExpresion;
                    var svc    = new ShortMessageServiceProxy();
                    var _set   = new ShortMessageSet();
                    _set.PageBlockSize = int.Parse(sobj["pageBlockSize"]);
                    _set.PageSize_     = int.Parse(sobj["pageSize"]);
                    if (!sobj.ContainsKey("setFilter"))
                    {
                        throw new Exception("The page is not properly parameterized!");
                    }
                    else
                    {
                        Func <string, string, int> count = (s, p) =>
                        {
                            int _cnt = 0;
                            int i    = 0;
                            while ((i = s.IndexOf(p, i)) != -1)
                            {
                                _cnt++;
                                i += p.Length;
                            }
                            return(_cnt);
                        };
                        string filter = sobj["setFilter"];
                        if (filter.Contains("ToID is null") && filter.Contains("___usergroups___") && count(filter, "||") == 0)
                        {
                            string[] mbgrpIds = await GroupChatViewContext.UserGroupChatMembers(System.Web.HttpContext.Current.User.Identity.GetUserId());

                            if (mbgrpIds == null || mbgrpIds.Length == 0)
                            {
                                throw new Exception(ResourceUtils.GetString("234038e6185f013e25d0213c06f5a0e9", "You are not a member of any chat group."));
                            }
                            string groupexpr = "";
                            foreach (var gid in mbgrpIds)
                            {
                                groupexpr += (groupexpr != "" ? " || " : "") + "GroupID == \"" + gid + "\"";
                            }
                            _set.SetFilter = filter.Replace("___usergroups___", groupexpr);
                        }
                        else if (filter.EndsWith("&& ToID is not null && GroupID is null && ( ToID == \"{0}\" || FromID == \"{0}\" )") && count(filter, "||") == 1)
                        {
                            filter         = string.Format(filter, System.Web.HttpContext.Current.User.Identity.GetUserId());
                            _set.SetFilter = filter;
                        }
                        else
                        {
                            throw new Exception("The page is not properly parameterized!");
                        }
                    }
                    ShortMessage _prevlast = null;
                    if (!string.IsNullOrEmpty(prevlast))
                    {
                        strm = new System.IO.MemoryStream();
                        sbf  = System.Text.Encoding.UTF8.GetBytes(prevlast);
                        strm.Write(sbf, 0, sbf.Length);
                        strm.Position = 0;
                        _prevlast     = ser2.ReadObject(strm) as ShortMessage;
                    }
                    var result = await svc.NextPageBlockAsync(ApplicationContext.ClientContext, _set, _qexpr, _prevlast);

                    strm = new System.IO.MemoryStream();
                    ser3.WriteObject(strm, result);
                    string json = System.Text.Encoding.UTF8.GetString(strm.ToArray());
                    return(json);
                }
                }
            }
            return(null);
        }
 public async Task<string> NextPageBlock(string sourceId, string set, string qexpr, string prevlast)
 {
     JavaScriptSerializer jser = new JavaScriptSerializer();
     dynamic sobj = jser.DeserializeObject(set) as dynamic;
     EntitySetType type;
     if (Enum.TryParse<EntitySetType>(sobj["set"], out type))
     {
         switch (type)
         {
             case EntitySetType.User:
                 {
                     DataContractJsonSerializer ser1 = new DataContractJsonSerializer(typeof(QueryExpresion));
                     DataContractJsonSerializer ser2 = new DataContractJsonSerializer(typeof(User));
                     DataContractJsonSerializer ser3 = new DataContractJsonSerializer(typeof(UserPageBlock));
                     System.IO.MemoryStream strm = new System.IO.MemoryStream();
                     byte[] sbf = System.Text.Encoding.UTF8.GetBytes(qexpr);
                     strm.Write(sbf, 0, sbf.Length);
                     strm.Position = 0;
                     var _qexpr = ser1.ReadObject(strm) as QueryExpresion;
                     UserServiceProxy svc = new UserServiceProxy();
                     UserSet _set = new UserSet();
                     _set.PageBlockSize = int.Parse(sobj["pageBlockSize"]);
                     _set.PageSize_ = int.Parse(sobj["pageSize"]);
                     if (sobj.ContainsKey("setFilter"))
                         _set.SetFilter = sobj["setFilter"];
                     User _prevlast = null;
                     if (!string.IsNullOrEmpty(prevlast))
                     {
                         strm = new System.IO.MemoryStream();
                         sbf = System.Text.Encoding.UTF8.GetBytes(prevlast);
                         strm.Write(sbf, 0, sbf.Length);
                         strm.Position = 0;
                         _prevlast = ser2.ReadObject(strm) as User;
                     }
                     var result = await svc.NextPageBlockAsync(ApplicationContext.ClientContext, _set, _qexpr, _prevlast);
                     strm = new System.IO.MemoryStream();
                     ser3.WriteObject(strm, result);
                     string json = System.Text.Encoding.UTF8.GetString(strm.ToArray());
                     return json;
                 }
             case EntitySetType.Role:
                 {
                     DataContractJsonSerializer ser1 = new DataContractJsonSerializer(typeof(QueryExpresion));
                     DataContractJsonSerializer ser2 = new DataContractJsonSerializer(typeof(Role));
                     DataContractJsonSerializer ser3 = new DataContractJsonSerializer(typeof(RolePageBlock));
                     System.IO.MemoryStream strm = new System.IO.MemoryStream();
                     byte[] sbf = System.Text.Encoding.UTF8.GetBytes(qexpr);
                     strm.Write(sbf, 0, sbf.Length);
                     strm.Position = 0;
                     var _qexpr = ser1.ReadObject(strm) as QueryExpresion;
                     RoleServiceProxy svc = new RoleServiceProxy();
                     RoleSet _set = new RoleSet();
                     _set.PageBlockSize = int.Parse(sobj["pageBlockSize"]);
                     _set.PageSize_ = int.Parse(sobj["pageSize"]);
                     if (sobj.ContainsKey("setFilter"))
                         _set.SetFilter = sobj["setFilter"];
                     Role _prevlast = null;
                     if (!string.IsNullOrEmpty(prevlast))
                     {
                         strm = new System.IO.MemoryStream();
                         sbf = System.Text.Encoding.UTF8.GetBytes(prevlast);
                         strm.Write(sbf, 0, sbf.Length);
                         strm.Position = 0;
                         _prevlast = ser2.ReadObject(strm) as Role;
                     }
                     var result = await svc.NextPageBlockAsync(ApplicationContext.ClientContext, _set, _qexpr, _prevlast);
                     strm = new System.IO.MemoryStream();
                     ser3.WriteObject(strm, result);
                     string json = System.Text.Encoding.UTF8.GetString(strm.ToArray());
                     return json;
                 }
             case EntitySetType.MemberNotification:
                 {
                     DataContractJsonSerializer ser1 = new DataContractJsonSerializer(typeof(QueryExpresion));
                     DataContractJsonSerializer ser2 = new DataContractJsonSerializer(typeof(MemberNotification));
                     DataContractJsonSerializer ser3 = new DataContractJsonSerializer(typeof(MemberNotificationPageBlock));
                     System.IO.MemoryStream strm = new System.IO.MemoryStream();
                     byte[] sbf = System.Text.Encoding.UTF8.GetBytes(qexpr);
                     strm.Write(sbf, 0, sbf.Length);
                     strm.Position = 0;
                     var _qexpr = ser1.ReadObject(strm) as QueryExpresion;
                     MemberNotificationServiceProxy svc = new MemberNotificationServiceProxy();
                     MemberNotificationSet _set = new MemberNotificationSet();
                     _set.PageBlockSize = int.Parse(sobj["pageBlockSize"]);
                     _set.PageSize_ = int.Parse(sobj["pageSize"]);
                     if (sobj.ContainsKey("setFilter"))
                         _set.SetFilter = sobj["setFilter"];
                     MemberNotification _prevlast = null;
                     if (!string.IsNullOrEmpty(prevlast))
                     {
                         strm = new System.IO.MemoryStream();
                         sbf = System.Text.Encoding.UTF8.GetBytes(prevlast);
                         strm.Write(sbf, 0, sbf.Length);
                         strm.Position = 0;
                         _prevlast = ser2.ReadObject(strm) as MemberNotification;
                     }
                     var result = await svc.NextPageBlockAsync(ApplicationContext.ClientContext, _set, _qexpr, _prevlast);
                     strm = new System.IO.MemoryStream();
                     ser3.WriteObject(strm, result);
                     string json = System.Text.Encoding.UTF8.GetString(strm.ToArray());
                     return json;
                 }
         }
     }
     return null;
 }
예제 #4
0
        public async Task <string> NextPageBlock(string sourceId, string set, string qexpr, string prevlast)
        {
            JavaScriptSerializer jser = new JavaScriptSerializer();
            dynamic       sobj        = jser.DeserializeObject(set) as dynamic;
            EntitySetType type;

            if (Enum.TryParse <EntitySetType>(sobj["set"], out type))
            {
                switch (type)
                {
                case EntitySetType.User:
                {
                    DataContractJsonSerializer ser1 = new DataContractJsonSerializer(typeof(QueryExpresion));
                    DataContractJsonSerializer ser2 = new DataContractJsonSerializer(typeof(User));
                    DataContractJsonSerializer ser3 = new DataContractJsonSerializer(typeof(UserPageBlock));
                    System.IO.MemoryStream     strm = new System.IO.MemoryStream();
                    byte[] sbf = System.Text.Encoding.UTF8.GetBytes(qexpr);
                    strm.Write(sbf, 0, sbf.Length);
                    strm.Position = 0;
                    var _qexpr            = ser1.ReadObject(strm) as QueryExpresion;
                    UserServiceProxy svc  = new UserServiceProxy();
                    UserSet          _set = new UserSet();
                    _set.PageBlockSize = int.Parse(sobj["pageBlockSize"]);
                    _set.PageSize_     = int.Parse(sobj["pageSize"]);
                    if (sobj.ContainsKey("setFilter"))
                    {
                        _set.SetFilter = sobj["setFilter"];
                    }
                    User _prevlast = null;
                    if (!string.IsNullOrEmpty(prevlast))
                    {
                        strm = new System.IO.MemoryStream();
                        sbf  = System.Text.Encoding.UTF8.GetBytes(prevlast);
                        strm.Write(sbf, 0, sbf.Length);
                        strm.Position = 0;
                        _prevlast     = ser2.ReadObject(strm) as User;
                    }
                    var result = await svc.NextPageBlockAsync(ApplicationContext.ClientContext, _set, _qexpr, _prevlast);

                    strm = new System.IO.MemoryStream();
                    ser3.WriteObject(strm, result);
                    string json = System.Text.Encoding.UTF8.GetString(strm.ToArray());
                    return(json);
                }

                case EntitySetType.Role:
                {
                    DataContractJsonSerializer ser1 = new DataContractJsonSerializer(typeof(QueryExpresion));
                    DataContractJsonSerializer ser2 = new DataContractJsonSerializer(typeof(Role));
                    DataContractJsonSerializer ser3 = new DataContractJsonSerializer(typeof(RolePageBlock));
                    System.IO.MemoryStream     strm = new System.IO.MemoryStream();
                    byte[] sbf = System.Text.Encoding.UTF8.GetBytes(qexpr);
                    strm.Write(sbf, 0, sbf.Length);
                    strm.Position = 0;
                    var _qexpr            = ser1.ReadObject(strm) as QueryExpresion;
                    RoleServiceProxy svc  = new RoleServiceProxy();
                    RoleSet          _set = new RoleSet();
                    _set.PageBlockSize = int.Parse(sobj["pageBlockSize"]);
                    _set.PageSize_     = int.Parse(sobj["pageSize"]);
                    if (sobj.ContainsKey("setFilter"))
                    {
                        _set.SetFilter = sobj["setFilter"];
                    }
                    Role _prevlast = null;
                    if (!string.IsNullOrEmpty(prevlast))
                    {
                        strm = new System.IO.MemoryStream();
                        sbf  = System.Text.Encoding.UTF8.GetBytes(prevlast);
                        strm.Write(sbf, 0, sbf.Length);
                        strm.Position = 0;
                        _prevlast     = ser2.ReadObject(strm) as Role;
                    }
                    var result = await svc.NextPageBlockAsync(ApplicationContext.ClientContext, _set, _qexpr, _prevlast);

                    strm = new System.IO.MemoryStream();
                    ser3.WriteObject(strm, result);
                    string json = System.Text.Encoding.UTF8.GetString(strm.ToArray());
                    return(json);
                }

                case EntitySetType.MemberNotification:
                {
                    DataContractJsonSerializer ser1 = new DataContractJsonSerializer(typeof(QueryExpresion));
                    DataContractJsonSerializer ser2 = new DataContractJsonSerializer(typeof(MemberNotification));
                    DataContractJsonSerializer ser3 = new DataContractJsonSerializer(typeof(MemberNotificationPageBlock));
                    System.IO.MemoryStream     strm = new System.IO.MemoryStream();
                    byte[] sbf = System.Text.Encoding.UTF8.GetBytes(qexpr);
                    strm.Write(sbf, 0, sbf.Length);
                    strm.Position = 0;
                    var _qexpr = ser1.ReadObject(strm) as QueryExpresion;
                    MemberNotificationServiceProxy svc  = new MemberNotificationServiceProxy();
                    MemberNotificationSet          _set = new MemberNotificationSet();
                    _set.PageBlockSize = int.Parse(sobj["pageBlockSize"]);
                    _set.PageSize_     = int.Parse(sobj["pageSize"]);
                    if (sobj.ContainsKey("setFilter"))
                    {
                        _set.SetFilter = sobj["setFilter"];
                    }
                    MemberNotification _prevlast = null;
                    if (!string.IsNullOrEmpty(prevlast))
                    {
                        strm = new System.IO.MemoryStream();
                        sbf  = System.Text.Encoding.UTF8.GetBytes(prevlast);
                        strm.Write(sbf, 0, sbf.Length);
                        strm.Position = 0;
                        _prevlast     = ser2.ReadObject(strm) as MemberNotification;
                    }
                    var result = await svc.NextPageBlockAsync(ApplicationContext.ClientContext, _set, _qexpr, _prevlast);

                    strm = new System.IO.MemoryStream();
                    ser3.WriteObject(strm, result);
                    string json = System.Text.Encoding.UTF8.GetString(strm.ToArray());
                    return(json);
                }
                }
            }
            return(null);
        }