コード例 #1
0
 public async Task<string> GetNextFilterOps(string sourceId, string set, string qexpr)
 {
     EntitySetType type;
     if (Enum.TryParse<EntitySetType>(set, out type))
     {
         switch (type)
         {
             case EntitySetType.User:
                 {
                     DataContractJsonSerializer ser1 = new DataContractJsonSerializer(typeof(QueryExpresion));
                     DataContractJsonSerializer ser2 = new DataContractJsonSerializer(typeof(TokenOptions));
                     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();
                     var result = await svc.GetNextFilterOpsAsync(ApplicationContext.ClientContext, _qexpr, "");
                     strm = new System.IO.MemoryStream();
                     ser2.WriteObject(strm, result);
                     string json = System.Text.Encoding.UTF8.GetString(strm.ToArray());
                     return json;
                 }
             case EntitySetType.Role:
                 {
                     var ser1 = new DataContractJsonSerializer(typeof(QueryExpresion));
                     var ser2 = new DataContractJsonSerializer(typeof(TokenOptions));
                     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();
                     var result = await svc.GetNextFilterOpsAsync(ApplicationContext.ClientContext, _qexpr, "");
                     strm = new System.IO.MemoryStream();
                     ser2.WriteObject(strm, result);
                     string json = System.Text.Encoding.UTF8.GetString(strm.ToArray());
                     return json;
                 }
             case EntitySetType.MemberNotification:
                 {
                     var ser1 = new DataContractJsonSerializer(typeof(QueryExpresion));
                     var ser2 = new DataContractJsonSerializer(typeof(TokenOptions));
                     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();
                     var result = await svc.GetNextFilterOpsAsync(ApplicationContext.ClientContext, _qexpr, "");
                     strm = new System.IO.MemoryStream();
                     ser2.WriteObject(strm, result);
                     string json = System.Text.Encoding.UTF8.GetString(strm.ToArray());
                     return json;
                 }
             case EntitySetType.ShortMessage:
                 {
                     var ser1 = new DataContractJsonSerializer(typeof(QueryExpresion));
                     var ser2 = new DataContractJsonSerializer(typeof(TokenOptions));
                     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 result = await svc.GetNextFilterOpsAsync(ApplicationContext.ClientContext, _qexpr, "");
                     strm = new System.IO.MemoryStream();
                     ser2.WriteObject(strm, result);
                     string json = System.Text.Encoding.UTF8.GetString(strm.ToArray());
                     return json;
                 }
         }
     }
     return null;
 }
コード例 #2
0
        public async Task <string> GetNextFilterOps(string sourceId, string set, string qexpr)
        {
            EntitySetType type;

            if (Enum.TryParse <EntitySetType>(set, out type))
            {
                switch (type)
                {
                case EntitySetType.User:
                {
                    DataContractJsonSerializer ser1 = new DataContractJsonSerializer(typeof(QueryExpresion));
                    DataContractJsonSerializer ser2 = new DataContractJsonSerializer(typeof(TokenOptions));
                    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();
                    var result           = await svc.GetNextFilterOpsAsync(ApplicationContext.ClientContext, _qexpr, "");

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

                case EntitySetType.Role:
                {
                    var ser1 = new DataContractJsonSerializer(typeof(QueryExpresion));
                    var ser2 = new DataContractJsonSerializer(typeof(TokenOptions));
                    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();
                    var result           = await svc.GetNextFilterOpsAsync(ApplicationContext.ClientContext, _qexpr, "");

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

                case EntitySetType.MemberNotification:
                {
                    var ser1 = new DataContractJsonSerializer(typeof(QueryExpresion));
                    var ser2 = new DataContractJsonSerializer(typeof(TokenOptions));
                    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();
                    var result = await svc.GetNextFilterOpsAsync(ApplicationContext.ClientContext, _qexpr, "");

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

                case EntitySetType.ShortMessage:
                {
                    var ser1 = new DataContractJsonSerializer(typeof(QueryExpresion));
                    var ser2 = new DataContractJsonSerializer(typeof(TokenOptions));
                    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 result = await svc.GetNextFilterOpsAsync(ApplicationContext.ClientContext, _qexpr, "");

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