Example #1
0
 public ActionResult MyProfile()
 {
     //DataSet ds = LoadData(this.MemberISN, out returnValue);
     var myProfile = new MyProfileViewModal();
     myProfile.GetMyProfile(this.MemberISN);
     return View(myProfile);
 }
Example #2
0
        // GET: Signature
        public ActionResult Index(int isn, int docId)
        {
            _logger.Info("---start signature from email co-client---");
            _logger.Debug("isn = {0}; docId = {1}", isn, docId);
            var documentInfo = _premierBusiness.GetSigntureDocument(docId);
            if(_premierBusiness.CheckIsSignture(docId))
            {
                documentInfo = _premierBusiness.GetSubSigntureDocument(docId, true);
            }
            if(documentInfo == null)
            {
                _logger.Error("This document is not exist.");
                return RedirectToAction("Result", new { message = "This document is not exist." });
            }

            string token = documentInfo.DocGUID.Trim();
            MyProfileViewModal profile = new MyProfileViewModal();
            profile.GetMyProfile(documentInfo.MemberISN);
            if (documentInfo.docSignatureDate.HasValue && documentInfo.docSignatureDate.Value.AddDays(30) <= DateTime.Now)
            {
                _logger.Info("This document expired to sign.");
                _logger.Debug("This document expired to sign. docSignatureDate = {0}", documentInfo.docSignatureDate.Value);
                return RedirectToAction("Result", new { message = "This document expired to sign." });
            }
            if (!string.IsNullOrEmpty(documentInfo.FileName))
            {
                _logger.Info("This document has been signed.");
                _logger.Debug("This document has been signed by {0} {1} and {2} {3}.", profile.FirstName, profile.LastName, profile.CoFirstName, profile.CoLastName);
                return RedirectToAction("Result", new { message = string.Format("This document has been signed by {0} {1} and {2} {3}.", profile.FirstName, profile.LastName, profile.CoFirstName, profile.CoLastName) });
            }
            var urlRedirect = Url.Action("SignatureDownload2", "Document");
            var urlBase = Request.Url.GetLeftPart(UriPartial.Authority) + Url.Content("~");
            urlRedirect = urlRedirect.TrimEnd('/') + "/" + token + "/" + documentInfo.ID;
            var scheme = Request.Url.Scheme;
            var host = Request.Url.Host;
            var redirect = string.Format("{0}://{1}/{2}", scheme, host.TrimEnd('/'), urlRedirect);
            _logger.Debug("redirect = {0}.", redirect);

            //redirect = string.Format("http://localhost:{0}/{1}", Request.Url.Port, urlRedirect);

            var apiKey = ConfigurationManager.AppSettings["RightSignatureApiKey"];

            if (string.IsNullOrEmpty(apiKey))
            {
                _logger.Error("Api key not found");
                return Json(new { code = -4, msg = "api key not found" }, JsonRequestBehavior.AllowGet);
            }
            RightSignature.SetApiKey(apiKey);

            string docKey = RightSignature.GetSignerToken(token, "Co-Client", redirect);
            _logger.Debug("docKey = {0}", docKey);

            var signUrlBase = ConfigurationManager.AppSettings["Url_RightSignature"];
            _logger.Debug("signUrlBase = {0}", signUrlBase);

            var signUrl = string.Format("{0}?height=700&rt={1}", signUrlBase, docKey);
            _logger.Debug("signUrl = {0}", signUrl);

            ViewBag.IFrameUrl = signUrl;
            _logger.Info("---return IFrameUrl---");
            return View();
        }