public async Task<StatusData<AccountInternal>> SignUpPerson(SignUpRequestPerson request) { var user = new User { UserName = request.UserName, Password = request.Password, Email = request.Email, // UsernameEmail = request.Email, UserInfoPerson = new UserInfoPerson { FirstName = request.FirstName, LastName = request.LastName, Gender = ((byte)request.Gender).ToString(), BirthDate = request.DateOfBirth.ToString("yyyy-MM-dd") }, UserInfo = new UserInfo { CountryCode = request.CountryCode } }; var result = new StatusData<AccountInternal> { Status = SystemDbStatus.Inserted }; var response = await Task.Factory.StartNew(() => Client.UserService.RegisterUser(user)).ConfigureAwait(false); result.Status = (SystemDbStatus)response.DbStatusCode; result.Data = new AccountInternal { UserGuid = response.UserGUID, UserId = Convert.ToInt32(response.UserId) }; result.Message = response.DbStatusMsg; return result; }
public async Task<StatusData<AccountInternal>> SignUpBusiness(SignUpRequestBusiness request) { var user = new User { UserName = request.UserName, Password = request.Password, Email = request.Email, UserInforCompany = new UserInfoCompany { Name = request.CompanyName, Date = request.EstablishedDate.ToString("yyyy-MM-dd"), OwnershipType = new OwnershipType { Id = request.OwnershipTypeId }, Industry = new Industry { IndustryId = request.CompanyType } }, UserInfo = new UserInfo { CountryCode = request.CountryCode, Url = request.CompanyUrl } }; var result = new StatusData<AccountInternal> { Status = SystemDbStatus.Inserted }; var response = await Task.Factory.StartNew(() => Client.UserService.RegisterBusinessUser(user)).ConfigureAwait(false); result.Status = (SystemDbStatus)response.DbStatusCode; result.Data = new AccountInternal { UserGuid = response.UserGUID, UserId = Convert.ToInt32(response.UserId) }; result.Message = response.DbStatusMsg; return result; }
public async Task<StatusData<LoginResponse>> Login(LoginRequest request) { var data = new StatusData<LoginResponse> { Status = SystemDbStatus.Selected, Data = new LoginResponse() }; var result = new StatusData<LoginResponse> { Status = SystemDbStatus.Selected }; var user = new User { UsernameEmail = request.UserName, Password = request.Password, DeviceId = request.DeviceId, Session = new Session { Replay = true, DeviceType = request.DeviceType, PushCode = request.PushCode, TransportIp = request.Ip, ModelName = request.ModelName } }; var response = await Task.Factory.StartNew(() => Client.UserService.Auth(user)).ConfigureAwait(false); data.Status = (SystemDbStatus)response.DbStatusCode; if (!data.Status.IsOperationSuccessful()) { //switch ((SystemAccountStatus)response.DbStatusCode) //{ // case SystemAccountStatus.UserNotExist: // case SystemAccountStatus.WrongPassword: // case SystemAccountStatus.NotYetApproved: // case SystemAccountStatus.Locked: // case SystemAccountStatus.Deactivated: // { // data.Status = SystemDbStatus.Unauthorized; // data.Data.LoginStatus = (SystemAccountStatus)response.DbStatusCode; // data.Message = response.DbStatusMsg; // return data; // } //} //data.Status = SystemDbStatus.Unauthorized; data.SubStatus = response.DbSubStatusCode; data.Message = response.DbStatusMsg; return data; } result.Data = new LoginResponse { UserId = Convert.ToInt32(response.UserId), UserName = response.UserName, UserTypeId = (response.UserInfoPerson == null ? SystemUserType.Business : SystemUserType.Person), Token = response.Session.SessionToken }; result.Data.AuthorizationToken = Convert.ToBase64String(Encoding.UTF8.GetBytes(string.Format("{0}:{1}:{2}:{3}:{4}:{5}", result.Data.UserId, result.Data.UserName, (byte)result.Data.UserTypeId, request.DeviceType, request.DeviceId, result.Data.Token))); return result; }
public async Task<string> GetPasswordResetCode(string userId, string userName) { var user = new User { UserName = userName, UserId = userId }; return await Task.Factory.StartNew(() => Client.UserService.forgotPasswordCode(user)).ConfigureAwait(false); }
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) { UserId = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.I32) { FieldId = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.I32) { ContactChatNetworkId = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.I32) { Value = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 5: if (field.Type == TType.I16) { Mode = iprot.ReadI16(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 6: if (field.Type == TType.I64) { ContactCustomId = iprot.ReadI64(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 7: if (field.Type == TType.I64) { ContactId = iprot.ReadI64(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 8: if (field.Type == TType.String) { EntriesInPage = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 9: if (field.Type == TType.String) { EntryList = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 10: if (field.Type == TType.Bool) { IsDefault = iprot.ReadBool(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 11: if (field.Type == TType.Bool) { IsBasicPrimary = iprot.ReadBool(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 12: if (field.Type == TType.Struct) { UserInfo = new UserInfo(); UserInfo.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 13: if (field.Type == TType.Struct) { UserInfoPerson = new UserInfoPerson(); UserInfoPerson.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 14: if (field.Type == TType.Struct) { User = new User(); User.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 15: if (field.Type == TType.Struct) { UserCategory = new UserCategory(); UserCategory.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); }
public void send_RegisterUser(User user) #endif { oprot_.WriteMessageBegin(new TMessage("RegisterUser", TMessageType.Call, seqid_)); RegisterUser_args args = new RegisterUser_args(); args.User = user; args.Write(oprot_); oprot_.WriteMessageEnd(); #if SILVERLIGHT return oprot_.Transport.BeginFlush(callback, state); #else oprot_.Transport.Flush(); #endif }
public IAsyncResult send_RegisterUser(AsyncCallback callback, object state, User user)
public IAsyncResult Begin_forgotPasswordCode(AsyncCallback callback, object state, User user) { return send_forgotPasswordCode(callback, state, user); }
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.List) { { Users = new List<User>(); TList _list132 = iprot.ReadListBegin(); for( int _i133 = 0; _i133 < _list132.Count; ++_i133) { User _elem134; _elem134 = new User(); _elem134.Read(iprot); Users.Add(_elem134); } iprot.ReadListEnd(); } } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.String) { Cursor = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.I32) { Limit = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.I64) { Count = iprot.ReadI64(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); }
public IAsyncResult Begin_RegisterUser(AsyncCallback callback, object state, User user) { return send_RegisterUser(callback, state, user); }
public IAsyncResult send_Auth(AsyncCallback callback, object state, User user)
/// <summary> /// Method for authentication i.e /// takes userName and password and checks for authentication /// @param User userObj /// @return User /// @throws UserException /// </summary> /// <param name="user"></param> public User Auth(User user) { #if !SILVERLIGHT send_Auth(user); return recv_Auth(); #else var asyncResult = Begin_Auth(null, null, user); return End_Auth(asyncResult); #endif }
public IAsyncResult Begin_Auth(AsyncCallback callback, object state, User user) { return send_Auth(callback, state, user); }
public void send_forgotPasswordCode(User user) #endif { oprot_.WriteMessageBegin(new TMessage("forgotPasswordCode", TMessageType.Call, seqid_)); forgotPasswordCode_args args = new forgotPasswordCode_args(); args.User = user; args.Write(oprot_); oprot_.WriteMessageEnd(); #if SILVERLIGHT return oprot_.Transport.BeginFlush(callback, state); #else oprot_.Transport.Flush(); #endif }
public IAsyncResult send_forgotPasswordCode(AsyncCallback callback, object state, User user)
public string forgotPasswordCode(User user) { #if !SILVERLIGHT send_forgotPasswordCode(user); return recv_forgotPasswordCode(); #else var asyncResult = Begin_forgotPasswordCode(null, null, user); return End_forgotPasswordCode(asyncResult); #endif }
/// <summary> /// calls stored procedure "PROC_USERLOGIN_CREATEPERSON" /// method for inserting user information into multiple table during registration /// @param User userObj /// Country country /// UserInfoPerson userInfoPerson /// @return User /// @throws UserException /// </summary> /// <param name="user"></param> public User RegisterUser(User user) { #if !SILVERLIGHT send_RegisterUser(user); return recv_RegisterUser(); #else var asyncResult = Begin_RegisterUser(null, null, user); return End_RegisterUser(asyncResult); #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 0: if (field.Type == TType.Struct) { Success = new User(); Success.Read(iprot); } 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; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); }
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.Struct) { UserInfo = new UserInfo(); UserInfo.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 2: if (field.Type == TType.Struct) { User = new User(); User.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 3: if (field.Type == TType.String) { AddedOn = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 4: if (field.Type == TType.Struct) { RelationshipType = new RelationShipType(); RelationshipType.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 5: if (field.Type == TType.Bool) { IsClose = iprot.ReadBool(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 6: if (field.Type == TType.Struct) { UserInfoPerson = new UserInfoPerson(); UserInfoPerson.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 7: if (field.Type == TType.Struct) { StatusType = new StatusType(); StatusType.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 8: if (field.Type == TType.Struct) { SettingPerson = new SettingPerson(); SettingPerson.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 9: if (field.Type == TType.Struct) { Country = new Country(); Country.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 10: if (field.Type == TType.Struct) { Industry = new Industry(); Industry.Read(iprot); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 11: if (field.Type == TType.Bool) { CanMessage = iprot.ReadBool(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 12: if (field.Type == TType.I32) { DbStatusCode = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 13: if (field.Type == TType.String) { CTag = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 14: if (field.Type == TType.I32) { FriendshipStatus = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 15: if (field.Type == TType.Bool) { FromPhoneBook = iprot.ReadBool(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 16: if (field.Type == TType.Bool) { ReceiveConnectionRequest = iprot.ReadBool(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 17: if (field.Type == TType.Bool) { AllowAddingChatGroup = iprot.ReadBool(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 18: if (field.Type == TType.Bool) { AllowMsgForword = iprot.ReadBool(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 19: if (field.Type == TType.I32) { DbSubStatusCode = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 20: if (field.Type == TType.String) { DbStatusMsg = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 21: if (field.Type == TType.I32) { RequestId = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 22: if (field.Type == TType.I32) { RequestTypeId = iprot.ReadI32(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; case 23: if (field.Type == TType.String) { LastUpdated = iprot.ReadString(); } else { TProtocolUtil.Skip(iprot, field.Type); } break; default: TProtocolUtil.Skip(iprot, field.Type); break; } iprot.ReadFieldEnd(); } iprot.ReadStructEnd(); }
/// <summary> /// @param User user /// Takes User object as parameter. Note that session object of User instance should be filled. /// Session object must contain field like user id, token and device id. Auto Reply can be set true if session /// should be removed from persistance. /// @return Boolean /// Takes User object and returns true if session was killed or false /// This method is used to kill the session /// @throws UserException (See Error Code list for details) /// </summary> /// <param name="user"></param> public bool Kill(User user) { #if !SILVERLIGHT send_Kill(user); return recv_Kill(); #else var asyncResult = Begin_Kill(null, null, user); return End_Kill(asyncResult); #endif }