Пример #1
0
        public async Task <Feedback> forgot(string tenant, string email)
        {
            Feedback feedback = new Feedback();

            try
            {
                AppNotification notification;
                notification = new AppNotification()
                {
                    type     = _userRepo.GetInstance(tenant).tableName,
                    message  = "Forgot Password Email Sending",
                    progress = 0
                };
                _notificationRepo.GetInstance(tenant).save(ref notification);
                _hubContext.Clients.All.SendAsync("SendNotification", notification);
                try
                {
                    var _userData = _userRepo.GetInstance(tenant).getByUserName(email);
                    if (_userData != null)
                    {
                        using (var transaction = DBServer.BeginTransaction())
                        {
                            _userData.otp = TokenGenerater.generateToken(7);
                            _userRepo.GetInstance(tenant).save(ref _userData, transaction);
                            //Email.Send(email, "Forgot Password", "Please reset your password:"******"Forgot password email sent sucessfully";
                            _notificationRepo.GetInstance(tenant).save(ref notification);
                            _hubContext.Clients.All.SendAsync("SendNotification", notification);
                            feedback = new Feedback
                            {
                                Code    = 1,
                                Message = "Forgot password email sent sucessfully",
                                data    = email
                            };
                        }
                    }
                }
                catch (Exception ex)
                {
                    notification.progress = -1;
                    notification.message  = "Got the error while sending reset password email";
                    _notificationRepo.GetInstance(tenant).save(ref notification);
                    _hubContext.Clients.All.SendAsync("SendNotification", notification);
                    feedback = new Feedback
                    {
                        Code    = 0,
                        Message = "Got the error while sending reset password email",
                        data    = ex
                    };
                    GitHub.createIssue(ex, new { tenant = tenant, data = email }, _accessor.HttpContext.Request.Headers);
                }
            }
            catch (Exception ex)
            {
                GitHub.createIssue(ex, new { tenant = tenant, data = email }, _accessor.HttpContext.Request.Headers);
            }
            return(feedback);
        }
Пример #2
0
        public Feedback saveAppUserAddOnConfig(string tenant, AppUserAddOnConfig data)
        {
            Feedback feedback = new Feedback();

            try
            {
                AppNotification notification;
                try
                {
                    using (var transaction = DBServer.BeginTransaction())
                    {
                        if (_userRepo.GetInstance(tenant).saveAppUserAddOnConfig(ref data, transaction))
                        {
                            transaction.Commit();
                            feedback = new Feedback
                            {
                                Code    = 1,
                                Message = "Data saved sucessfully",
                                data    = data
                            };
                        }
                        else
                        {
                            feedback = new Feedback
                            {
                                Code    = 1,
                                Message = "Data saved sucessfully",
                                data    = data
                            };
                        }
                    }
                }
                catch (Exception ex)
                {
                    feedback = new Feedback
                    {
                        Code    = 0,
                        Message = "Got the error while removing data",
                        data    = ex
                    };
                    GitHub.createIssue(ex, new { tenant = tenant, data = data }, _accessor.HttpContext.Request.Headers);
                }
            }
            catch (Exception ex)
            {
                GitHub.createIssue(ex, new { tenant = tenant, data = data }, _accessor.HttpContext.Request.Headers);
            }
            return(feedback);
        }
Пример #3
0
        public async Task <Feedback> save(string tenant, List <AppPermission> data)
        {
            Feedback feedback = new Feedback();

            try
            {
                AppNotification notification;
                if (data[0].notificationid == 0)
                {
                    notification = new AppNotification()
                    {
                        type     = _userRepo.GetInstance(tenant).tableName,
                        message  = "Saving data",
                        progress = 0
                    };
                    _notificationRepo.GetInstance(tenant).save(ref notification);
                    _hubContext.Clients.All.SendAsync("SendNotification", notification);
                }
                else
                {
                    notification = _notificationRepo.GetInstance(tenant).getById(data[0].notificationid);
                }
                try
                {
                    using (var transaction = DBServer.BeginTransaction())
                    {
                        if (data != null && data.Count > 0 && _permissionRepo.GetInstance(tenant).save(data, transaction))
                        {
                            transaction.Commit();
                            notification.progress = 1;
                            notification.message  = "Data saved sucessfully";
                            notification.recordId = data[0].appuserid;
                            _notificationRepo.GetInstance(tenant).save(ref notification);
                            _hubContext.Clients.All.SendAsync("SendNotification", notification);
                            feedback = new Feedback
                            {
                                Code    = 1,
                                Message = "Data saved sucessfully",
                                data    = null
                            };
                        }
                    }
                }
                catch (Exception ex)
                {
                    notification.progress = -1;
                    notification.message  = "Got the error while saving data";
                    _notificationRepo.GetInstance(tenant).save(ref notification);
                    _hubContext.Clients.All.SendAsync("SendNotification", notification);
                    feedback = new Feedback
                    {
                        Code    = 0,
                        Message = "Got the error while saving data",
                        data    = ex
                    };
                    GitHub.createIssue(ex, new { tenant = tenant, data = data }, _accessor.HttpContext.Request.Headers);
                }
            }
            catch (Exception ex)
            {
                GitHub.createIssue(ex, new { tenant = tenant, data = data }, _accessor.HttpContext.Request.Headers);
            }
            return(feedback);
        }
Пример #4
0
        public Feedback saveUser(string tenant, AppUserInfo data)
        {
            Feedback feedback = new Feedback();

            try
            {
                AppNotification notification;
                if (data.notificationid == 0)
                {
                    notification = new AppNotification()
                    {
                        type     = _userRepo.GetInstance(tenant).tableName,
                        message  = "Saving data",
                        progress = 0
                    };
                    _notificationRepo.GetInstance(tenant).save(ref notification);
                    _hubContext.Clients.All.SendAsync("SendNotification", notification);
                }
                else
                {
                    notification = _notificationRepo.GetInstance(tenant).getById(data.notificationid);
                }
                try
                {
                    using (var transaction = DBServer.BeginTransaction())
                    {
                        if (_userRepo.GetInstance(tenant).saveUser(ref data, transaction))
                        {
                            transaction.Commit();
                            notification.progress = 1;
                            notification.message  = "Data saved sucessfully for User: "******"SendNotification", notification);
                            feedback = new Feedback
                            {
                                Code    = 1,
                                Message = "Data saved sucessfully",
                                data    = data
                            };
                        }
                        else
                        {
                            transaction.Commit();
                            notification.progress = 1;
                            notification.message  = "Data saved sucessfully";
                            notification.recordId = data.USID;
                            _notificationRepo.GetInstance(tenant).save(ref notification);
                            _hubContext.Clients.All.SendAsync("SendNotification", notification);
                            feedback = new Feedback
                            {
                                Code    = 1,
                                Message = "Data saved sucessfully",
                                data    = data
                            };
                        }
                    }
                }
                catch (Exception ex)
                {
                    notification.progress = -1;
                    notification.message  = "Got the error while removing data";
                    _notificationRepo.GetInstance(tenant).save(ref notification);
                    _hubContext.Clients.All.SendAsync("SendNotification", notification);
                    feedback = new Feedback
                    {
                        Code    = 0,
                        Message = "Got the error while removing data",
                        data    = ex
                    };
                    GitHub.createIssue(ex, new { tenant = tenant, data = data }, _accessor.HttpContext.Request.Headers);
                }
            }
            catch (Exception ex)
            {
                GitHub.createIssue(ex, new { tenant = tenant, data = data }, _accessor.HttpContext.Request.Headers);
            }
            return(feedback);
        }