예제 #1
0
 public async Task<StatusData<string>> GroupMemberApproveRejectRequest(ChatRequest.ApproveRejectGroupRequest request, SystemSession session)
 {
     var memberApproveRejectRequest = new ChatGroup { GroupId = request.GroupId, Mar = JsonConvert.SerializeObject(request.Mar, new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() }) };
     await Task.Factory.StartNew(() => Client.ChatGroupService.approveGroupRequestByAdmin(session.UserName, memberApproveRejectRequest, session.GetSession())).ConfigureAwait(false);
     var result = new StatusData<string> { Status = SystemDbStatus.Updated };
     return result;
 }
 public IAsyncResult Begin_approveGroupRequestByAdmin(AsyncCallback callback, object state, string userId, ChatGroup @group, Session session)
 {
   return send_approveGroupRequestByAdmin(callback, state, userId, @group, session);
 }
예제 #3
0
 public async Task<StatusData<string>> GroupAdd(ChatRequest.ChatGroupRequest request, SystemSession session)
 {
     var chatGroupObject = new ChatGroup
     {
         GroupName = request.GroupName,
         CreatedBy = session.UserName,
         CreatedDate = request.CreatedDate,
         Members = request.Members,
         // GroupSettings = request.GroupSettings//.Select(x => new ChatGroupSetting { Key = x.Key, Value = x.Value }).ToList()
         GroupSettings = "[{" + string.Join("}, {", request.GroupS.Select(x => string.Format("\"k\": \"{0}\", \"v\": \"{1}\"", x.K, x.V))) + "}]"
     };
     var response = await Task.Factory.StartNew(() => Client.ChatGroupService.addGroup(chatGroupObject, session.GetSession())).ConfigureAwait(false);
     var result = new StatusData<string> { Status = SystemDbStatus.Inserted, Data = response };
     return result;
 }
 public void send_addGroup(ChatGroup @group, Session session)
 #endif
 {
   oprot_.WriteMessageBegin(new TMessage("addGroup", TMessageType.Call, seqid_));
   addGroup_args args = new addGroup_args();
   args.Group = @group;
   args.Session = session;
   args.Write(oprot_);
   oprot_.WriteMessageEnd();
   #if SILVERLIGHT
   return oprot_.Transport.BeginFlush(callback, state);
   #else
   oprot_.Transport.Flush();
   #endif
 }
 public void Read (TProtocol iprot)
 {
   TField field;
   iprot.ReadStructBegin();
   while (true)
   {
     field = iprot.ReadFieldBegin();
     if (field.Type == TType.Stop) { 
       break;
     }
     switch (field.ID)
     {
       case 1:
         if (field.Type == TType.String) {
           UserId = iprot.ReadString();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 2:
         if (field.Type == TType.Struct) {
           Group = new ChatGroup();
           Group.Read(iprot);
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 3:
         if (field.Type == TType.Struct) {
           Session = new Session();
           Session.Read(iprot);
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
 }
      /// <summary>
      /// Inserts the group object into hBase
      /// where all the group fields except groupId are set into jsonObject which in turns is stringify
      /// and value is inserted into given column name
      /// @param ChatGroup group
      /// @param Session sessionObj
      /// @retutn String (Group Id)
      /// @throws ChatGroupException
      /// @throws SessionException
      /// </summary>
      /// <param name="group"></param>
      /// <param name="session"></param>
      public string addGroup(ChatGroup @group, Session session)
      {
        #if !SILVERLIGHT
        send_addGroup(@group, session);
        return recv_addGroup();

        #else
        var asyncResult = Begin_addGroup(null, null, @group, session);
        return End_addGroup(asyncResult);

        #endif
      }
 public IAsyncResult send_addGroup(AsyncCallback callback, object state, ChatGroup @group, Session session)
 public IAsyncResult Begin_addGroup(AsyncCallback callback, object state, ChatGroup @group, Session session)
 {
   return send_addGroup(callback, state, @group, session);
 }
 public void Read (TProtocol iprot)
 {
   TField field;
   iprot.ReadStructBegin();
   while (true)
   {
     field = iprot.ReadFieldBegin();
     if (field.Type == TType.Stop) { 
       break;
     }
     switch (field.ID)
     {
       case 0:
         if (field.Type == TType.Struct) {
           Success = new ChatGroup();
           Success.Read(iprot);
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 1:
         if (field.Type == TType.Struct) {
           Ex = new ChatGroupException();
           Ex.Read(iprot);
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 2:
         if (field.Type == TType.Struct) {
           Se = new SessionException();
           Se.Read(iprot);
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       default: 
         TProtocolUtil.Skip(iprot, field.Type);
         break;
     }
     iprot.ReadFieldEnd();
   }
   iprot.ReadStructEnd();
 }
예제 #10
0
 public void send_approveGroupRequestByAdmin(string userId, ChatGroup @group, Session session)
 #endif
 {
   oprot_.WriteMessageBegin(new TMessage("approveGroupRequestByAdmin", TMessageType.Call, seqid_));
   approveGroupRequestByAdmin_args args = new approveGroupRequestByAdmin_args();
   args.UserId = userId;
   args.Group = @group;
   args.Session = session;
   args.Write(oprot_);
   oprot_.WriteMessageEnd();
   #if SILVERLIGHT
   return oprot_.Transport.BeginFlush(callback, state);
   #else
   oprot_.Transport.Flush();
   #endif
 }
예제 #11
0
 public IAsyncResult send_approveGroupRequestByAdmin(AsyncCallback callback, object state, string userId, ChatGroup @group, Session session)
예제 #12
0
      /// <summary>
      /// Approves the pending request sent by other members
      /// i.e adds the user id to group member list and append approvedTimestamp into pendingList
      /// 
      /// @param String groupId
      /// @param Session sessionObj
      /// @throws ChatGroupException
      /// @throws SessionException
      /// </summary>
      /// <param name="userId"></param>
      /// <param name="group"></param>
      /// <param name="session"></param>
      public void approveGroupRequestByAdmin(string userId, ChatGroup @group, Session session)
      {
        #if !SILVERLIGHT
        send_approveGroupRequestByAdmin(userId, @group, session);
        recv_approveGroupRequestByAdmin();

        #else
        var asyncResult = Begin_approveGroupRequestByAdmin(null, null, userId, @group, session);
        End_approveGroupRequestByAdmin(asyncResult);

        #endif
      }