Beispiel #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();
        }
    }
Beispiel #2
0
    protected void Button1_Click(object sender, EventArgs e)
    {
        string grade    = DropDownList1.SelectedValue;
        string courseID = DropDownList2.SelectedValue;
        string cost     = TextBox1.Text;
        int    t;

        if (IsRepeat())
        {
            MessageForm.Show(this, "请勿添加重复的课程信息!");
            return;
        }

        if (!int.TryParse(cost, out t))
        {
            MessageForm.Show(this, "价格必须为整数!");
            return;
        }
        string sql = "insert into CourseJoin values(@tutorID,@courseID,null,@grade,@cost)";

        SqlParameter[] pa = { new SqlParameter("@tutorID", tutorID), new SqlParameter("@courseID", courseID), new SqlParameter("@grade", grade), new SqlParameter("@cost", cost) };
        ba.ExecNonQuery(sql, pa);
        bind();
        MessageForm.Show(this, "添加课程成功!");
    }
    /// <summary>
    /// 改变 预订的状态
    /// </summary>
    /// <param name="recid"></param>
    /// <param name="state">0为正在审核 1审核通过 -1取消 2结课</param>
    /// <returns></returns>
    public Boolean ChangeStateReservation(string recid, int state)
    {
        string sql = "update Reservation set ispass=@state where ReservationID=@id";

        SqlParameter[] pa   = { new SqlParameter("@id", recid), new SqlParameter("@state", state) };
        int            line = ba.ExecNonQuery(sql, pa);

        return(line > 0 ? true : false);
    }
Beispiel #4
0
    protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int rowIndex = Convert.ToInt32(e.CommandArgument.ToString()) - (this.GridView1.PageIndex * this.GridView1.PageSize);

        GridView1.Columns[8].Visible = true;
        lb_cid.Text   = CID = this.GridView1.Rows[rowIndex].Cells[8].Text;
        lb_Rname.Text = RName = getNameByUID(CID);
        GridView1.Columns[8].Visible = false;

        dialog.Attributes.Add("style", "display:block");
        background.Attributes.Add("style", "display:block");
        chatDetails.InnerText = GridView1.Rows[rowIndex].Cells[3].ToolTip;

        string sql = "update Chat set IsRead = 1 where ChatID = " + GridView1.Rows[rowIndex].Cells[7].Text;

        ba.ExecNonQuery(sql, null);
        bind();
    }
Beispiel #5
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();
    }
Beispiel #6
0
    public Boolean insertTutorComment(string TutorID, string StuID, string Comment, string Start, string Time, string ReservationID)
    { // 添加一条Reservation
        string sql = "insert into TutorComment (TutorID, StuID, Comment, Start, Time, ReservationID) values (@TutorID, @StuID, @Comment, @Start, @Time, @ReservationID)";

        SqlParameter[] pa = { new SqlParameter("@TutorID",       TutorID),
                              new SqlParameter("@StuID",         StuID),
                              new SqlParameter("@Comment",       Comment),
                              new SqlParameter("@Start",         Start),
                              new SqlParameter("@Time",          Time),
                              new SqlParameter("@ReservationID", ReservationID) };
        int            line = ba.ExecNonQuery(sql, pa);

        return(line > 0 ? true : false);
    }
Beispiel #7
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (IsLegal())
     {
         name          = TextBox1.Text.Trim();
         address       = TextBox2.Text.Trim();
         qq            = TextBox3.Text.Trim();
         guardianName  = TextBox4.Text.Trim();
         guardianPhone = TextBox5.Text.Trim();
         string         sql = "update Student set Name=@name,Address=@address,QQ=@qq,GuardianName=@guardianName,GuardianPhone=@guardianPhone where StuID = @stuID";
         SqlParameter[] pa  = { new SqlParameter("@name", name), new SqlParameter("@address", address), new SqlParameter("@qq", qq), new SqlParameter("@guardianName", guardianName), new SqlParameter("@guardianPhone", guardianPhone), new SqlParameter("@stuID", stuID) };
         ba.ExecNonQuery(sql, pa);
         MessageForm.Show(this, "修改成功!");
     }
 }
Beispiel #8
0
 private void InsertCourse(string[] cou, string[] se, int cost, string tutorid)
 {
     for (int i = 0; i < se.Length; i++)
     {
         for (int j = 0; j < cou.Length; j++)
         {
             string         sql = "insert into CourseJoin values(@id,@coursid,0,@se,@cost)";
             SqlParameter[] pa  = { new SqlParameter("@id", tutorid), new SqlParameter("@coursid", cou[j]), new SqlParameter("@se", se[i]), new SqlParameter("@cost", cost) };
             ba.ExecNonQuery(sql, pa);
         }
     }
 }