protected void Page_Load(object sender, EventArgs e) { StringBuilder stringBuilder = new StringBuilder(); HySearchArt hySearchArt = new HySearchArt(); DataTable dt = hySearchArt.getData("", 10); string strArtType = "0"; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { if (dt.Rows[i]["hy_url"].ToString() == "art_detail.aspx") { strArtType = "1"; } else if (dt.Rows[i]["hy_url"].ToString() == "photo_detail.aspx") { strArtType = "2"; } if (dt.Rows[i]["type"].ToString() == "1") { stringBuilder.Append("<div><a onclick=\"locationDetail('" + dt.Rows[i]["hy_url"].ToString() + "','" + locationType + "','" + strArtType + "','0')\" ><img src=\"" + dt.Rows[i]["img"].ToString() + "\">" + dt.Rows[i]["hy_title"].ToString() + "</a></div>"); } else if (dt.Rows[i]["type"].ToString() == "0") { HyFileatt hyFileatt = new HyFileatt(); DataTable dt_img = hyFileatt.Getdocsfm(dt.Rows[i]["img"].ToString()); if (dt_img.Rows.Count > 0) { stringBuilder.Append("<div><a onclick=\"locationDetail('" + dt.Rows[i]["hy_url"].ToString() + "','" + locationType + "','" + strArtType + "','0')\" ><img src=\"" + dt_img.Rows[0]["hy_filepath"].ToString() + "\">" + dt.Rows[i]["hy_title"].ToString() + "</a></div>"); } } } } strShowData = stringBuilder.ToString(); }
//删除图片 protected void btndelinfo_Click(object sender, EventArgs e) { string ls_filepath1 = "", ls_filepath2 = ""; TPortalClass.HyFileatt HyFileatt = new TPortalClass.HyFileatt(); DataTable dt = HyFileatt.Getdocbyid(this.txtuids.Value); if (dt.Rows.Count > 0) { if (dt.Rows[0]["hy_fm"].ToString() == "1") { Response.Write("<script>alert('封面图片不能删除');window.location.href=window.location.href;</script>"); return; } //删除文件夹里的图片 ls_filepath1 = Server.MapPath("~/") + dt.Rows[0]["hy_filepath"].ToString(); ls_filepath2 = Server.MapPath("~/") + dt.Rows[0]["hy_filepath"].ToString().Replace("thumbnail", "original"); if (System.IO.File.Exists(ls_filepath1)) { System.IO.File.Delete(ls_filepath1); } if (System.IO.File.Exists(ls_filepath2)) { System.IO.File.Delete(ls_filepath2); } } //删除数据库记录 HyFileatt.Delete(this.txtuids.Value); //操作日志 TPortalClass.JpCommon HyCommon = new TPortalClass.JpCommon(); // HyCommon.WriteLog("删除图片", "删除图片ID:" + this.txtuids.Value, this.Session["hy_id"].ToString(), this.Session["hy_name"].ToString()); // LoadingPictures(); Response.Write("<script>location.replace(location);</script>"); }
public string showNewGoods() { StringBuilder stringBuilder = new StringBuilder(); JpGoods jpGoods = new JpGoods(); DataTable dt = jpGoods.getNewsGood(10); string strTitle = ""; for (int i = 0; i < dt.Rows.Count; i++) { strTitle = dt.Rows[i]["hy_goodsname"].ToString(); if (strTitle.Length > 18) { strTitle = strTitle.Substring(0, 18); } stringBuilder.Append("<a onclick=\"locationDetail('" + dt.Rows[i]["hy_linkurl"].ToString() + "','" + locationType + "','0')\" > <li>"); HyFileatt hyFileatt = new HyFileatt(); DataTable dt_img = hyFileatt.Getdocsfm(dt.Rows[i]["docid"].ToString()); if (dt_img.Rows.Count > 0) { stringBuilder.Append("<img src=\"" + dt_img.Rows[0]["hy_filepath"].ToString() + "\">"); } stringBuilder.Append("<p>" + strTitle + "</p>"); stringBuilder.Append("<span>¥" + Convert.ToDecimal(dt.Rows[i]["hy_goodsprice"].ToString()).ToString("0.00") + "</span><i class=\"btn-dg\">订购</i></li></a>"); } return stringBuilder.ToString(); }
public string getExport() { StringBuilder stringBuilder = new StringBuilder(); dt_expert dtExpert = new dt_expert(); DataSet dt = dtExpert.GetListTop(10, ""); DataTable dtImg = new DataTable(); HyFileatt hyFileatt = new HyFileatt(); if (dt.Tables[0].Rows.Count > 0) { for (int i = 0; i < dt.Tables[0].Rows.Count; i++) { dtImg = hyFileatt.Getdocsfm(dt.Tables[0].Rows[i]["ID"].ToString()); stringBuilder.Append("<li><a target=\"_blank\" href=\"showExportMain.aspx?docid=" + dt.Tables[0].Rows[i]["ID"].ToString() + "&rend=" + System.Guid.NewGuid().ToString() + "\">"); if (dtImg.Rows.Count > 0) { stringBuilder.Append("<img src=\"" + dtImg.Rows[0]["hy_filepath"].ToString() + "\">"); } else { stringBuilder.Append("<img src=\"Images/Img.jpg\">"); } dtImg.Clear(); stringBuilder.Append("</a></li>"); } } return stringBuilder.ToString(); }
protected void Page_Load(object sender, EventArgs e) { if (this.Request.QueryString["aid"] != null) { aid = this.Request.QueryString["aid"].ToString(); } this.txtcid.Value = cid; this.txtaid.Value = aid; this.lb_type.Text = "手摄一族"; StringBuilder stringBuilder = new StringBuilder(); JpPhotography jpPhotography = new JpPhotography(); DataTable dt = jpPhotography.Getdocbyid(Convert.ToInt32(aid)); if (dt.Rows.Count > 0) { this.lb_time.Text = Convert.ToDateTime(dt.Rows[0]["hy_addtime"].ToString()).ToString("yyyy年MM月dd日"); this.lb_title.Text = dt.Rows[0]["hy_content"].ToString(); HyFileatt hyFileatt = new HyFileatt(); DataTable dt_img = hyFileatt.Getdocs(dt.Rows[0]["docid"].ToString(), 8); for (int i = 0; i < dt_img.Rows.Count; i++) { imgPath += "<img src=\"" + dt_img.Rows[i]["hy_filepath"].ToString() + "\" width=\"640\" height=\"340\">"; } this.lb_article.Text = dt.Rows[0]["hy_content"].ToString(); } }
protected void Page_Load(object sender, EventArgs e) { Response.CacheControl = "no-cache"; string ls_update = ""; string ls_filename = ""; string ls_path = ""; string ls_id = Request.Form["id"].ToString(); if (Request.Files["file"].ContentLength > 0) { try { string updir = Server.MapPath("~/") + "upload\\original\\20159\\"; TPortalClass.HyFileatt Hyoa_fileatt = new TPortalClass.HyFileatt(); HttpPostedFile uploadFile = Request.Files["file"]; //if (uploadFile.ContentLength > 0) //{ if (!Directory.Exists(updir)) { Directory.CreateDirectory(updir); } //string extname = Path.GetExtension(uploadFile.FileName); //string filename = uploadFile.FileName; //lsfilename = filename; //lsurl = "fileatt\\" + filename; //存放的文件夹 //uploadFile.SaveAs(string.Format("{0}\\{1}", updir, filename)); string ls_docid = System.Guid.NewGuid().ToString(); ls_filename = ls_docid + ".png"; uploadFile.SaveAs(updir + ls_filename); ls_path = "/upload/original/20159/" + ls_filename; Hyoa_fileatt.id = ls_docid; Hyoa_fileatt.hy_filepath = ls_path; Hyoa_fileatt.hy_fatherid = ls_id; Hyoa_fileatt.hy_filesize = ""; Hyoa_fileatt.hy_userid = ""; Hyoa_fileatt.hy_addtime = System.DateTime.Now.ToString(); Hyoa_fileatt.hy_filename = ls_filename; if (Hyoa_fileatt.IsExist(ls_id)) { Hyoa_fileatt.hy_fm = 0; } else { Hyoa_fileatt.hy_fm = 1; } Hyoa_fileatt.Insert(); //} } catch (Exception ex) { Response.Write("Message"+ ex.ToString()); } } }
protected void Page_Load(object sender, EventArgs e) { StringBuilder stringBuilder = new StringBuilder(); dt_expert dtExpert = new dt_expert(); DataSet dt = dtExpert.GetList(""); DataTable dtImg = new DataTable(); HyFileatt hyFileatt = new HyFileatt(); //控制数据条数 int s = 0; if (dt.Tables[0].Rows.Count > 0) { //分行 int n = 0; if ((dt.Tables[0].Rows.Count) % 4 == 0) { n = (dt.Tables[0].Rows.Count) / (4); } else { n = ((dt.Tables[0].Rows.Count) / (4)) + 1; } //构造列 for (int i = 0; i < n; ++i) { stringBuilder.Append("<ul>"); //控制循环条件 int m = 0; if ((dt.Tables[0].Rows.Count - (i * 4)) > 4) { m = 4; } else { m = dt.Tables[0].Rows.Count - (i * 4); } for (int j = 0; j < m; j++) { dtImg = hyFileatt.Getdocsfm(dt.Tables[0].Rows[s]["ID"].ToString()); stringBuilder.Append("<li><a href=\"showExportMain.aspx?docid=" + dt.Tables[0].Rows[s]["ID"].ToString() + "&rend=" + System.Guid.NewGuid().ToString() + "\">"); if (dtImg.Rows.Count > 0) { stringBuilder.Append("<img src=\"" + dtImg.Rows[0]["hy_filepath"].ToString() + "\">"); } else { stringBuilder.Append("<img src=\"Images/Img.jpg\">"); } dtImg.Clear(); stringBuilder.Append("<dt align=\"center\" >" + dt.Tables[0].Rows[s]["dt_name"].ToString() + "</dt></a></li>"); s++; } stringBuilder.Append("</ul>"); } } this.lb_show.Text = stringBuilder.ToString(); }
protected void Page_Load(object sender, EventArgs e) { string ls_page = "1", ls_pagesize = "10"; TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); //获取参数 if (this.Request.QueryString["page"] != null) { ls_page = this.Request.QueryString["page"].ToString(); } if (this.Request.QueryString["pagesize"] != null) { ls_pagesize = this.Request.QueryString["pagesize"].ToString(); } string ls_where = " and hy_ifsh ='2' "; string ls_orderby = " order by hy_addtime desc "; JpPhotography jpPhotography = new JpPhotography(); //获取数据 string test = ""; DataTable dt = jpPhotography.SearchdocsByKey(ls_where,ls_orderby, int.Parse(ls_page), int.Parse(ls_pagesize)); Response.Write(test); //复制一个DataTalbe DataTable tempTable = dt.Clone(); //在现有的DatatTable增加一列 DataColumn col = new DataColumn("showTime", typeof(String)); //将列添加到DataTable中去 tempTable.Columns.Add(col); //在现有的DatatTable增加一列 DataColumn co2 = new DataColumn("showImg", typeof(String)); //将列添加到DataTable中去 tempTable.Columns.Add(co2); //循环 对DataTable重新赋值 for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = tempTable.NewRow(); for (int j = 0; j < dt.Columns.Count; j++) { dr[tempTable.Columns[j].ColumnName] = dt.Rows[i][j]; } //获得间隔的时间 dr["showTime"] = JpCommon.DateDiff(DateTime.Now, Convert.ToDateTime(dt.Rows[i]["hy_addtime"].ToString())); HyFileatt hyFileatt = new HyFileatt(); DataTable dt_img = hyFileatt.Getdocsfm(dt.Rows[i]["docid"].ToString()); if (dt_img.Rows.Count > 0) { dr["showImg"] = dt_img.Rows[0]["hy_filepath"].ToString(); } tempTable.Rows.Add(dr); } //转换成json格式 string strJson = JsonConvert.SerializeObject(tempTable); //数据抛出 Response.Write(strJson); }
protected void Page_Load(object sender, EventArgs e) { string strFatherid = ""; if (this.Request.QueryString["strFatherid"] != null) { strFatherid = this.Request.QueryString["strFatherid"].ToString(); } HyFileatt hyFileatt = new HyFileatt(); DataTable dt = hyFileatt.Getdocs(strFatherid,6); string json = JsonConvert.SerializeObject(dt); Response.Write(json); }
//加载图片 protected string LoadingPictures() { string ls_return = ""; //预览图片 TPortalClass.HyFileatt HyFileatt = new TPortalClass.HyFileatt(); DataTable dt = HyFileatt.Getdocs(this.txtdocid.Value,8); if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { string ls_id = dt.Rows[i]["id"].ToString(); string ls_name = dt.Rows[i]["hy_filename"].ToString(); string ls_url = dt.Rows[i]["hy_filepath"].ToString(); //string ls_url2 = dt.Rows[i]["hy_filepath"].ToString().Replace("thumbnail", "original"); ls_return += "<table width=\"130\" border=\"0\" cellpadding=\"0\" cellspacing=\"2\" bgcolor=\"#FFFFFF\""; ls_return += "style=\"float: left; margin: 2px 2px 2px 2px;font-size: 12px;\">"; ls_return += "<tr><td align=\"left\" height=\"140\" valign=\"top\">"; //ls_return += "<div class=\"pic01\"><a href='" + ls_url2 + "' onclick=\"szfm('" + ls_id + "');\" target='_blank'>"; ls_return += "<div class=\"pic01\"><a href='#' onclick=\"szfm('" + ls_id + "');\" >"; ls_return += "<img src=\"" + ls_url + "\" border=\"0\" width=\"126\" height=\"126\" alt=\"" + ls_name + "(点击设置封面)\" /></a></div>"; ls_return += "<div class=\"photo_fm\">"; if (HyFileatt.IsExistByID(ls_id)) { ls_return += "<img src=\"/images/fm.png\" alt='' />"; } ls_return += "</div>"; ls_return += "<div class=\"option01\"><span style='float:left;text-align:left;'>"; if (ls_name.Length > 6) { ls_return += " " + ls_name.Substring(0, 6) + "..."; } else { ls_return += " " + ls_name; } ls_return += "</span>"; ls_return += "<span style='float:right;text-align:right;'><a href='#' onclick=\"DelInfo('" + ls_id + "');\">【删除】</a></span>"; ls_return += "</div>"; ls_return += "</td>"; ls_return += "</tr>"; ls_return += "</table>"; } } return ls_return; }
public string RptBind() { //获取数据 StringBuilder stringBuilder = new StringBuilder(); JpGoods jpGoods = new JpGoods(); string strWhere = ""; if (strType == "0") { strWhere = " and hy_cid like '" + cid + "%' and hy_ifsh='2' "; } else if (strType == "1") { strWhere = " and hy_cid like '" + cid + "%' and hy_ifsh='2' "; } else if (strType == "2") { strWhere = " and hy_cid like '" + cid + "%' and hy_ifsh='2' "; } else if (strType == "3") { strWhere = " and hy_cid like '" + cid + "%' and hy_ifsh='2' "; } DataTable dt = jpGoods.getDataByCid(10, strWhere); string strTitle = ""; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { strTitle = dt.Rows[i]["hy_goodsname"].ToString(); if (strTitle.Length > 18) { strTitle = strTitle.Substring(0, 18) + "..."; } stringBuilder.Append("<li>"); HyFileatt hyFileatt = new HyFileatt(); DataTable dt_img = hyFileatt.Getdocsfm(dt.Rows[i]["docid"].ToString()); if (dt_img.Rows.Count > 0) { stringBuilder.Append("<a onclick=\"locationDetail('" + dt.Rows[i]["hy_linkurl"].ToString() + "','" + locationType + "')\"><img src=\"" + dt_img.Rows[0]["hy_filepath"].ToString() + "\">"); } stringBuilder.Append("<h1>"); stringBuilder.Append("" + strTitle + "</h1><p class=\"fleft\">" + JpCommon.DateDiff(DateTime.Now, Convert.ToDateTime(dt.Rows[i]["hy_addtime"].ToString())) + "</p></a></li>"); } } return stringBuilder.ToString(); }
//设置封面 protected void btnSzfm_Click(object sender, EventArgs e) { TPortalClass.HyFileatt HyFileatt = new TPortalClass.HyFileatt(); DataTable dt = HyFileatt.Getdocsfm(this.txtdocid.Value); if (dt.Rows.Count > 0) { HyFileatt.id = dt.Rows[0]["id"].ToString(); HyFileatt.hy_fm = 0; HyFileatt.UpdateFM(); } HyFileatt.id = this.txtfmid.Value; HyFileatt.hy_fm = 1; HyFileatt.UpdateFM(); //操作日志 // TPortalClass.HyCommon HyCommon = new TPortalClass.HyCommon(); // HyCommon.WriteLog("设置封面", "设置封面图片ID:" + this.txtdocid.Value, this.Session["hy_id"].ToString(), this.Session["hy_name"].ToString()); Response.Write("<script>location.replace(location);</script>"); }
protected void btnDel_Click(object sender, EventArgs e) { HyFileatt hyFileatt = new HyFileatt(); DataTable dt = hyFileatt.Getdocbyid(this.delId.Value); //删除文件夹里的图片 if (dt.Rows.Count > 0) { string ls_filepath1 = Server.MapPath("~/") + dt.Rows[0]["hy_filepath"].ToString(); string ls_filepath2 = Server.MapPath("~/") + dt.Rows[0]["hy_filepath"].ToString().Replace("thumbnail", "original"); if (System.IO.File.Exists(ls_filepath1)) { System.IO.File.Delete(ls_filepath1); } if (System.IO.File.Exists(ls_filepath2)) { System.IO.File.Delete(ls_filepath2); } } hyFileatt.DeleteImg(this.delId.Value); ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>hymainajax_img('" + this.txtDocid.Value + "');</script>"); }
public void showData(string strOrder) { string ls_where = " and hy_ifsh ='2' "; string ls_orderby = " "; if (strOrder == "1") { ls_orderby += " order by praiseCount desc "; } else { ls_orderby += " order by hy_addtime desc "; } JpPhotography JpPhotography = new JpPhotography(); int colcous = 1; //获取数据 StringBuilder stringBuilder = new StringBuilder(); DataTable dt = JpPhotography.SearchdocsByKey(ls_where, ls_orderby, 1, 10); string strTitle = ""; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { strTitle = dt.Rows[i]["hy_content"].ToString(); if (strTitle.Length > 10) { strTitle = strTitle.Substring(0, 10) + "..."; } stringBuilder.Append("<li><a onclick=\"locationDetail('photo_detail.aspx?aid=" + dt.Rows[i]["id"].ToString() + "&rend=" + System.Guid.NewGuid().ToString() + "','" + locationType + "','2')\"><div class='pplist'><p class=\"ico-tx\"><img src=\"images/321tx.png\" style='width: 30px;height: 30px; display:block; float:left;'><span>" + dt.Rows[i]["hy_uid"].ToString() + "</span></p><p>" + strTitle + "</p>"); HyFileatt hyFileatt = new HyFileatt(); DataTable dt_img = hyFileatt.Getdocsfm(dt.Rows[i]["docid"].ToString()); if (dt_img.Rows.Count > 0) { stringBuilder.Append("<img src=\"" + dt_img.Rows[0]["hy_filepath"].ToString() + "\">"); } stringBuilder.Append("</div>点攒数:" + dt.Rows[i]["praiseCount"].ToString() + "</a></li>"); } } this.lb_show.Text = stringBuilder.ToString(); }
protected void Page_Load(object sender, EventArgs e) { if (this.Request.QueryString["docid"] != null) { strDocid = this.Request.QueryString["docid"].ToString(); } StringBuilder stringBuilder = new StringBuilder(); dt_expert dtExpert = new dt_expert(); dtExpert.ID = strDocid; DataSet dt = dtExpert.GetListById(); DataTable dtImg = new DataTable(); HyFileatt hyFileatt = new HyFileatt(); dtImg = hyFileatt.Getdocsfm(strDocid); stringBuilder.Append("<div class=\"exp_Bottom\">"); if (dt.Tables[0].Rows.Count > 0 && dtImg.Rows.Count > 0) { stringBuilder.Append("<img src=\"" + dtImg.Rows[0]["hy_filepath"].ToString() + "\">"); stringBuilder.Append("<span>" + dt.Tables[0].Rows[0]["dt_name"].ToString() + "</span><p>"); stringBuilder.Append(dt.Tables[0].Rows[0]["dt_summary"].ToString()); } stringBuilder.Append("</p></div>"); this.lb_show.Text = stringBuilder.ToString(); }
protected void Page_Load(object sender, EventArgs e) { if (this.Request.QueryString["id"] != null) { try { id = Convert.ToInt32(this.Request.QueryString["id"].ToString()); } catch { id = 1; } } this.lb_type.Text = "往期回顾"; JpArticle jpArticle = new JpArticle(); DataTable dt = jpArticle.GetArticleByaid(id); HyFileatt HyFileatt = new HyFileatt(); if (dt.Rows.Count > 0) { this.lb_time.Text = Convert.ToDateTime(dt.Rows[0]["crtime"].ToString()).ToString("yyyy年MM月dd日"); this.lb_title.Text = dt.Rows[0]["title"].ToString(); this.lb_article.Text = dt.Rows[0]["ht_content"].ToString(); } }
public string showActive() { StringBuilder stringBuilder = new StringBuilder(); JpActivity jpActivity = new JpActivity(); DataTable dt = jpActivity.getActive(5); HyFileatt HyFileatt = new HyFileatt(); string strTitle = ""; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { strTitle = dt.Rows[i]["hy_bt"].ToString(); if (strTitle.Length > 20) { strTitle = strTitle.Substring(0, 20) + "..."; } stringBuilder.Append("<div class=\"wszw\">" + Convert.ToDateTime(dt.Rows[i]["hy_addtime"].ToString()).ToString("mm:ss") + "</div>"); stringBuilder.Append("<div class=\"jptx\"><a onclick=\"locationDetail('active_detail.aspx?id=" + dt.Rows[i]["id"].ToString() + "&rend=" + System.Guid.NewGuid().ToString() + "','" + locationType + "','0')\" href=\"javascript:void(0);\" >"); stringBuilder.Append("<div class=\"jptxpp\">"); DataTable dt_img = HyFileatt.Getdocsfm(dt.Rows[i]["docid"].ToString()); if (dt_img.Rows.Count > 0) { stringBuilder.Append("<span><img src=\"" + dt_img.Rows[0]["hy_filepath"].ToString() + "\" alt=\"" + strTitle + "\" /></span>"); } else { stringBuilder.Append("<span><img src=\"nophoto.jpg\" alt=\"" + strTitle + "\" /></span>"); } //nophoto stringBuilder.Append("<div class=\"jptxsub\"><span>" + strTitle + "</span></a><i class=\"ico-bm\" onclick=\"hdbm('" + dt.Rows[i]["id"].ToString() + "')\" >报名</i></div>"); stringBuilder.Append("</div></a>"); stringBuilder.Append("</div>"); } } return stringBuilder.ToString(); }
protected void Page_Load(object sender, EventArgs e) { if (this.txtUid.Value != "") { this.Session["hyuid"] = this.txtUid.Value; } if (this.Request.QueryString["id"] != null) { try { id = Convert.ToInt32(this.Request.QueryString["id"].ToString()); } catch { id = 1; } } this.txtaid.Value = id.ToString(); this.txtcid.Value = "008"; this.lb_type.Text = "金点活动"; StringBuilder stringBuilder = new StringBuilder(); JpActivity jpActivity = new JpActivity(); DataTable dt = jpActivity.Getdocbyid(id); HyFileatt HyFileatt = new HyFileatt(); if (dt.Rows.Count > 0) { this.lb_time.Text = Convert.ToDateTime(dt.Rows[0]["hy_addtime"].ToString()).ToString("yyyy年MM月dd日"); this.lb_title.Text = dt.Rows[0]["hy_bt"].ToString(); DataTable dt_img = HyFileatt.Getdocs(dt.Rows[0]["docid"].ToString(), 1); if (dt_img.Rows.Count > 0) { imgPath = dt_img.Rows[0]["hy_filepath"].ToString(); } this.lb_article.Text = dt.Rows[0]["hy_content"].ToString(); } }
protected void Page_Load(object sender, EventArgs e) { string strCid = ""; int ls_page = 1, ls_pagesize = 10; string strType = ""; TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); //获取参数 if (this.Request.QueryString["cid"] != null) { strCid = this.Request.QueryString["cid"].ToString(); } if (this.Request.QueryString["page"] != null) { ls_page = Convert.ToInt32(this.Request.QueryString["page"].ToString()); } if (this.Request.QueryString["pagesize"] != null) { ls_pagesize = Convert.ToInt32(this.Request.QueryString["pagesize"].ToString()); } if (this.Request.QueryString["type"] != null) { strType = this.Request.QueryString["type"].ToString(); } JpGoods jpGoods = new JpGoods(); string strWhere = " and hy_cid like '" + strCid + "%' and hy_ifsh='2' "; if (strType == "0") { strWhere = " and hy_cid like '" + strCid + "%' and hy_ifsh='2' "; } else if (strType == "1") { strWhere = " and (hy_cid = '006001001' or hy_cid='006002001' or hy_cid='006003001' or hy_cid='006004001') and hy_ifsh='2' "; } else if (strType == "2") { strWhere = " and (hy_cid = '006001002' or hy_cid='006002002' or hy_cid='006003002' or hy_cid='006004002') and hy_ifsh='2' "; } else if (strType == "3") { strWhere = " and (hy_cid = '006001003' or hy_cid='006002003' or hy_cid='006003003' or hy_cid='006004003') and hy_ifsh='2' "; } string orderby = " order by hy_addtime desc "; //获取数据 DataTable dt = jpGoods.SearchdocsByKey(strWhere, orderby, ls_page, ls_pagesize); //复制一个DataTalbe DataTable tempTable = dt.Clone(); //在现有的DatatTable增加一列 DataColumn col = new DataColumn("showImg", typeof(String)); //将列添加到DataTable中去 tempTable.Columns.Add(col); DataColumn col2 = new DataColumn("showTime", typeof(String)); //将列添加到DataTable中去 tempTable.Columns.Add(col2); //循环 对DataTable重新赋值 for (int i = 0; i < dt.Rows.Count; i++) { DataRow dr = tempTable.NewRow(); for (int j = 0; j < dt.Columns.Count; j++) { dr[tempTable.Columns[j].ColumnName] = dt.Rows[i][j]; } //获得间隔的时间 HyFileatt hyFileatt = new HyFileatt(); DataTable dt_img = hyFileatt.Getdocsfm(dt.Rows[i]["docid"].ToString()); if (dt_img.Rows.Count > 0) { dr["showImg"] = dt_img.Rows[0]["hy_filepath"].ToString(); } dr["showTime"] = JpCommon.DateDiff(DateTime.Now, Convert.ToDateTime(dt.Rows[i]["hy_addtime"].ToString())); tempTable.Rows.Add(dr); } //转换成json格式 string strJson = JsonConvert.SerializeObject(tempTable); //数据抛出 Response.Write(strJson); }
public string showRollingActive() { StringBuilder stringBuilder = new StringBuilder(); JpActivity jpActivity = new JpActivity(); DataTable dt = jpActivity.getActive(5); HyFileatt HyFileatt = new HyFileatt(); string strTitle = ""; if (dt.Rows.Count > 0) { for (int i = 0; i < dt.Rows.Count; i++) { strTitle = dt.Rows[i]["hy_bt"].ToString(); if (strTitle.Length > 20) { strTitle = strTitle.Substring(0, 20) + "..."; } stringBuilder.Append("<li>"); stringBuilder.Append("<div class=\"slide\">"); DataTable dt_img = HyFileatt.Getdocsfm(dt.Rows[i]["docid"].ToString()); if (dt_img.Rows.Count > 0) { stringBuilder.Append("<span><a onclick=\"locationDetail('active_detail.aspx?id=" + dt.Rows[i]["id"].ToString() + "&rend=" + System.Guid.NewGuid().ToString() + "','" + locationType + "','0')\" href=\"javascript:void(0);\" ><img src=\"" + dt_img.Rows[0]["hy_filepath"].ToString() + "\" alt=\"" + strTitle + "\"/></span>"); } stringBuilder.Append("<div class=\"caption\">"); stringBuilder.Append("<p class=\"title\" >" + strTitle + "</a></p>"); stringBuilder.Append("</div>"); stringBuilder.Append("</div>"); stringBuilder.Append("</li>"); } } return stringBuilder.ToString(); }
protected void Page_Load(object sender, EventArgs e) { if (this.Request.QueryString["page"] != null) { try { pageNo = Convert.ToInt32(this.Request.QueryString["page"].ToString()); } catch { pageNo = 1; } } StringBuilder stringBuilder = new StringBuilder(); dt_expert dtExpert = new dt_expert(); DataSet dt = dtExpert.GetListPage(pageNo, pageSize, ""); DataSet dtDataSet = dtExpert.GetList(""); totalPage = dtDataSet.Tables[0].Rows.Count / pageSize; if (dtDataSet.Tables[0].Rows.Count % pageSize > 0) { totalPage++; } this.lb_page.Text = HyCommon.page("\"#Pagle\"", pageNo.ToString(), pageSize.ToString(), totalPage.ToString(), ""); DataTable dtImg = new DataTable(); HyFileatt hyFileatt = new HyFileatt(); //控制数据条数 int s = 0; if (dt.Tables[0].Rows.Count > 0) { //分行 int n = 0; if ((dt.Tables[0].Rows.Count) % 4 == 0) { n = (dt.Tables[0].Rows.Count) / (4); } else { n = ((dt.Tables[0].Rows.Count) / (4)) + 1; } //构造列 for (int i = 0; i < n; ++i) { stringBuilder.Append("<ul>"); //控制循环条件 int m = 0; if ((dt.Tables[0].Rows.Count - (i * 4)) > 4) { m = 4; } else { m = dt.Tables[0].Rows.Count - (i * 4); } for (int j = 0; j < m; j++) { dtImg = hyFileatt.Getdocsfm(dt.Tables[0].Rows[s]["ID"].ToString()); stringBuilder.Append("<li><a href=\"showExportMain.aspx?docid=" + dt.Tables[0].Rows[s]["ID"].ToString() + "&rend=" + System.Guid.NewGuid().ToString() + "\">"); if (dtImg.Rows.Count > 0) { stringBuilder.Append("<img src=\"" + dtImg.Rows[0]["hy_filepath"].ToString() + "\">"); } else { stringBuilder.Append("<img src=\"Images/Img.jpg\">"); } dtImg.Clear(); stringBuilder.Append("<dt align=\"center\" >" + dt.Tables[0].Rows[s]["dt_name"].ToString() + "</dt></a></li>"); s++; } stringBuilder.Append("</ul>"); } } this.lb_show.Text = stringBuilder.ToString(); }
protected void Page_Load(object sender, EventArgs e) { Session["uploadmessage"] = ""; Response.CacheControl = "no-cache"; string lspath = ""; string ls_fatherid = Request.Params["docid"].ToString(); string ls_userid = Request.Params["userid"].ToString(); TPortalClass.HyCommon HyCommon = new TPortalClass.HyCommon(); if (this.Page.Request.Files.Count > 0) { int k = 0; if (this.Page.Request.Files.Count > 8) { k = 8; } else { k = this.Page.Request.Files.Count; } try { for (int j = 0; j < k; j++) { HttpPostedFile uploadFile = this.Page.Request.Files[j]; if (uploadFile.ContentLength > 0) { string ls_ny = DateTime.Now.Year.ToString() + DateTime.Now.Month.ToString(); string ls_name = uploadFile.FileName; string filename = DateTime.Now.ToString("mmddhhMMss_") + uploadFile.FileName; //将附件上传到服务器目录下 lspath = Server.MapPath("~/"); //虚拟目录的位置 string lsurl1 = "/upload/original/" + ls_ny; //原图存放的文件夹 string lsurl2 = "/upload/thumbnail/" + ls_ny; //缩略图存放的文件夹 Directory.CreateDirectory(lspath + "/" + lsurl1); Directory.CreateDirectory(lspath + "/" + lsurl2); string str_path1 = lspath + "/" + lsurl1 + "/" + filename; string str_path2 = lspath + "/" + lsurl2 + "/" + filename; uploadFile.SaveAs(str_path1); //压缩图片处理 HyCommon.MakeThumbnail(str_path1, str_path2, 290, 290, "WH"); //保存数据 TPortalClass.HyFileatt HyFileatt = new TPortalClass.HyFileatt(); HyFileatt.id = System.Guid.NewGuid().ToString(); HyFileatt.hy_addtime = System.DateTime.Now.ToString("yyyy-MM-dd"); HyFileatt.hy_fatherid = ls_fatherid; HyFileatt.hy_userid = ls_userid; HyFileatt.hy_filepath = lsurl2 + "/" + filename; HyFileatt.hy_filesize = ""; if (HyFileatt.IsExist(ls_fatherid)) { HyFileatt.hy_fm = 0; } else { HyFileatt.hy_fm = 1; } if (ls_name.IndexOf(".") >= 0) { HyFileatt.hy_filename = ls_name.Substring(0, ls_name.LastIndexOf(".")); } else { HyFileatt.hy_filename = ""; } HyFileatt.Insert(); //操作日志 HyCommon.WriteLog("上传图片", "上传图片", ls_userid, ls_userid); } } } catch (Exception ex) { Response.Write("Message" + ex.ToString()); } finally { } } }
public string showScroll() { StringBuilder stringBuilder = new StringBuilder(); JpGoods jpGoods = new JpGoods(); DataTable dt = jpGoods.getNewsGood(5); string strTitle = ""; for (int i = 0; i < dt.Rows.Count; i++) { strTitle = dt.Rows[i]["hy_goodsname"].ToString(); if (strTitle.Length > 18) { strTitle = strTitle.Substring(0, 18); } stringBuilder.Append("<li>"); stringBuilder.Append("<div class=\"slide\">"); HyFileatt hyFileatt = new HyFileatt(); DataTable dt_img = hyFileatt.Getdocsfm(dt.Rows[i]["docid"].ToString()); if (dt_img.Rows.Count > 0) { stringBuilder.Append("<a onclick=\"locationDetail('" + dt.Rows[i]["hy_linkurl"].ToString() + "','" + locationType + "','0')\" ><img src=\"" + dt_img.Rows[0]["hy_filepath"].ToString() + "\" alt=\"" + strTitle + "\" >"); } stringBuilder.Append("<div class=\"caption\">"); stringBuilder.Append("<p class=\"title\">" + strTitle + "</p>"); stringBuilder.Append("</div></a>"); stringBuilder.Append("</div>"); stringBuilder.Append("</li>"); } return stringBuilder.ToString(); }