Esempio n. 1
0
 public void RptBind()
 {
     string strWhere = "";
     string strUid = "";
     try
     {
         strUid = this.Session["hyuid"].ToString();
     }
     catch
     {
     }
     if (strUid != "")
     {
         strWhere = " and hy_uid='" + strUid + "' ";
     }
     else
     {
         return;
     }
     JpFavorite jpFavorite = new JpFavorite();
     DataTable dt = jpFavorite.GetData(strWhere);
     StringBuilder stringBuilder = new StringBuilder();
     int commentCount = 0;
     JpComment jpComment = new JpComment();
     for (int i = 0; i < dt.Rows.Count; i++)
     {
         DataTable dtComment = jpComment.Getdocsbyaid_ysh(pis_cid, dt.Rows[i]["hy_aid"].ToString());
         commentCount = dtComment.Rows.Count;
         stringBuilder.Append("<li><a onclick=\"locationDetail('art_detail.aspx?aid=" + dt.Rows[i]["hy_aid"].ToString() + "&cid=" + dt.Rows[i]["hy_cid"].ToString() + "','" + locationType + "','1')\">" + dt.Rows[i]["hy_bt"].ToString() + "</a>");
         stringBuilder.Append("<span>" + dt.Rows[i]["hy_addtime"].ToString() + "</span>");
         stringBuilder.Append("</li>");
     }
     this.lb_show.Text = stringBuilder.ToString();
 }
Esempio n. 2
0
 public string FavoriteSaveInfo(string pis_yzm, string pis_uid, string pis_cid, string pis_aid, string pis_flag)
 {
     string pos_json = "";
     string ls_yzm = ConfigurationManager.AppSettings["Yanzm"].ToString();
     if (pis_uid != "" && pis_cid != "" && pis_aid != "" && pis_flag != "" && pis_yzm == ls_yzm)
     {
         try
         {
             TPortalClass.JpFavorite JpFavorite = new JpFavorite();
             TPortalClass.DAO db = new DAO();
             if (pis_flag == "0")
             {
                 //新增
                 int sort = 0;
                 string sql_max = "  select top 1 hy_sort   from hy_favorite  order by hy_sort  desc  ";
                 DataTable dt = db.GetDataTable(sql_max);
                 if (dt.Rows.Count > 0)
                 {
                     sort = Convert.ToInt32(dt.Rows[0]["hy_sort"].ToString()) + 1;
                 }
                 else
                 {
                     sort = 1;
                 }
                 JpFavorite.hy_addtime = System.DateTime.Now.ToString();
                 JpFavorite.hy_aid = pis_aid;
                 JpFavorite.hy_bt = "";
                 JpFavorite.hy_cid = pis_cid;
                 JpFavorite.hy_uid = pis_uid;
                 JpFavorite.hy_sort = sort;
                 JpFavorite.Insert();
                 pos_json = "{\"code\":\"0\"}";
             }
             else
             {
                 //删除
                 string sql_del = "delete from hy_favorite where hy_cid='" + pis_cid + "' and hy_uid='" + pis_uid + "' and hy_aid='" + pis_aid + "' ";
                 db.Execute(sql_del);
                 pos_json = "{\"code\":\"1\"}";
             }
         }
         catch
         {
             //系统错误
             pos_json = "{\"code\":\"2\"}";
         }
         finally
         {
         }
     }
     else
     {
         //非法调用
         pos_json = "{\"code\":\"3\"}";
     }
     return pos_json;
 }