public virtual async Task<StatusData<string>> DeleteContact(SingleData<long> request, SystemSession session)
 {
     var serviceRequest = new UserContactDetails
     {
         ContactId = request.Data,
         UserId = session.UserId,
         Username = session.UserName,
         Mode = (byte)SystemDbStatus.Deleted
     };
     var response =
         await
             Task.Factory.StartNew(() => Client.UserService.upsertContacts(serviceRequest, session.GetSession()))
                 .ConfigureAwait(false);
     var data = new StatusData<string>
     {
         Status = (SystemDbStatus)response.Dbstatus.DbStatusCode,
         Message = response.Dbstatus.DbStatusMsg,
         SubStatus = response.Dbstatus.DbSubStatusCode
     };
     return data;
 }
 public virtual async Task<StatusData<string>> FlushContact(SingleData<GeneralKvPair<long, List<int>>> chatNetworks,
     SingleData<GeneralKvPair<long, List<long>>> customContacts, SystemSession session)
 {
     var serviceRequest = new UserContactDetails
     {
         ContactId = chatNetworks == null ? customContacts.Data.Id : chatNetworks.Data.Id,
         ContactChatNetworkId =
             chatNetworks == null ? DBNull.Value.ToString() : string.Join(",", chatNetworks.Data.Value),
         CustomContactsCustomIds =
             customContacts == null ? DBNull.Value.ToString() : string.Join(",", customContacts.Data.Value),
         UserId = session.UserId,
         Username = session.UserName,
         Mode = (byte)SystemDbStatus.Flushed
     };
     var response =
         await
             Task.Factory.StartNew(() => Client.UserService.upsertContacts(serviceRequest, session.GetSession()))
                 .ConfigureAwait(false);
     var data = new StatusData<string>
     {
         Status = (SystemDbStatus)response.Dbstatus.DbStatusCode,
         Message = response.Dbstatus.DbStatusMsg,
         SubStatus = response.Dbstatus.DbSubStatusCode
     };
     return data;
 }
        public virtual async Task<StatusData<string>> DeleteSuggestedContact(
            SingleData<GeneralKvPair<long, List<long>>> request, SystemSession session)
        {
            var serviceRequest = new UserContactDetails
            {
                ContactId = request.Data.Id,
                ContactCustomIds = string.Join(",", request.Data.Value),
                UserId = session.UserId,
                Username = session.UserName,
                Mode = (byte)SystemDbStatus.Deleted
            };

            var response =
                await
                    Task.Factory.StartNew(
                        () => Client.UserService.upsertSuggestContacts(0, serviceRequest, session.GetSession()))
                        .ConfigureAwait(false);
            var data = new StatusData<string>
            {
                Status = (SystemDbStatus)response.DbStatus.DbStatusCode,
                Message = response.DbStatus.DbStatusMsg,
                SubStatus = response.DbStatus.DbSubStatusCode
            };
            return data;
        }
        public virtual async Task<StatusData<ContactResponse>> UpdateContact(UpdateContactRequest request,
            SystemSession session)
        {
            var chatNetworks = string.Empty;
            if (request.ChatNetworks != null && request.ChatNetworks.Any())
            {
                var sb = new StringBuilder();
                foreach (var chatNetwork in request.ChatNetworks)
                    sb.Append(chatNetwork).Append("|");
                chatNetworks = sb.ToString().Substring(0, sb.Length - 1);
            }

            var customContacts = string.Empty;
            if (request.CustomContacts != null && request.CustomContacts.Any())
            {
                var sb = new StringBuilder();
                foreach (var customContact in request.CustomContacts)
                    sb.Append(customContact).Append("|");
                customContacts = sb.ToString().Substring(0, sb.Length - 1);
            }

            var serviceRequest = new UserContactDetails
            {
                ContactId = request.ContactId,
                StrChatNetWorks = chatNetworks,
                StrContactCustoms = customContacts,
                Address = request.Address,
                Email = request.Email,
                Fax = request.Fax,
                Mobile = request.Mobile,
                Phone = request.Phone,
                Website = request.Website,
                CompanyUserId =
                    (int)
                        (request.TemporaryContact != null && request.TemporaryContact.CompanyUserId != null
                            ? request.TemporaryContact.CompanyUserId
                            : 0),
                StartDate = request.TemporaryContact != null ? request.TemporaryContact.StartDate.ToString() : null,
                EndDate = (request.TemporaryContact != null) ? request.TemporaryContact.EndDate.ToString() : null,
                UserId = session.UserId,
                Username = session.UserName,
                Mode = (byte)SystemDbStatus.Updated
            };

            var response =
                await
                    Task.Factory.StartNew(() => Client.UserService.upsertContacts(serviceRequest, session.GetSession()))
                        .ConfigureAwait(false);

            var data = new StatusData<ContactResponse>
            {
                Status = (SystemDbStatus)response.Dbstatus.DbStatusCode,
                Message = response.Dbstatus.DbStatusMsg,
                SubStatus = response.Dbstatus.DbSubStatusCode
            };

            if (data.Status.IsOperationSuccessful())
            {
                data.Data = new ContactResponse
                {
                    ContactId = response.ContactId,
                    ContactChatNetworks =
                        response.ContactChatNetworkId != null
                            ? response.ContactChatNetworkId.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries)
                                .Select(x => Convert.ToInt32(x))
                                .ToList()
                            : null,
                    ContactCustoms =
                        response.CustomContactsCustomeIds != null
                            ? response.CustomContactsCustomeIds.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries)
                                .Select(x => Convert.ToInt64(x))
                                .ToList()
                            : null
                };
            }
            return data;
        }
Esempio n. 5
0
 public void send_upsertSuggestContacts(int targetId, UserContactDetails userContactDetails, Session session)
 #endif
 {
   oprot_.WriteMessageBegin(new TMessage("upsertSuggestContacts", TMessageType.Call, seqid_));
   upsertSuggestContacts_args args = new upsertSuggestContacts_args();
   args.TargetId = targetId;
   args.UserContactDetails = userContactDetails;
   args.Session = session;
   args.Write(oprot_);
   oprot_.WriteMessageEnd();
   #if SILVERLIGHT
   return oprot_.Transport.BeginFlush(callback, state);
   #else
   oprot_.Transport.Flush();
   #endif
 }
        public virtual async Task<StatusData<ContactResponse>> UpdateSuggestedContact(
            UpdateSuggestContactRequest request, SystemSession session)
        {
            var chatNetworks = string.Empty;
            if (request.ChatNetworks != null && request.ChatNetworks.Any())
            {
                var sb = new StringBuilder();
                foreach (var chatNetwork in request.ChatNetworks)
                    sb.Append(chatNetwork).Append("|");
                chatNetworks = sb.ToString().Substring(0, sb.Length - 1);
            }

            var customContacts = string.Empty;
            if (request.CustomContacts != null && request.CustomContacts.Any())
            {
                var sb = new StringBuilder();
                foreach (var customContact in request.CustomContacts)
                    sb.Append(customContact).Append("|");
                customContacts = sb.ToString().Substring(0, sb.Length - 1);
            }
            var serviceRequest = new UserContactDetails
            {
                StrChatNetWorks = chatNetworks,
                StrContactCustoms = customContacts,
                Address = request.Address,
                Email = request.Email,
                Fax = request.Fax,
                Mobile = request.Mobile,
                Phone = request.Phone,
                Website = request.Website,
                ContactId = request.ContactId,
                UserId = session.UserId,
                Username = session.UserName,
                Mode = (byte)SystemDbStatus.Updated
            };

            var response =
                await
                    Task.Factory.StartNew(
                        () =>
                            Client.UserService.upsertSuggestContacts(request.TargetUserId, serviceRequest,
                                session.GetSession())).ConfigureAwait(false);

            var result = new StatusData<ContactResponse>
            {
                Status = (SystemDbStatus)response.DbStatus.DbStatusCode,
                Message = response.DbStatus.DbStatusMsg,
                SubStatus = response.DbStatus.DbSubStatusCode
            };
            if (result.Status.IsOperationSuccessful())
            {
                result.Data = new ContactResponse
                {
                    ContactId = request.ContactId,
                    ContactCustoms =
                        string.IsNullOrWhiteSpace(response.CustomContactsCustomIds)
                            ? null
                            : response.CustomContactsCustomIds.Split(new[] { "," }, StringSplitOptions.None)
                                .Select(x => Convert.ToInt64(x))
                                .ToList(),
                    ContactChatNetworks =
                        string.IsNullOrWhiteSpace(response.ContactChatNetworkCustomIds)
                            ? null
                            : response.ContactChatNetworkCustomIds.Split(new[] { "," }, StringSplitOptions.None)
                                .Select(x => Convert.ToInt32(x))
                                .ToList()
                };
            }
            return result;
        }
Esempio n. 7
0
      public SuggestContactResponse upsertSuggestContacts(int targetId, UserContactDetails userContactDetails, Session session)
      {
        #if !SILVERLIGHT
        send_upsertSuggestContacts(targetId, userContactDetails, session);
        return recv_upsertSuggestContacts();

        #else
        var asyncResult = Begin_upsertSuggestContacts(null, null, targetId, userContactDetails, session);
        return End_upsertSuggestContacts(asyncResult);

        #endif
      }
Esempio n. 8
0
 public IAsyncResult send_upsertSuggestContacts(AsyncCallback callback, object state, int targetId, UserContactDetails userContactDetails, Session session)
Esempio n. 9
0
 public IAsyncResult Begin_upsertSuggestContacts(AsyncCallback callback, object state, int targetId, UserContactDetails userContactDetails, Session session)
 {
   return send_upsertSuggestContacts(callback, state, targetId, userContactDetails, session);
 }
Esempio n. 10
0
 public IAsyncResult send_upsertContacts(AsyncCallback callback, object state, UserContactDetails userContactDetails, Session session)
Esempio n. 11
0
      public UserContactDetailsResponse upsertContacts(UserContactDetails userContactDetails, Session session)
      {
        #if !SILVERLIGHT
        send_upsertContacts(userContactDetails, session);
        return recv_upsertContacts();

        #else
        var asyncResult = Begin_upsertContacts(null, null, userContactDetails, session);
        return End_upsertContacts(asyncResult);

        #endif
      }
Esempio n. 12
0
 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.I32) {
           TargetId = iprot.ReadI32();
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 2:
         if (field.Type == TType.Struct) {
           UserContactDetails = new UserContactDetails();
           UserContactDetails.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();
 }
Esempio n. 13
0
 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.List) {
           {
             Success = new List<UserContactDetails>();
             TList _list180 = iprot.ReadListBegin();
             for( int _i181 = 0; _i181 < _list180.Count; ++_i181)
             {
               UserContactDetails _elem182;
               _elem182 = new UserContactDetails();
               _elem182.Read(iprot);
               Success.Add(_elem182);
             }
             iprot.ReadListEnd();
           }
         } else { 
           TProtocolUtil.Skip(iprot, field.Type);
         }
         break;
       case 1:
         if (field.Type == TType.Struct) {
           Ex = new UserException();
           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();
 }