示例#1
0
    private string getNameByUID(string uid)
    {
        string re  = "";
        string sql = "";

        if (getTypeByUID(uid) == "0")
        {
            sql = "select Name from Student where StuID=@SID";
            SqlParameter[] pa = { new SqlParameter("@SID", getIDByUID(uid)) };
            re = ba.ReString(sql, pa, 0);
            return(re);
        }
        else if (getTypeByUID(uid) == "1")
        {
            sql = "select Name from Tutor where TutorID=@TID";
            SqlParameter[] pa = { new SqlParameter("@TID", getIDByUID(uid)) };
            re = ba.ReString(sql, pa, 0);
            return(re);
        }
        else if (getTypeByUID(uid) == "2")
        {
            return("管理员");
        }
        else
        {
            return("错误!");
        }
    }
    public int GetAllNumResStuBYTutorID(string id)
    {
        string sql = "select count(*) from ResStu where TutorID=@id";

        SqlParameter[] pa  = { new SqlParameter("@id", id) };
        string         num = ba.ReString(sql, pa, 0);

        return(int.Parse(num));
    }
示例#3
0
    private string InsertTutor(string mail, string qq, string sex, string name, string uni, string phone, string backtime
                               , string leavetime, string intro, string photo)
    {
        SqlParameter[] pa = { new SqlParameter("@email", mail),  new SqlParameter("@sex",      sex),
                              new SqlParameter("@qq",    qq),    new SqlParameter("@name",     name),    new SqlParameter("@Uni",        uni),
                              new SqlParameter("@phone", phone), new SqlParameter("@backtime", backtime),new SqlParameter("@leavetime",  leavetime),
                              new SqlParameter("@intro", intro), new SqlParameter("@pic",      photo) };
        string         sql = "insert into Tutor (Name,Gender,QQ,University,Phone,Photo,BackTime,LeaveTime,Mail,Intro,Rank) values (@name,@sex,@qq,@Uni,@phone,@pic,@backtime,@leavetime,@email,@intro,-1);";

        ba.ExecNonQuery(sql, pa);
        sql = "select @@IDENTITY;";
        return(ba.ReString(sql, null, 0));
    }
示例#4
0
    public Boolean CheckUser(string name)
    {
        string sql = "select count(*) from tb_user where UserName=@mail";

        SqlParameter[] pa   = { new SqlParameter("@mail", name) };
        string         temp = ba.ReString(sql, pa, 0);
        int            i    = int.Parse(temp);

        if (i > 0)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
示例#5
0
    public string GetAllComNum(string id)
    {
        string sql = "select count(*) from TutorComment where TutorID=@id";

        SqlParameter[] pa = { new SqlParameter("@id", id) };
        //DataSet ds = ba.GetDataSet(sql, pa);
        return(ba.ReString(sql, pa, 0));
    }
示例#6
0
    public int GetNewsNumByType(int type)
    {
        string sql = "";

        if (type == 0 || type == 1)
        {
            sql = "select count(*) from News where ifpass="******"select count(*) from News  ";
        }
        string re = ba.ReString(sql, null, 0);

        if (re.Trim().Equals(""))
        {
            return(0);
        }
        return(int.Parse(re));
    }