Example #1
0
        public Users checkAccount(string tenuser, string password)
        {
            SqlParameter[] parm = new SqlParameter[]
            {
                new SqlParameter(PARM_TENUSER, SqlDbType.NVarChar, 20),
                new SqlParameter(PARM_PASSWORD, SqlDbType.NVarChar, 20),
            };
            parm[0].Value = tenuser;
            parm[1].Value = password;
            Users         cls = null;
            SqlDataReader dra = DataAccessHelper.ExecuteReader(DataAccessHelper.ConnectionString, CommandType.StoredProcedure, "tbl_User_CheckAccount", parm);

            if (dra.Read())
            {
                cls = new Users(
                    int.Parse(dra["mauser"].ToString()),
                    dra["tenuser"].ToString(),
                    dra["passwword"].ToString(),
                    dra["tenrole"].ToString(),
                    dra["trangthai"].ToString());
            }
            dra.Dispose();
            return(cls);
        }
Example #2
0
        public int Update(HocSinh hs)
        {
            SqlParameter[] parm = new SqlParameter[]
            {
                new SqlParameter(PARM_MAHOCSINH, SqlDbType.Int),
                new SqlParameter(PARM_MALOP, SqlDbType.Int),
                new SqlParameter(PARM_TENHOCSINH, SqlDbType.NVarChar, 20),
                new SqlParameter(PARM_NGAYSINH, SqlDbType.DateTime),
                new SqlParameter(PARM_GIOITINH, SqlDbType.NVarChar, 3),
                new SqlParameter(PARM_QUEQUAN, SqlDbType.NVarChar, 20),
                new SqlParameter(PARM_SODT, SqlDbType.NVarChar, 11),
                new SqlParameter(PARM_SOCMND, SqlDbType.NVarChar, 11),
            };
            parm[0].Value = hs.Mahocsinh;
            parm[1].Value = hs.Malop;
            parm[2].Value = hs.Tenhocsinh;
            parm[3].Value = hs.Ngaysinh;
            parm[4].Value = hs.Gioitinh;
            parm[5].Value = hs.Quequan;
            parm[6].Value = hs.Sodienthoai;
            parm[7].Value = hs.Socmnd;

            return(DataAccessHelper.ExecuteNonQuery(DataAccessHelper.ConnectionString, CommandType.StoredProcedure, "tbl_HocSinh_Upd", parm));
        }
Example #3
0
 public int getmaGiaoVien_Last()
 {
     return((int)DataAccessHelper.ExecuteScalar(DataAccessHelper.ConnectionString, CommandType.Text, "select top 1 magiaovien from tbl_GiaoVien order by magiaovien desc", null));
 }
Example #4
0
 public int getmaLoaiDiem_Last()
 {
     return((int)DataAccessHelper.ExecuteScalar(DataAccessHelper.ConnectionString, CommandType.Text, "select top 1 maloaidiem from tbl_LoaiDiem order by maloaidiem desc", null));
 }
Example #5
0
 public int getmaMonHoc_Last()
 {
     return((int)DataAccessHelper.ExecuteScalar(DataAccessHelper.ConnectionString, CommandType.Text, "select top 1 mamonhoc from tbl_MonHoc order by mamonhoc desc", null));
 }
Example #6
0
 public int getmaHocSinh_Last()
 {
     return((int)DataAccessHelper.ExecuteScalar(DataAccessHelper.ConnectionString, CommandType.Text, "select top 1 Mahocsinh from tbl_HocSinh order by Mahocsinh desc", null));
 }