Ejemplo n.º 1
0
        public ActionResult <CreateArticleService> Post(SendRequestProperties request)
        {
            SendRequestService    _service = new SendRequestService(_unitOfWork);
            CreateRequestResponse response = _service.SendProductivity(request);

            return(Ok(response));
        }
        public JsonResult ResendRequest(Guid requestId)
        {
            MarkerActivationModel model = new MarkerActivationModel();
            Guid token = CheckSessionAuthState(CurrentUser, _authService);

            if (token == Guid.Empty)
            {
                model.Status       = MainStatus.Failed;
                model.SystemLogoff = true;
                return(Json(model, JsonRequestBehavior.AllowGet));
            }

            CreateRequestResponse response = _markerService.ResendRequest(requestId, token);

            if (response.Status == MainStatus.NeedSmsConfirmation)
            {
                MarkerActivationBase markerActivationBase = new MarkerActivationBase(response.SessionData, requestId);
                Session[markerActivationBase.Id.ToString()] = markerActivationBase;
            }


            if (response.Error != null)
            {
                model.Error = response.Error;
                return(Json(model, JsonRequestBehavior.AllowGet));
            }

            model.Status = response.Status;

            return(Json(model, JsonRequestBehavior.AllowGet));
        }
        public JsonResult ResendRequestAfterCheckSms(Guid requestId)
        {
            MarkerActivationModel model = new MarkerActivationModel();
            Guid token = CheckSessionAuthState(CurrentUser, _authService);

            if (token == Guid.Empty)
            {
                model.Status       = MainStatus.Failed;
                model.SystemLogoff = true;
                return(Json(model, JsonRequestBehavior.AllowGet));
            }
            MarkerActivationBase markerActivationBase = Session[requestId.ToString()] as MarkerActivationBase;


            CreateRequestResponse response = _markerService.ResendRequestPhpSessionLogin(requestId, markerActivationBase.PhpSessionStream, token);


            if (response.Error != null)
            {
                model.Error = response.Error;
                return(Json(model, JsonRequestBehavior.AllowGet));
            }

            model.Status = response.Status;

            return(Json(model, JsonRequestBehavior.AllowGet));
        }
        public JsonResult CreateCertificateRequest(Guid currentMarkerId, string login, string password, string pin, bool SavePIN, bool SendSMS, bool SendEmail)
        {
            CreateRequestModel model = new CreateRequestModel();
            Guid token = CheckSessionAuthState(CurrentUser, _authService);

            if (token == Guid.Empty)
            {
                model.Status       = MainStatus.Failed;
                model.SystemLogoff = true;
                return(Json(model, JsonRequestBehavior.AllowGet));
            }

            if (Session[currentMarkerId.ToString()] == null)
            {
                model.Status = MainStatus.NeedRelogin;
                return(Json(model, JsonRequestBehavior.AllowGet));
            }
            MarkerActivationBase markerActivationBase = Session[currentMarkerId.ToString()] as MarkerActivationBase;

            CreateRequestParams param = new CreateRequestParams();

            param.Login     = login;
            param.Password  = password;
            param.Pin       = pin;
            param.Savepin   = SavePIN;
            param.SendEmail = SendEmail;
            param.SendSms   = SendSMS;

            CreateRequestResponse response = _markerService.CreateRequest(markerActivationBase.PhpSessionStream, param, null, token, true);

            if (response.Error != null)
            {
                model.Error = response.Error;
                return(Json(model, JsonRequestBehavior.AllowGet));
            }

            model.Status = response.Status;

            return(Json(model, JsonRequestBehavior.AllowGet));
        }