//发布 protected void btnSubmit_Click(object sender, EventArgs e) { if (this.Session["uid"] == null || this.Session["uid"].ToString() == "") { this.Response.Redirect("../login.aspx"); } string ls_tip = "发布成功!"; TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); TPortalClass.JpPhotography JpPhotography = new TPortalClass.JpPhotography(); JpPhotography.id = Convert.ToInt32(txtid.Value); JpPhotography.hy_uid = txthy_uid.Text; JpPhotography.hy_addtime = Convert.ToDateTime(txthy_addtime.Text); JpPhotography.hy_address = txthy_address.Text; JpPhotography.hy_content = txthy_content.Text; JpPhotography.hy_ifsh = 2; JpPhotography.hy_sort = Convert.ToInt32(txthy_sort.Text); JpPhotography.docid = txtDocid.Value; //写系统日志 string userip = Request.ServerVariables["HTTP_X_FORWARDED_FOR"]; if (userip == null || userip == "") { userip = Request.ServerVariables["REMOTE_ADDR"]; } JpCommon.WriteLog(userip, "发布", "发布手摄记录[id:" + this.txtid.Value + "]", Session["uid"].ToString(), Session["uname"].ToString()); JpPhotography.Update(); Response.Write("<script>alert('" + ls_tip + "');window.location='" + this.txturl.Value + "'</script>"); }
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) { 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 btn_save_Click(object sender, EventArgs e) { JpPhotography JpPhotography = new JpPhotography(); JpPhotography.hy_address = this.lb_location.Text; JpPhotography.hy_addtime = DateTime.Now; JpPhotography.hy_content = this.txtData.Value; JpPhotography.hy_ifsh = 0; DataTable dt = JpPhotography.GetMaxSort(); if (dt.Rows.Count > 0) { JpPhotography.hy_sort = Convert.ToInt32(dt.Rows[0]["hy_sort"].ToString()) + 1; } else { JpPhotography.hy_sort = 1; } JpPhotography.hy_uid = ""; JpPhotography.docid = this.txtDocid.Value; JpPhotography.Insert(); Response.Write("<script>alert('保存成功!');</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(); }
private void DataPlay() { if (this.Request.QueryString["op"] != null) { this.txtop.Value = this.Request.QueryString["op"].ToString(); //新增还是修改 } if (this.Request.QueryString["id"] != null) { this.txtid.Value = this.Request.QueryString["id"].ToString(); //文档ID } TPortalClass.JpPhotography JpPhotography = new TPortalClass.JpPhotography(); //旧文档 if (this.txtop.Value == "modify") { DataTable dt = JpPhotography.Getdocbyid(int.Parse(this.txtid.Value)); if (dt.Rows.Count > 0) { this.txtid.Value = dt.Rows[0]["id"].ToString(); this.txthy_uid.Text = dt.Rows[0]["hy_uid"].ToString(); this.txthy_content.Text = dt.Rows[0]["hy_content"].ToString(); this.txthy_address.Text = dt.Rows[0]["hy_address"].ToString(); this.txthy_addtime.Text = Convert.ToDateTime(dt.Rows[0]["hy_addtime"].ToString()).ToString("yyyy-MM-dd"); this.txthy_sort.Text = dt.Rows[0]["hy_sort"].ToString(); } } else { TPortalClass.DAO db = new TPortalClass.DAO(); string sql = "select top 1 hy_sort from hy_help order by hy_sort desc "; DataTable dt = db.GetDataTable(sql); if (dt.Rows.Count > 0) { this.txthy_sort.Text = (Convert.ToInt32(dt.Rows[0]["hy_sort"].ToString()) + 1).ToString(); } else { this.txthy_sort.Text = "1"; } } }
protected void Page_Load(object sender, EventArgs e) { if (this.Session["hyuid"] == null || this.Session["hyuid"].ToString() == "") { ifLogin = "******"; } string strwhere = " and hy_ifsh ='2' "; JpPhotography jpPhotography = new JpPhotography(); ls_totalCount = jpPhotography.SearchdocsByKeyNum(strwhere); if (!this.IsPostBack) { showData("2"); } }
public string UpdatePraise(string pis_yzm, string pis_table, string pis_id) { string pos_json = ""; string configYzm = ConfigurationManager.AppSettings["Yanzm"].ToString(); bool flag = false; if (configYzm == pis_yzm && pis_table != "" && pis_id != "") { if (pis_table == "0") { JpArticle JpArticle = new JpArticle(); flag = JpArticle.updatePraiseCount(Convert.ToInt32(pis_id)); } else if (pis_table == "1") { JpPhotography JpPhotography = new JpPhotography(); flag = JpPhotography.updatePraiseCount(Convert.ToInt32(pis_id)); } if (flag) { //点赞成功 pos_json = "{\"code\":\"0\"}"; } else { //系统错误 pos_json = "{\"code\":\"1\"}"; } } else { //非法调用 pos_json = "{\"code\":\"2\"}"; } return pos_json; }
public string GetPraiseCount(string pis_yzm, string pis_table, string pis_id) { string pos_json = ""; string configYzm = ConfigurationManager.AppSettings["Yanzm"].ToString(); bool flag = false; if (configYzm == pis_yzm && pis_table != "" && pis_id != "") { if (pis_table == "0") { JpArticle JpArticle = new JpArticle(); DataTable dt = JpArticle.GetArticleByaid(Convert.ToInt32(pis_id)); if (dt.Rows.Count > 0) { pos_json = "{\"code\":\"0\",\"praiseCount\":\"" + dt.Rows[0]["praiseCount"].ToString() + "\"}"; } else { pos_json = "{\"code\":\"0\",\"praiseCount\":\"0\"}"; } } else if (pis_table == "1") { JpPhotography JpPhotography = new JpPhotography(); DataTable dt = JpPhotography.Getdocbyid(Convert.ToInt32(pis_id)); if (dt.Rows.Count > 0) { pos_json = "{\"code\":\"0\",\"praiseCount\":\"" + dt.Rows[0]["praiseCount"].ToString() + "\"}"; } else { pos_json = "{\"code\":\"0\",\"praiseCount\":\"0\"}"; } } else { //系统错误 pos_json = "{\"code\":\"1\"}"; } } else { //非法调用 pos_json = "{\"code\":\"2\"}"; } return pos_json; }
private void RptBind() { if (this.Request.QueryString["page"] != null) this.page = int.Parse(this.Request.QueryString["page"].ToString()); else this.page = 1; this.txtKeywords.Text = this.keywords; txtPageNum.Text = this.pageSize.ToString(); txtPage.Text = this.page.ToString(); TPortalClass.JpPhotography JpPhotography = new TPortalClass.JpPhotography(); TPortalClass.JpCommon JpCommon = new TPortalClass.JpCommon(); string ls_key = JpCommon.Filter(this.txtKeywords.Text.Trim()); DataTable dt = new DataTable(); string ls_where = " and hy_content like '%" + ls_key + "%' "; dt = JpPhotography.SearchdocsByKey(ls_where, " order by hy_ifsh ", Convert.ToInt32(txtPage.Text), 10); this.totalCount = JpPhotography.SearchdocsByKeyNum(ls_where); rptList.DataSource = dt; rptList.DataBind(); string pageUrl = JpCommon.CombUrlTxt("list_photo.aspx", "page={0}&rnd={1}&keywords={2}", "__id__", "" + System.Guid.NewGuid().ToString() + "", "" + this.txtKeywords.Text + ""); PageContent.InnerHtml = JpCommon.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }