Exemplo n.º 1
0
        public Messages <tblUser> GetByEmail(short permissions, string email)
        {
            var response = new Messages <tblUser>()
            {
                Status = false, Message = string.Empty, Data = new tblUser()
            };

            try
            {
                if (ADecentralize.Read(permissions))
                {
                    response.Data    = new AUser().GetByEmail(email);
                    response.Status  = true;
                    response.Message = response.Status ? "Get by user name successfully." : "Get by user name failed.";
                    return(response);
                }
                response.Message = "Limit permissions!";
                return(response);
            }
            catch (Exception ex)
            {
                FileHelper.WriteLine(Settings.Path, ex);
                response.Message = "Execution error!";
                return(response);
            }
        }
Exemplo n.º 2
0
        public Messages <tblUser> InsertAndUpdate(short permissions, tblUser user)
        {
            var response = new Messages <tblUser>()
            {
                Status = false, Message = string.Empty
            };

            try
            {
                if (ADecentralize.Read(permissions))
                {
                    response.Status = new AUser().InsertAndUpdate(user);
                    if (new AUser().GetById(user.Id) != null)
                    {
                        response.Message = response.Status ? "Update successfully." : "Update failed.";
                    }
                    else
                    {
                        response.Message = response.Status ? "Insert successfully." : "Insert failed.";
                    }
                    return(response);
                }
                response.Message = "Limit permissions!";
                return(response);
            }
            catch (Exception ex)
            {
                FileHelper.WriteLine(Settings.Path, ex);
                response.Message = "Execution error!";
                return(response);
            }
        }
Exemplo n.º 3
0
        public Messages <tblUser> GetByStatusPageList(short permissions, short status, int pageNumber, int pageSize)
        {
            var response = new Messages <tblUser>()
            {
                Status = false, Message = string.Empty
            };

            try
            {
                if (ADecentralize.Read(permissions))
                {
                    response.PagedList = new AUser().GetByStatusPageList(status, pageNumber, pageSize);
                    response.Status    = true;
                    response.Message   = response.Status ? "Get by status PageList successfully." : "Get by status page list failed.";
                    return(response);
                }
                response.Message = "Limit permissions!";
                return(response);
            }
            catch (Exception ex)
            {
                FileHelper.WriteLine(Settings.Path, ex);
                response.Message = "Execution error!";
                return(response);
            }
        }
Exemplo n.º 4
0
        public Messages <tblUser> IsUserName(short permissions, string userName)
        {
            var response = new Messages <tblUser>()
            {
                Status = false, Message = string.Empty
            };

            try
            {
                if (ADecentralize.Read(permissions))
                {
                    response.Status  = new AUser().IsUserName(userName);
                    response.Message = response.Status ? "Is user name successfully." : "Is user name failed.";
                    return(response);
                }
                response.Message = "Limit permissions!";
                return(response);
            }
            catch (Exception ex)
            {
                FileHelper.WriteLine(Settings.Path, ex);
                response.Message = "Execution error!";
                return(response);
            }
        }
Exemplo n.º 5
0
        public Messages <tblUser> GetByPaging(short permissions, int number, int pagingNumber)
        {
            var response = new Messages <tblUser>()
            {
                Status = false, Message = string.Empty, List = new List <tblUser>()
            };

            try
            {
                if (ADecentralize.Read(permissions))
                {
                    response.List    = new AUser().GetByPaging(number, pagingNumber);
                    response.Status  = true;
                    response.Message = response.Status ? "Get by paging successfully." : "Get by paging failed.";
                    return(response);
                }
                response.Message = "Limit permissions!";
                return(response);
            }
            catch (Exception ex)
            {
                FileHelper.WriteLine(Settings.Path, ex);
                response.Message = "Execution error!";
                return(response);
            }
        }
Exemplo n.º 6
0
        public Messages <tblUser> UpdatePassword(short permissions, int id, string password)
        {
            var response = new Messages <tblUser>()
            {
                Status = false, Message = string.Empty
            };

            try
            {
                if (ADecentralize.Read(permissions))
                {
                    response.Status  = new AUser().UpdatePassword(id, password);
                    response.Message = response.Status ? "Update password successfully." : "Update password failed.";
                    return(response);
                }
                response.Message = "Limit permissions!";
                return(response);
            }
            catch (Exception ex)
            {
                FileHelper.WriteLine(Settings.Path, ex);
                response.Message = "Execution error!";
                return(response);
            }
        }
Exemplo n.º 7
0
        public Messages <tblNew> GetAllPaging(short permissions, int pageNumber, int pageSize)
        {
            var response = new Commons.Messages <tblNew>()
            {
                Status = false, Message = string.Empty
            };

            try
            {
                if (ADecentralize.Read(permissions))
                {
                    response.List    = new ANews().GetAllPaging(pageNumber, pageSize);
                    response.Status  = true;
                    response.Message = response.Status ? "Get all paging successfully." : "Get all paging failed.";
                    return(response);
                }
                response.Message = "Limit permissions!";
                return(response);
            }
            catch (Exception ex)
            {
                FileHelper.WriteLine(Settings.Path, ex);
                response.Message = "Execution error!";
                return(response);
            }
        }