public MobileResponse <List <string> > Get()
 {
     return(MobileResponse <List <string> > .Create(MobileStatusCode.Success,
                                                    "", new List <string>() {
         SurePortalModules.BW.ToString()
     }));
 }
Exemplo n.º 2
0
        public async Task <IHttpActionResult> SendOtp()
        {
            var userSignatures = await _signatureServices.GetSignatureByUser(CurrentUser.Id);

            if (userSignatures == null || userSignatures.Count == 0)
            {
                return(Ok(MobileResponse <bool> .Create(MobileStatusCode.Error, null, false)));
            }
            // set otp
            var signature   = userSignatures[0];
            var sendOTPType = signature.SendOtpType;

            if (string.IsNullOrEmpty(sendOTPType))
            {
                return(Redirect("/Sure/SignServer/SendOtpSignature?signatureId=" + userSignatures[0].Id));
            }
            SignatureServerDto signServer = await _signatureServices.GetSignatureServerAysnc(signature.SignServerId);

            await _notificationServices.SendOtpAsync(new SendOtpInput()
            {
                DueDate     = DateTime.Now.AddHours(signServer.OtpInterval),
                Otp         = await _signatureServices.GenerateOtp(CurrentUser.Id),
                SendOtpType = sendOTPType,
                UserId      = CurrentUser.Id,
                Mobile      = CurrentUser.Mobile,
            });

            return(Ok(MobileResponse <bool> .Create(MobileStatusCode.Success, null, true)));
        }
        public async Task <MobileResponse <bool> > Read(UpdateNotificationInput input)
        {
            try
            {
                var result = await _notificationServices.UpdateReadStatusAsync(CurrentUser.Id, input.Ids, true);

                return(MobileResponse <bool> .Create(MobileStatusCode.Success, null, result));
            }
            catch (Exception ex)
            {
                _loggerServices.WriteError(ex.ToString());
                return(MobileResponse <bool> .Create(MobileStatusCode.Error, ex.ToString(), false));
            }
        }
Exemplo n.º 4
0
        public async Task <MobileResponse <string> > GetOtp()
        {
            try
            {
                var otp = await _signatureServices.GetOtpAsync(CurrentUser.Id);

                return(MobileResponse <string> .Create(MobileStatusCode.Success, null, otp));
            }
            catch (Exception ex)
            {
                _loggerServices.WriteError(ex.ToString());
                return(MobileResponse <string> .Create(MobileStatusCode.Error, ex.ToString(), null));
            }
        }
Exemplo n.º 5
0
        public async Task <MobileResponse <bool> > ValidOtp(string otp)
        {
            try
            {
                var isValid = await _signatureServices.IsOtpValid(CurrentUser.Id, otp);

                return(MobileResponse <bool> .Create(MobileStatusCode.Success, null, isValid));
            }
            catch (Exception ex)
            {
                _loggerServices.WriteError(ex.ToString());
                return(MobileResponse <bool> .Create(MobileStatusCode.Error, ex.ToString(), false));
            }
        }
Exemplo n.º 6
0
        public async Task <MobileResponse <List <UserSignatureInfo> > > GetUserSignatue()
        {
            try
            {
                var userSignatures = await _signatureServices.GetSignatureByUser(CurrentUser.Id);

                var models = _mapper.Map <List <UserSignatureInfo> >(userSignatures);
                return(MobileResponse <List <UserSignatureInfo> > .Create(MobileStatusCode.Success, null, models));
            }
            catch (Exception ex)
            {
                _loggerServices.WriteError(ex.ToString());
                return(MobileResponse <List <UserSignatureInfo> > .Create(MobileStatusCode.Error, ex.ToString(), null));
            }
        }
        public async Task <MobileResponse <IReadOnlyList <UserInfo> > > GetUsers()
        {
            try
            {
                var output = await _orgService.GetAllUserInfoAsync().ConfigureAwait(false);

                return(MobileResponse <IReadOnlyList <UserInfo> >
                       .Create(MobileStatusCode.Success, null, output));
            }
            catch (Exception ex)
            {
                _loggerServices.WriteError(ex.ToString());
                return(MobileResponse <IReadOnlyList <UserInfo> >
                       .Create(MobileStatusCode.Error, ex.ToString(), null));
            }
        }
        public async Task <MobileResponse <IReadOnlyList <NotificationDto> > > Search(NotificationActionTypes actionType,
                                                                                      string moduleCode)
        {
            try
            {
                var result = await _notificationServices.SearchListAsync(CurrentUser.Id, moduleCode, actionType);

                return(MobileResponse <IReadOnlyList <NotificationDto> >
                       .Create(MobileStatusCode.Success, null, result));
            }
            catch (Exception ex)
            {
                _loggerServices.WriteError(ex.ToString());
                return(MobileResponse <IReadOnlyList <NotificationDto> >
                       .Create(MobileStatusCode.Error, ex.ToString(), null));
            }
        }
        public async Task <MobileResponse <IReadOnlyList <NotificationDto> > > GetMessages()
        {
            try
            {
                var result = await _notificationServices
                             .GetMessagesAsync(CurrentUser.Id, NotificationActionTypes.Web);

                return(MobileResponse <IReadOnlyList <NotificationDto> >
                       .Create(MobileStatusCode.Success, null, result));
            }
            catch (Exception ex)
            {
                _loggerServices.WriteError(ex.ToString());
                return(MobileResponse <IReadOnlyList <NotificationDto> >
                       .Create(MobileStatusCode.Error, ex.ToString(), null));
            }
        }
        public async Task <MobileResponse <SendMessageResponse> > TestSyncDataFirebase(SurePortalModules module,
                                                                                       string body, string imageUrl, Guid?objectId)
        {
            try
            {
                var firebaseService = new FirebaseServices(_userDeviceServices, _loggerServices);
                var message         = SendMessageData.CreateSyncDataMessage(body, imageUrl, module, objectId);
                var result          = await firebaseService.SendMessageAsync(message, new List <Guid>() { CurrentUser.Id });

                return(MobileResponse <SendMessageResponse> .Create(MobileStatusCode.Success, null, result));
            }
            catch (Exception ex)
            {
                _loggerServices.WriteError(ex.ToString());
                return(MobileResponse <SendMessageResponse> .Create(MobileStatusCode.Error, ex.ToString(), null));
            }
        }