public static ResponseDto ChangeProfilePhoto(ChangeProfilePhotoRequest request)
        {
            ResponseDto response  = new ResponseDto();
            SuperAdmin  superuser = null;

            try
            {
                //if (!SuperUserServices.CheckSuperUser(request.user_id, request.auth_token, response))
                //{
                //    response.message = MessagesSource.GetMessage("invalid.super.user");
                //    return response;
                //}
                using (SuperUserDao dao = new SuperUserDao())
                {
                    superuser = dao.FindById(request.user_id);
                    if (superuser != null)
                    {
                        superuser.ProfileImage = request.profile_image;
                        dao.Update(superuser);
                    }
                    response.code         = 0;
                    response.has_resource = 0;
                    response.message      = MessagesSource.GetMessage("profile.changed");
                    return(response);
                }
            }
            catch (Exception ex)
            {
                response.MakeExceptionResponse(ex);
                return(response);
            }
        }
        public static GetSuperUserDetailsResponse GetDetails(GetSuperUserDetailsRequest request)
        {
            GetSuperUserDetailsResponse response = new GetSuperUserDetailsResponse();
            SuperAdmin superuser = null;

            try
            {
                if (!SuperUserServices.CheckSuperUser(request.user_id, request.auth_token, response))
                {
                    response.message = MessagesSource.GetMessage("invalid.super.user");
                    return(response);
                }
                using (SuperUserDao dao = new SuperUserDao())
                {
                    superuser = dao.FindById(request.user_id);
                    response.super_user_details = new SuperUserDetailsDto();
                    response.super_user_details.super_user_id    = superuser.SAdminID;
                    response.super_user_details.profile_image    = ImagePathService.superUserImagePath + superuser.ProfileImage;
                    response.super_user_details.super_user_name  = superuser.FullName;
                    response.super_user_details.mobile_number    = superuser.MobileNum;
                    response.super_user_details.super_user_email = superuser.Email;
                    response.code         = 0;
                    response.has_resource = 1;
                    response.message      = MessagesSource.GetMessage("superuser.details");
                    return(response);
                }
            }

            catch (Exception ex)
            {
                response.MakeExceptionResponse(ex);
                return(response);
            }
        }
        public static ResponseDto ChangeProfile(ChangeProfileSuperUserRequest request)
        {
            request.mobile_number = Common.GetStandardMobileNumber(request.mobile_number);
            ResponseDto response  = new ResponseDto();
            SuperAdmin  superuser = null;

            try
            {
                if (!SuperUserServices.CheckSuperUser(request.user_id, request.auth_token, response))
                {
                    response.message = MessagesSource.GetMessage("invalid.super.user");
                    return(response);
                }
                using (SuperUserDao dao = new SuperUserDao())
                {
                    superuser          = dao.FindById(request.user_id);
                    superuser.FullName = request.super_user_name;
                    //superuser.MobileNum = request.mobile_number;
                    //superuser.ProfileImage = request.profile_image;//Commented bcz image is uploading as multipart
                    superuser.Email = request.super_user_email;
                    dao.Update(superuser);
                    response.code         = 0;
                    response.has_resource = 0;
                    response.message      = MessagesSource.GetMessage("profile.changed");
                    return(response);
                }
            }
            catch (Exception ex)
            {
                response.MakeExceptionResponse(ex);
                return(response);
            }
        }
        public SuperAdmin GetAuthSuperUser(SuperUserDao superuserDao, int userId, string authCode, bool withDetails = false)
        {
            SuperAdmin superuser = null;

            superuser = superuserDao.FindById(userId);

            if (superuser != null && superuser.AccToken == authCode)
            {
                return(superuser);
            }
            return(null);
        }
        public static SuperAdmin GetAuthUser(int userId, string authToken, ResponseDto response = null)
        {
            SuperAdmin superuser = null;

            using (SuperUserDao dao = new SuperUserDao())
            {
                superuser = dao.FindById(userId);
                if (superuser != null && superuser.AccToken == authToken)
                {
                    return(superuser);
                }
                if (response != null)
                {
                    response.code         = 1;
                    response.has_resource = 0;
                    response.message      = MessagesSource.GetMessage("invalid.superuser");
                }
                return(null);
            }
        }
        //public static ForgotPasswordResponse ForgotPassword(ForgotPasswordRequest request)
        //{
        //    ForgotPasswordResponse response = new ForgotPasswordResponse();
        //    string newPassword = "******"; //TODO change to generation
        //                                 //TokenGenerator.GenerateResetPassword();
        //    SuperAdmin superuser = null;
        //    try
        //    {
        //        using (SuperUserDao dao = new SuperUserDao())
        //        {
        //            superuser = dao.FindByMobileNumber(request.mobile_number);
        //            if (superuser == null)
        //            {
        //                MakeNouserResponse(response);
        //                return response;
        //            }
        //            superuser.Password = TokenGenerator.GetHashedPassword(newPassword, 49);
        //            dao.Update(superuser);
        //            OTPServices.SendPasswordMessage(superuser.MobileNum, newPassword);
        //            response.code = 0;
        //            response.has_resource = 1;
        //            response.reset_password = new ResetPasswordDto();
        //            response.reset_password.password_otp_sent = 1;
        //            response.reset_password.password_reset = 1;
        //            response.message = MessagesSource.GetMessage("passwd.reset");
        //            return response;
        //        }
        //    }
        //    catch (Exception ex)
        //    {
        //        response.MakeExceptionResponse(ex);
        //        return response;
        //    }
        //}

        public static ResponseDto ChangePassword(ChangePasswordSuperUserRequest request)
        {
            ResponseDto response        = new ResponseDto();
            SuperAdmin  superuser       = null;
            string      oldPasswordHash = TokenGenerator.GetHashedPassword(request.old_password, 49);

            try
            {
                if (!SuperUserServices.CheckSuperUser(request.user_id, request.auth_token, response))
                {
                    response.message = MessagesSource.GetMessage("no.super.user");
                    return(response);
                }
                using (SuperUserDao dao = new SuperUserDao())
                {
                    superuser = dao.FindById(request.user_id);
                    if (superuser.Password == oldPasswordHash)
                    {
                        superuser.Password = TokenGenerator.GetHashedPassword(request.new_password, 49);
                        dao.Update(superuser);
                        response.code         = 0;
                        response.has_resource = 0;
                        response.message      = MessagesSource.GetMessage("password.changed");
                        return(response);
                    }
                }
                response.code         = 1;
                response.has_resource = 0;
                response.message      = MessagesSource.GetMessage("exception");
                return(response);
            }
            catch (Exception ex)
            {
                response.MakeExceptionResponse(ex);
                return(response);
            }
        }