Пример #1
0
        public JsonResult MobileApiDecryptData()
        {
            var headers = new HeaderManager(Request);
            M2ESession session = TokenManager.getSessionInfo(headers.AuthToken, headers);
            var clientTemplate = new ClientTemplateService();
            var isValidToken = TokenManager.IsValidSession(headers.AuthToken);
            if (isValidToken)
            {
                string Authkey = ConfigurationManager.AppSettings["AuthKey"];

                string username = EncryptionClass.GetDecryptionValue(headers.AuthKey, Authkey);
                var dbUserInfo = _db.Users.SingleOrDefault(x=>x.Username == username);                               
                var data = new Dictionary<string, string>();                    
                data["Password"] = headers.AuthValue;
                data["userGuid"] = dbUserInfo.guid;
                var decryptedData = EncryptionClass.decryptUserDetails(data);
                string password = decryptedData["UTMZV"];
                var usernamePasswordResponse = new usernamePasswordDeserialize
                {
                    username = username,
                    password = password
                };
                return Json(usernamePasswordResponse);
            }
            else
            {
                ResponseModel<string> response = new ResponseModel<string>();
                response.Status = 401;
                response.Message = "Unauthorized";
                return Json(response);
            }
            
        }
Пример #2
0
 public JsonResult GetAllTemplateInformation()
 {
     //var username = "******";            
     var headers = new HeaderManager(Request);
     M2ESession session = TokenManager.getSessionInfo(headers.AuthToken, headers);
     var clientTemplate = new ClientTemplateService();
     var isValidToken= TokenManager.IsValidSession(headers.AuthToken);
     if (isValidToken)
     {
         return Json(clientTemplate.GetAllTemplateInformation(session.UserName));
     }
     else
     {
         ResponseModel<string> response = new ResponseModel<string>();
         response.Status = 401;
         response.Message = "Unauthorized";
         return Json(response);
     }
 }
Пример #3
0
        public JsonResult EditTemplateDetailById(CreateTemplateRequest req)
        {
            //var username = Request.QueryString["username"].ToString(CultureInfo.InvariantCulture);
            var headers = new HeaderManager(Request);
            M2ESession session = TokenManager.getSessionInfo(headers.AuthToken, headers);
            var id = Convert.ToInt32(Request.QueryString["id"]);
            var templateList = req.Data;
            var clientTemplate = new ClientTemplateService();
            var isValidToken = TokenManager.IsValidSession(headers.AuthToken);
            if (isValidToken)
            {
                var createTemplateResponse = clientTemplate.EditTemplateDetailById(templateList, session.UserName, id);
                var imgurImageList = req.ImgurList;
                var refKey = session.UserName + id;
                if (createTemplateResponse.Status != 200) return Json(createTemplateResponse);
                if (imgurImageList != null)
                    clientTemplate.ImgurImagesSaveToDatabaseWithTemplateId(imgurImageList, session.UserName, refKey);

                return Json(createTemplateResponse);
            }
            else
            {
                ResponseModel<string> response = new ResponseModel<string>();
                response.Status = 401;
                response.Message = "Unauthorized";
                return Json(response);
            }
            
        }
Пример #4
0
 public JsonResult DeleteTemplateImgurImageById()
 {
     //var username = Request.QueryString["username"].ToString(CultureInfo.InvariantCulture);
     var headers = new HeaderManager(Request);
     M2ESession session = TokenManager.getSessionInfo(headers.AuthToken, headers);
     var id = Convert.ToInt32(Request.QueryString["id"]);
     var clientTemplate = new ClientTemplateService();
     var isValidToken = TokenManager.IsValidSession(headers.AuthToken);
     if (isValidToken)
     {
         return Json(clientTemplate.DeleteTemplateImgurImageById(session.UserName, id));
     }
     else
     {
         ResponseModel<string> response = new ResponseModel<string>();
         response.Status = 401;
         response.Message = "Unauthorized";
         return Json(response);
     }
     
 }
Пример #5
0
        public ActionResult DownloadAllCompletedTranscriptionInformation()
        {
            //var username = Request.QueryString["username"].ToString(CultureInfo.InvariantCulture);
            var headers = new HeaderManager(Request);            
            var id = Convert.ToInt32(Request.QueryString["id"]);
            var guid = Convert.ToString(Request.QueryString["guid"]);
            M2ESession session = TokenManager.getSessionInfo(guid);
            var clientTemplate = new ClientTemplateService();
            var isValidToken = TokenManager.IsValidSession(guid);
            var fileName = "Transcription_" + session.UserName + "_" + DateTime.Now.ToString("yyyy_MM_dd_HH_mm_ss");
            if (isValidToken)
            {
                var CompletedTranscriptions = clientTemplate.GetAllCompletedTranscriptionInformation(session.UserName, id);
                var products = new System.Data.DataTable("teste");
                var columnName = CompletedTranscriptions.Payload.options.Split(';');

                foreach (var Column in columnName)
                {
                    products.Columns.Add(Column, typeof(string));
                }

                foreach (var userResponse in CompletedTranscriptions.Payload.data)
                {                    
                                        
                    products.Rows.Add();                    
                    int count = 1;
                    foreach (var item in userResponse.userResponseData)
                    {                        
                        products.Rows.Add(item);                                              
                    }

                    products.Rows.Add();
                    products.Rows.Add("Transcription Image", userResponse.imageUrl);
                    products.Rows.Add();
                    products.Rows.Add();
                    products.Rows.Add();
                }
                


                var grid = new GridView();
                grid.DataSource = products;
                grid.DataBind();

                Response.ClearContent();
                Response.Buffer = true;
                Response.AddHeader("content-disposition", "attachment; filename=" + fileName + ".xls");
                Response.ContentType = "application/ms-excel";

                Response.Charset = "";
                StringWriter sw = new StringWriter();
                HtmlTextWriter htw = new HtmlTextWriter(sw);

                grid.RenderControl(htw);

                Response.Output.Write(sw.ToString());
                Response.Flush();
                Response.End();

                return View("MyView");                
            }
            else
            {                
                return null;
            }
        }
Пример #6
0
 public JsonResult GetTemplateInformationByRefKey()
 {
     //var username = "******";            
     var headers = new HeaderManager(Request);
     M2ESession session = TokenManager.getSessionInfo(headers.AuthToken, headers);
     var clientTemplate = new ClientTemplateService();
     var isValidToken = TokenManager.IsValidSession(headers.AuthToken);
     var id = Convert.ToInt32(Request.QueryString["id"]);
     var type = Convert.ToString(Request.QueryString["type"]);
     var subType = Convert.ToString(Request.QueryString["subType"]);
     if (isValidToken)
     {
         return Json(clientTemplate.GetTemplateInformationByRefKey(session.UserName,id,type,subType));
     }
     else
     {
         ResponseModel<string> response = new ResponseModel<string>();
         response.Status = 401;
         response.Message = "Unauthorized";
         return Json(response);
     }
 }