public ViewResult TmpDetail(string id, string type) { string userId = string.Empty; if (Session["user"] != null) { List <UserRecord> list = (List <UserRecord>)Session["user"]; ViewData["login"] = list[0].Name; userId = list[0].UserId; } else { ViewData["login"] = string.Empty; } PaperBLL paperBLL = new PaperBLL(); PaperDetailViewModel paperDetailViewModel = new PaperDetailViewModel(); if (string.IsNullOrEmpty(type)) { paperDetailViewModel = paperBLL.PaperDetailById(id, userId); } else { paperDetailViewModel = paperBLL.TmpDetailById(id); } ViewBag.ImageModel = paperBLL.SearchImgManage().rows; return(View("TemplateDetail", paperDetailViewModel)); }
public FilePathResult GetDownLoadPaperUrl(string orderNumber) { if (Session["user"] != null) { List <UserRecord> rows = (List <UserRecord>)Session["user"]; string userGuid = rows[0].UserId; PayPaperBLL payPaperBLL = new PayPaperBLL(); PaperDetailViewModel paperDetailViewModel = payPaperBLL.GetPaperDownloadUrl(orderNumber, userGuid); if (paperDetailViewModel.detail.Count > 0) { string fileName = paperDetailViewModel.detail[0].FileUrl; string code = paperDetailViewModel.detail[0].Code; if (!string.IsNullOrEmpty(fileName) && !string.IsNullOrEmpty(code)) { string filePath = Server.MapPath("/fileData/" + code + "/" + fileName); return(File(filePath, "text/plain", fileName)); } else { return(null); } } else { return(null); } } else { return(null); } }
public PaperDetailViewModel GetPaperDownloadUrl(string orderNumber, string UserGuid) { PaperDetailViewModel paperDetailViewModel = new PaperDetailViewModel(); PayPaperDAL payPaperDAL = new PayPaperDAL(); DataTable paperDetail = payPaperDAL.SearchPaperPath(orderNumber, UserGuid); paperDetailViewModel.detail = paperDetail.toList <PaperInfo>(); return(paperDetailViewModel); }
public PaperDetailViewModel PaperDetailById(string Id, string userId) { PaperDetailViewModel paperDetailViewModel = new PaperDetailViewModel(); DataTable dtPaperDetail = paperDAL.SearchPaperDetailById(Id, userId); // DataTable dtImgList = paperDAL.SearchPaperImgListById(Id); List <string> imgList = new List <string>(); if (dtPaperDetail.Rows.Count > 0) { string ImgA = dtPaperDetail.Rows[0]["ImgA"].ToString() ?? ""; if (!string.IsNullOrEmpty(ImgA)) { imgList.Add(ImgA); } string ImgB = dtPaperDetail.Rows[0]["ImgB"].ToString() ?? ""; if (!string.IsNullOrEmpty(ImgB)) { imgList.Add(ImgB); } string ImgC = dtPaperDetail.Rows[0]["ImgC"].ToString() ?? ""; if (!string.IsNullOrEmpty(ImgC)) { imgList.Add(ImgC); } string ImgD = dtPaperDetail.Rows[0]["ImgD"].ToString() ?? ""; if (!string.IsNullOrEmpty(ImgD)) { imgList.Add(ImgD); } string ImgE = dtPaperDetail.Rows[0]["ImgE"].ToString() ?? ""; if (!string.IsNullOrEmpty(ImgE)) { imgList.Add(ImgE); } } paperDetailViewModel.detail = dtPaperDetail.toList <PaperInfo>(); DataTable dtSearchPaperHotListBytype = paperDAL.SearchPaperHotListBytype(paperDetailViewModel.detail[0].Type.ToString()); DataTable dtSearchNewList = paperDAL.SearchNewList(); paperDetailViewModel.HotList = dtSearchPaperHotListBytype.toList <PaperList>(); paperDetailViewModel.NewList = dtSearchNewList.toList <PaperList>(); paperDetailViewModel.imgList = imgList; DataTable dtFootLink = paperDAL.SearchFootLink(); paperDetailViewModel.footLinkList = dtFootLink.toList <FootLinkViewModel>(); DataTable dtMenu = paperDAL.SearchMenuList(); paperDetailViewModel.menuModelList = dtMenu.toList <MenuModel>(); return(paperDetailViewModel); }
public ActionResult PaperDetail(int bId) { var bildiri = _bildiriService.GetWIncById(bId); var oturum = _sessionService.GetUyeSession(); var model = new PaperDetailViewModel { Bildiri = bildiri, Oturum = oturum, AtananHakemler = _uyeService.GetAll_ByHakemId(bildiri.HakemBildiriAtama.Select(x => x.HakemId).ToArray()), TumHakemler = _uyeService.GetAll_WithoutEditorYazar(bildiri.YazarId, bildiri.EditorId), HakemBildiri = bildiri.HakemBildiriAtama.SingleOrDefault(x => x.HakemId == oturum.Id) }; return(View(model)); }
public JsonResult WXPayUrl(PaperInfo paperInfo) { if (Session["user"] == null) { return(Json(new { success = false, data = "请您先登录,才能购买商品哦!" }, JsonRequestBehavior.AllowGet)); } else { string userId = string.Empty; List <UserRecord> list = (List <UserRecord>)Session["user"]; userId = list[0].UserId; NativePay nativePay = new NativePay(); PaperBLL paperBLL = new PaperBLL(); PaperDetailViewModel paperDetailViewModel = paperBLL.PaperDetailById(paperInfo.Id.ToString(), userId); string _outTradeNo = string.Empty; string url = nativePay.GetPayUrl(paperDetailViewModel.detail[0], out _outTradeNo); if (string.IsNullOrEmpty(url)) { return(Json(new { success = false, data = "微信生成订单时出现错误,请您重新支付!" }, JsonRequestBehavior.AllowGet)); } else { Business business = new Business(); List <UserRecord> rows = (List <UserRecord>)Session["user"]; business.UserId = rows[0].UserId; business.Name = rows[0].Name; business.CreateTime = DateTime.Now; business.OutTradeNo = _outTradeNo; business.PaperCode = paperDetailViewModel.detail[0].Code; business.PaperId = paperDetailViewModel.detail[0].Id; business.Title = paperDetailViewModel.detail[0].Title; business.Version = paperDetailViewModel.detail[0].Version; business.Price = paperDetailViewModel.detail[0].Price; business.PayState = 0; bool result = paperBLL.CreateBusiness(business); if (result == true) { return(Json(new { success = true, data = url, orderNumber = _outTradeNo }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { success = false, data = "微信生成订单时出现错误,请您重新支付!" }, JsonRequestBehavior.AllowGet)); } } } }
public ActionResult GetPaperDownloadUrl(string orderNumber) { LogInfo.WriteLog("9999"); try { if (Session["user"] == null) { return(Json(new { success = false, data = "您离开太久了,登录超时,请您重新登录!" }, JsonRequestBehavior.AllowGet)); } List <UserRecord> rows = (List <UserRecord>)Session["user"]; string userGuid = rows[0].UserId; PayPaperBLL payPaperBLL = new PayPaperBLL(); PaperDetailViewModel paperDetailViewModel = payPaperBLL.GetPaperDownloadUrl(orderNumber, userGuid); LogInfo.WriteLog("0000"); if (paperDetailViewModel.detail.Count > 0) { LogInfo.WriteLog("1111"); string fileName = paperDetailViewModel.detail[0].FileUrl; string code = paperDetailViewModel.detail[0].Code; if (string.IsNullOrEmpty(fileName) || string.IsNullOrEmpty(code)) { return(Json(new { success = "NO", data = "" }, JsonRequestBehavior.AllowGet)); } else { LogInfo.WriteLog("22222"); return(Json(new { success = true, fileName = fileName, code = code }, JsonRequestBehavior.AllowGet)); } } else { return(Json(new { success = "NO", data = "" }, JsonRequestBehavior.AllowGet)); } } catch { return(View("Error")); } }
public PaperDetailViewModel TmpDetailById(string Id) { PaperDetailViewModel paperDetailViewModel = new PaperDetailViewModel(); DataTable dtPaperDetail = paperDAL.SearchTmpDetailById(Id); // DataTable dtImgList = paperDAL.SearchPaperImgListById(Id); paperDetailViewModel.paperTmpPage = dtPaperDetail.toList <TemplateDownloadInfo>(); DataTable dtSearchPaperHotListBytype = paperDAL.SearchPaperHotListBytype(null); DataTable dtSearchNewList = paperDAL.SearchNewList(); paperDetailViewModel.HotList = dtSearchPaperHotListBytype.toList <PaperList>(); paperDetailViewModel.NewList = dtSearchNewList.toList <PaperList>(); DataTable dtFootLink = paperDAL.SearchFootLink(); paperDetailViewModel.footLinkList = dtFootLink.toList <FootLinkViewModel>(); DataTable dtMenu = paperDAL.SearchMenuList(); paperDetailViewModel.menuModelList = dtMenu.toList <MenuModel>(); return(paperDetailViewModel); }
public void DownLoadPaper(string orderNumber) { try { if (Session["user"] != null) { List <UserRecord> rows = (List <UserRecord>)Session["user"]; string userGuid = rows[0].UserId; PayPaperBLL payPaperBLL = new PayPaperBLL(); PaperDetailViewModel paperDetailViewModel = payPaperBLL.GetPaperDownloadUrl(orderNumber, userGuid); if (paperDetailViewModel.detail.Count > 0) { string fileName = paperDetailViewModel.detail[0].FileUrl; string code = paperDetailViewModel.detail[0].Code; if (!string.IsNullOrEmpty(fileName) && !string.IsNullOrEmpty(code)) { string filePath = Server.MapPath("/fileData/" + code + "/" + fileName); FileStream fs = new FileStream(filePath, FileMode.Open); byte[] bytes = new byte[(int)fs.Length]; fs.Read(bytes, 0, bytes.Length); fs.Close(); Response.Charset = "UTF-8"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("UTF-8"); Response.ContentType = "application/octet-stream"; Response.AddHeader("Content-Disposition", "attachment; filename=" + Server.UrlEncode(fileName)); Response.BinaryWrite(bytes); Response.Flush(); Response.End(); } } } } catch { } }
public ViewResult Detail(string id) { string userId = string.Empty; if (Session["user"] != null) { List <UserRecord> list = (List <UserRecord>)Session["user"]; ViewData["login"] = list[0].Name; ViewData["admin"] = list[0].AdminState; userId = list[0].UserId; } else { ViewData["login"] = string.Empty; ViewData["admin"] = string.Empty; } PaperBLL paperBLL = new PaperBLL(); paperBLL.AddReadCount(id); PaperDetailViewModel paperDetailViewModel = paperBLL.PaperDetailById(id, userId); ViewBag.ImageModel = paperBLL.SearchImgManage().rows; return(View("PaperDetail", paperDetailViewModel)); }