// private string GetComboData() { try { SysLogBll.Create("挂牌类型", "返回挂牌类型combo数据操作", adminUser.AdminName); StringBuilder strb = new StringBuilder(); strb.Append("["); DataTable dataTable = dal.GetAllList(); for (int i = 0; i < dataTable.Rows.Count; i++) { strb.Append("{\"id\":\"" + dataTable.Rows[i]["Id"] + "\", \"text\":\"" + dataTable.Rows[i]["StandardTypeName"] + "\"}"); if (i < dataTable.Rows.Count - 1) { strb.Append(","); } } strb.Append("]"); return(strb.ToString()); } catch (Exception ex) { SystemErrorPlug.ErrorRecord("时间:[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]类名:[" + this.GetType().Name + "],行号:[" + Component.GetLineNum().ToString() + "行],错误信息:[" + ex.Message + "]"); return(string.Empty); } }
// private dynamic GetById(HttpContext context) { try { SysLogBll.Create("挂牌类型", "返回单个挂牌类型信息操作", adminUser.AdminName); int id = 0; try { id = int.Parse(context.Request.QueryString["Id"]); } catch { } return(dal.GetModel(id)); } catch (Exception ex) { SystemErrorPlug.ErrorRecord("时间:[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]类名:[" + this.GetType().Name + "],行号:[" + Component.GetLineNum().ToString() + "行],错误信息:[" + ex.Message + "]"); return(null); } }
public string ProcessRequest(HttpContext context) { try { adminUser = context.Session["SuperAdminUserSession"] as AdminUser; if (null == adminUser) { if (!string.IsNullOrEmpty(context.Request.Cookies["AdminCookies"].Value)) { adminUser = new GetUserCookiesPlug().GetUserCookies(context.Request.Cookies["AdminCookies"]["SuperAdminUserCookies"]); context.Session["SuperAdminUserSession"] = adminUser; } } } catch (Exception ex) { SystemErrorPlug.ErrorRecord("时间:[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]类名:[" + this.GetType().Name + "],行号:[" + Component.GetLineNum().ToString() + "行],错误信息:[" + ex.Message + "]"); return(null); } string action = context.Request.QueryString["action"].ToString(); string returnDate = string.Empty; switch (action) { case "paging": returnDate = JsonHelper <StandardType> .JsonDataTable(GetAllList(context), "rows"); break; case "add": returnDate = Create(context); break; case "up": returnDate = Update(context); break; case "combo": returnDate = GetComboData(); break; case "by": returnDate = JsonHelper <StandardType> .JsonWriter(GetById(context)); break; default: returnDate = "请求错误!"; break; } return(returnDate); }
private DataTable GetAllList(HttpContext context) { try { SysLogBll.Create("挂牌类型", "获取所有的挂牌类型操作", adminUser.AdminName); string sort = context.Request.Form["sort"]; string order = context.Request.Form["order"]; return(dal.GetAllList(sort, order)); } catch (Exception ex) { SystemErrorPlug.ErrorRecord("时间:[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]类名:[" + this.GetType().Name + "],行号:[" + Component.GetLineNum().ToString() + "行],错误信息:[" + ex.Message + "]"); return(null); } }
// private string Create(HttpContext context) { try { SysLogBll.Create("挂牌类型", "添加挂牌类型操作", adminUser.AdminName); if (dal.Create(GetModels(context))) { return("添加成功!"); } else { return("添加失败请重新操作! "); } } catch (Exception ex) { SystemErrorPlug.ErrorRecord("时间:[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]类名:[" + this.GetType().Name + "],行号:[" + Component.GetLineNum().ToString() + "行],错误信息:[" + ex.Message + "]"); return("添加失败请重新操作,错误代码:500 "); } }
public string CreatePdf(string imagePath, string pdfUrl, string pdfName) { try { Document document = new Document(PageSize.B0, 10, 10, 10, 10); document.AddAuthor("wanghao"); string newPdfUrl = HttpContext.Current.Server.MapPath(pdfUrl); PdfWriter writer = PdfWriter.GetInstance(document, new FileStream(newPdfUrl + pdfName, FileMode.Create)); document.Open(); Image img = Image.GetInstance(imagePath); img.SetAbsolutePosition(500, 500); writer.DirectContent.AddImage(img); Paragraph p = new Paragraph("", new iTextSharp.text.Font(Font.FontFamily.HELVETICA, 22f)); p.Alignment = Element.ALIGN_CENTER; document.Add(p); document.Close(); return("OK"); } catch (Exception ex) { SystemErrorPlug.ErrorRecord("时间:[" + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "]类名:[" + this.GetType().Name + "],行号:[" + Component.GetLineNum().ToString() + "行],错误信息:[" + ex.Message + "]"); return(ex.Message.ToString()); } }