示例#1
0
        //
        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);
            }
        }
示例#2
0
 //
 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);
     }
 }
示例#3
0
        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);
        }
示例#4
0
 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);
     }
 }
示例#5
0
 //
 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 ");
     }
 }
示例#6
0
 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());
     }
 }