Beispiel #1
0
        public bool CapNhatInfo(string tendangnhap, string ten, string ho, string password, string birthday, int gioitinh, string sdt, string quequan, byte[] anh, int tucach, int maso)
        {
            SqlCommand cmd = new SqlCommand("sp_updateSinhVien");

            cmd.CommandType = CommandType.StoredProcedure;

            object b = anh;

            cmd.Parameters.Add("@ms", SqlDbType.Int).Value                = maso;
            cmd.Parameters.Add("@TenDN", SqlDbType.NVarChar, 20).Value    = tendangnhap;
            cmd.Parameters.Add("@Ten", SqlDbType.NVarChar, 20).Value      = ten;
            cmd.Parameters.Add("@Ho", SqlDbType.NVarChar, 20).Value       = ho;
            cmd.Parameters.Add("@password", SqlDbType.NVarChar, 20).Value = password;
            cmd.Parameters.Add("@birthday", SqlDbType.DateTime).Value     = birthday;
            cmd.Parameters.Add("@GioiTInh", SqlDbType.Int).Value          = gioitinh;
            cmd.Parameters.Add("@Sdt", SqlDbType.NVarChar, 15).Value      = sdt;
            cmd.Parameters.Add("@QueQuan", SqlDbType.NVarChar, 20).Value  = quequan;
            cmd.Parameters.Add("@Anh", SqlDbType.Image).Value             = (b == null) ? DBNull.Value : b;
            cmd.Parameters.Add("@TuCach", SqlDbType.Int).Value            = tucach;

            GlobalVariable.GVPassword = password;
            try
            {
                GlobalVariable.GVAnh = anh;
            }
            catch
            {
                GlobalVariable.GVAnh = null;
            }

            return(dangnhap.ExecuteNonQuery(cmd));
        }
        public bool RestoreUsers(int maso, int tucach)
        {
            SqlCommand cmd = new SqlCommand("sp_restoreuser");

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("@maso", SqlDbType.Int).Value = maso;
            cmd.Parameters.Add("@tc", SqlDbType.Int).Value   = tucach;

            return(dangnhap.ExecuteNonQuery(cmd));
        }
        public void updateClass(int malop, int magv, int mamh, string hocky, string namhoc, int siso, string tenLop)
        {
            SqlCommand cmd = new SqlCommand("sp_updateClass");

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("@malop", SqlDbType.Int).Value       = malop;
            cmd.Parameters.Add("@magv", SqlDbType.Int).Value        = magv;
            cmd.Parameters.Add("@mamh", SqlDbType.Int).Value        = mamh;
            cmd.Parameters.Add("@hk", SqlDbType.Char, 5).Value      = hocky;
            cmd.Parameters.Add("@namhoc", SqlDbType.Char, 15).Value = namhoc;
            cmd.Parameters.Add("@ss", SqlDbType.Int).Value          = siso;
            cmd.Parameters.Add("@tenlop", SqlDbType.Char, 15).Value = tenLop;

            dangnhap.ExecuteNonQuery(cmd);
        }
Beispiel #4
0
        public void DangKiHocPhan(int malop, int masv)
        {
            SqlCommand cmd = new SqlCommand("sp_InsertNewStudenttoClass");

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("@malop", SqlDbType.Int).Value = malop;
            cmd.Parameters.Add("@masv", SqlDbType.Int).Value  = masv;

            dangnhap.ExecuteNonQuery(cmd);
        }
        public bool CapNhatDsDiem(float tk, float gk, float ck, int masv, int malop)
        {
            SqlCommand cmd = new SqlCommand("sp_CapNhatDiem");

            cmd.CommandType = CommandType.StoredProcedure;

            // TK
            if (tk != -1)
            {
                cmd.Parameters.Add("@tk", SqlDbType.Float).Value = tk;
            }
            else
            {
                cmd.Parameters.Add("@tk", SqlDbType.Float).Value = DBNull.Value;
            }

            //GK
            if (gk != -1)
            {
                cmd.Parameters.Add("@gk", SqlDbType.Float).Value = gk;
            }
            else
            {
                cmd.Parameters.Add("@gk", SqlDbType.Float).Value = DBNull.Value;
            }

            // CK
            if (ck != -1)
            {
                cmd.Parameters.Add("@ck", SqlDbType.Float).Value = ck;
            }
            else
            {
                cmd.Parameters.Add("@ck", SqlDbType.Float).Value = DBNull.Value;
            }

            cmd.Parameters.Add("@masv", SqlDbType.Char, 15).Value = masv;
            cmd.Parameters.Add("@malop", SqlDbType.Int).Value     = malop;

            return(dangnhap.ExecuteNonQuery(cmd));
        }
        public bool insertNewSinhVien(string tendangnhap, string ten, string ho, string password, string birthday, int gioitinh, string sdt, string quequan, byte[] anh)
        {
            SqlCommand cmd = new SqlCommand("sp_insertNewSinhVien");

            cmd.CommandType = CommandType.StoredProcedure;

            object b = anh;

            cmd.Parameters.Add("@TenDN", SqlDbType.NVarChar, 20).Value    = tendangnhap;
            cmd.Parameters.Add("@Ten", SqlDbType.NVarChar, 20).Value      = ten;
            cmd.Parameters.Add("@Ho", SqlDbType.NVarChar, 20).Value       = ho;
            cmd.Parameters.Add("@password", SqlDbType.NVarChar, 20).Value = password;
            cmd.Parameters.Add("@birthday", SqlDbType.DateTime).Value     = birthday;
            cmd.Parameters.Add("@GioiTInh", SqlDbType.Int).Value          = gioitinh;
            cmd.Parameters.Add("@Sdt", SqlDbType.NVarChar, 15).Value      = sdt;
            cmd.Parameters.Add("@QueQuan", SqlDbType.NVarChar, 20).Value  = quequan;
            cmd.Parameters.Add("@Anh", SqlDbType.Image).Value             = (b == null) ? DBNull.Value : b;
            cmd.Parameters.Add("@TuCach", SqlDbType.Int).Value            = 0;

            return(dangnhap.ExecuteNonQuery(cmd));
        }