Exemplo n.º 1
0
    /// <summary>
    /// 添加顶操作
    /// </summary>
    /// <param name="de">顶的实例</param>
    /// <returns>添加成功返回true 失败返回false</returns>
    public static bool AddDing(DingEntity de)
    {
        DataBase db = new DataBase();
        try
        {
            string sql = string.Format("INSERT INTO tb_Ding (nid,uid,isDing) VALUES  ( '{0}', '{1}','{2}')", de.Nid, de.Uid, de.isDing);
            db.ExCommandNoBack(sql);
            DataSet rs = db.RunProcReturn("select * from tb_Ding where nid=" + de.Nid + "and uid=" + de.Uid, "tb_Ding");
            int ID = int.Parse(rs.Tables[0].Rows[0]["id"].ToString());
            if (rs.Tables[0].Rows.Count == 1)
            {
                return true;
            }
            else
            {
            string sql3 = "delete from dbo.tb_Ding where id=" + ID + "";
            db.ExCommandNoBack(sql3);
            return false;
            }

        }
        catch
        {
            return false;
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// 添加顶操作
    /// </summary>
    /// <param name="de">顶的实例</param>
    /// <returns>添加成功返回true 失败返回false</returns>
    public static bool AddDing(DingEntity de)
    {
        DataBase db = new DataBase();

        try
        {
            string sql = string.Format("INSERT INTO tb_Ding (nid,uid,isDing) VALUES  ( '{0}', '{1}','{2}')", de.Nid, de.Uid, de.isDing);
            db.ExCommandNoBack(sql);
            DataSet rs = db.RunProcReturn("select * from tb_Ding where nid=" + de.Nid + "and uid=" + de.Uid, "tb_Ding");
            int     ID = int.Parse(rs.Tables[0].Rows[0]["id"].ToString());
            if (rs.Tables[0].Rows.Count == 1)
            {
                return(true);
            }
            else
            {
                string sql3 = "delete from dbo.tb_Ding where id=" + ID + "";
                db.ExCommandNoBack(sql3);
                return(false);
            }
        }
        catch
        {
            return(false);
        }
    }
Exemplo n.º 3
0
    /// <summary>
    /// Page_Load
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        int        isDing    = 1;
        int        startline = int.Parse(Request.QueryString["startline"].ToString());
        int        cid       = int.Parse(Request.QueryString["cid"].ToString());
        DingEntity de        = new DingEntity();

        de.Uid    = UserOperation.GetCurrentUid(Session);
        de.Nid    = int.Parse(Request.QueryString["id"].ToString());
        de.isDing = isDing;
        if (DingOperation.AddDing(de) == true)
        {
            DingOperation.GetDing(de.Nid, de.Uid, de.isDing);
            Response.Redirect("LoadNotes.aspx?nid=" + de.Nid + "&cid=" + cid + "&startline=" + startline + "&isDing=" + isDing);
        }
        else
        {
            isDing = 3;
            Response.Redirect("LoadNotes.aspx?nid=" + de.Nid + "&cid=" + cid + "&startline=" + startline + "&isDing=" + isDing);
        }
    }
Exemplo n.º 4
0
    /// <summary>
    /// Page_Load
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Page_Load(object sender, EventArgs e)
    {
        int isDing = 1;
        int startline = int.Parse(Request.QueryString["startline"].ToString());
        int cid = int.Parse(Request.QueryString["cid"].ToString());
        DingEntity de = new DingEntity();
        de.Uid = UserOperation.GetCurrentUid(Session);
        de.Nid = int.Parse(Request.QueryString["id"].ToString());
        de.isDing = isDing;
        if (DingOperation.AddDing(de) == true)
        {
            DingOperation.GetDing(de.Nid, de.Uid, de.isDing);
            Response.Redirect("LoadNotes.aspx?nid=" + de.Nid + "&cid=" + cid + "&startline=" + startline + "&isDing=" + isDing);
        }
        else
        {

            isDing = 3;
            Response.Redirect("LoadNotes.aspx?nid=" + de.Nid + "&cid=" + cid + "&startline=" + startline + "&isDing=" + isDing);
        }
    }