Ejemplo n.º 1
0
        public objRegisterResponseModel RegisterUser(objRegisterRequestModel requestModel)
        {
            IAuthentication          _repository = new DataAccess.Authentication.Authentication();
            objRegisterResponseModel objResponse = new objRegisterResponseModel();
            int Id = _repository.AddUser(requestModel.objUser);

            if (Id > 0)
            {
                UserModel user = new UserModel();
                user.Id = Id;
                string OTP = GenerateNewOTP();
                user.OTP         = OTP;
                user.PhoneNo     = requestModel.objUser.PhoneNo;
                user.FullName    = requestModel.objUser.FullName;
                user.EmailId     = requestModel.objUser.EmailId;
                objResponse.user = user;
                SMSService.SendSms(requestModel.objUser.PhoneNo, ("Login OTP " + user.OTP), user.OTP);
                AppResponseView response = new AppResponseView();
                response.Message     = "User Registered Successfully";
                response.Status      = 1;
                objResponse.Response = response;
                _repository.UpdateRegisterOTPCountForUser(requestModel.objUser.PhoneNo, true);
            }
            else
            {
                AppResponseView response = new AppResponseView();
                response.Message     = "User already Registered";
                response.Status      = 0;
                objResponse.Response = response;
            }
            return(objResponse);
        }
Ejemplo n.º 2
0
        public objRegisterResponseModel UpdateUserProfile()
        {
            IAuthentication          _repository = new DataAccess.Authentication.Authentication();
            objRegisterResponseModel response    = new objRegisterResponseModel();
            AppResponseView          appResponse = new AppResponseView();
            ////////////////////////////////////////////
            var            httpRequest = HttpContext.Current.Request;
            HttpPostedFile postedFile  = null;

            if (httpRequest.Files.Count > 0)
            {
                postedFile = httpRequest.Files[0];
            }
            //convert the posted file stream a to memory stream
            //System.IO.MemoryStream target = new System.IO.MemoryStream();
            //postedFile.InputStream.CopyTo(target);
            //the following static function is a function I built which accepts the amazon file key and also the object that will be uploaded to S3, in this case, a MemoryStream object
            UserModel request = new UserModel();

            request.Id       = int.Parse(httpRequest.Form["UserId"]);
            request.FullName = httpRequest.Form["FullName"] == ""?null: httpRequest.Form["FullName"];
            request.PhoneNo  = httpRequest.Form["PhoneNo"] == "" ? null : httpRequest.Form["PhoneNo"];
            request.EmailId  = httpRequest.Form["EmailId"] == "" ? null : httpRequest.Form["EmailId"];
            request.Password = httpRequest.Form["Password"] == "" ? null : httpRequest.Form["Password"];
            if (postedFile != null)
            {
                AmazonS3Uploader service = new AmazonS3Uploader();
                request.ProfilePic = service.UploadFile("FarmPeProfilePics/" + request.Id + postedFile.FileName, new HttpPostedFileWrapper(postedFile));
            }

            //////////////////////////////////////////////
            appResponse.Status = _repository.UpdateUserProfile(request);
            response.Response  = appResponse;
            return(response);
        }
Ejemplo n.º 3
0
        public objRegisterResponseModel GetCustomers()
        {
            IAuthentication          _repository = new DataAccess.Authentication.Authentication();
            objRegisterResponseModel response    = new objRegisterResponseModel();

            response.Customers = _repository.GetCustomersList();
            return(response);
        }
Ejemplo n.º 4
0
        public objRegisterResponseModel GetAccessContentByLangCode(objRegisterRequestModel request)
        {
            IAuthentication          _repository = new DataAccess.Authentication.Authentication();
            objRegisterResponseModel response    = new objRegisterResponseModel();

            response.AccessContent = _repository.GetAccessContentByLangCode(request.objAccess.LangCode, request.objAccess.Type);
            return(response);
        }
Ejemplo n.º 5
0
        public objRegisterResponseModel ValidateRefferalCode(objRegisterRequestModel request)
        {
            IAuthentication          _repository = new DataAccess.Authentication.Authentication();
            objRegisterResponseModel response    = new objRegisterResponseModel();

            response.user = _repository.ValidateRefferalCode(request.objUser.RefferalCode);
            return(response);
        }
Ejemplo n.º 6
0
        public objRegisterResponseModel GetUserDetails(objRegisterRequestModel request)
        {
            IAuthentication          _repository = new DataAccess.Authentication.Authentication();
            objRegisterResponseModel response    = new objRegisterResponseModel();

            response.user = _repository.GetUserDetails(request.objUser.Id);
            return(response);
        }
Ejemplo n.º 7
0
        public objRegisterResponseModel UpdateUserPassword(objRegisterRequestModel request)
        {
            IAuthentication          _repository = new DataAccess.Authentication.Authentication();
            objRegisterResponseModel response    = new objRegisterResponseModel();
            AppResponseView          appResponse = new AppResponseView();

            appResponse.Status = _repository.UpdateUserPassword(request.objUser);
            response.Response  = appResponse;
            return(response);
        }
Ejemplo n.º 8
0
        public objRegisterResponseModel VerifyOTPNewUser(objRegisterRequestModel Request)
        {
            IAuthentication          _repository = new DataAccess.Authentication.Authentication();
            int                      result      = _repository.VerifyOTPofNewUser(Request.objUser);
            objRegisterResponseModel response    = new objRegisterResponseModel();

            if (result > 0)
            {
                AppResponseView objresponse = new AppResponseView();
                objresponse.Message = "User Registered Successfully";
                response.user       = _repository.GetUserDetails(result);
                response.Response   = objresponse;
            }
            return(response);
        }