Пример #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            Button bt = (Button)sender;

            if (Session["user_name"] != null)
            {
                try
                {
                    Write_Keep wk1 = new Write_Keep();
                    wk1.Wk_user_id1 = int.Parse(Session["user_id"].ToString());
                    wk1.Wk_wri_id1  = Convert.ToInt32(Request.QueryString["wri_id"].ToString());
                    wk1.Wk_time1    = DateTime.Now;
                    if (Write_KeepManager.scchuangzuo(wk1) == 1)
                    {
                        Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('收藏成功');</script>");
                    }
                    else
                    {
                        Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('收藏失败');</script>");
                    }
                }
                catch (Exception ex)
                {
                    Response.Write("错误原因:" + ex.Message);
                }
            }
            else
            {
                Page.ClientScript.RegisterClientScriptBlock(typeof(Object), "alert", "<script>alert('请先登录!');</script>");
            }
        }
Пример #2
0
        //用户收藏他人创作
        public static int scchuangzuo(Write_Keep wk)
        {
            string sql = "insert into Write_Keep(Wk_user_id,Wk_wri_id,Wk_time) values(@wk_user_id,@wk_wri_id,@wk_time)";

            SqlParameter[] sp = new SqlParameter[]
            {
                new SqlParameter("wk_user_id", wk.Wk_user_id1),
                new SqlParameter("wk_wri_id", wk.Wk_wri_id1),
                new SqlParameter("wk_time", wk.Wk_time1),
            };
            return(DBHelper.GetExcuteNonQuery(sql, sp));
        }
Пример #3
0
        //用户收藏他人创作

        public static int scchuangzuo(Write_Keep wk)
        {
            return(Write_KeepService.scchuangzuo(wk));
        }