Example #1
0
    /// <summary>
    /// 发送邮件
    /// </summary>
    /// <param name="recid">接受方的uuid</param>
    /// <param name="sendUid">发送方的UUID</param>
    /// <param name="title"></param>
    /// <param name="content"></param>
    /// <returns></returns>
    public Boolean InsertChat(string recuid, string sendUid, string title, string content)
    {
        string time = DateTime.Now.ToString("yyyy-MM-dd");
        //time.Replace('-', '/');
        string sql = "insert into Chat (SendUID,RecieveUID,Title,ChatContent,Time,IsRead) values (@sendid,@recid,@title,@content,@time,0)";

        //string findsql="select * from tb_User where ID=";
        //string recUid = ba.ReString(findsql+recid, null, "UUID");
        //string sendUid = ba.ReString(findsql + sendid, null, "UUID");
        SqlParameter[] pa = { new SqlParameter("@sendid", sendUid), new SqlParameter("@recid", recuid), new SqlParameter("@title", title), new SqlParameter("@content", content), new SqlParameter("@time", time) };
        ba.OpenTransaction();
        try
        {
            ba.ExecNonQuery(sql, pa);
            ba.Commit();
            return(true);
        }
        catch
        {
            ba.Roback();
            return(false);
        }
        finally
        {
            ba.Close();
        }
    }
Example #2
0
    public void AddClick(string newsId)
    {
        string sql = "update News set Click = Click + 1 where NewsID = " + newsId.ToString();

        ba.OpenTransaction();
        try
        {
            ba.ExecNonQuery(sql, null);
            ba.Commit();
        }
        catch
        {
            ba.Roback();
        }
        ba.Close();
    }