public void comboBoxHocKyLoad(ComboBox cbHK)
        {
            SqlCommand cmd = new SqlCommand("sp_GetHocKy");

            cmd.CommandType = CommandType.StoredProcedure;

            DataTable dt = dangnhap.OpenDataSet(cmd).Tables[0];

            cbHK.DataSource    = dt;
            cbHK.DisplayMember = "HocKy";
            cbHK.ValueMember   = "HocKy";
        }
Beispiel #2
0
        public void LoadThongTin(DataGridView dtgv, int d)
        {
            SqlCommand cmd = new SqlCommand("sp_GetAllP");

            cmd.CommandType = CommandType.StoredProcedure;

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

            DataTable dt = dangnhap.OpenDataSet(cmd).Tables[0];

            dtgv.DataSource = dt;
        }
        public void dataGridDsSv(DataGridView dtgv, int malop, int manv, out int tt)
        {
            SqlCommand cmd = new SqlCommand("sp_getDSSV");

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("@malop", SqlDbType.Char, 5).Value = malop;

            if (manv == -1)
            {
                cmd.Parameters.Add("@ma", SqlDbType.Char, 15).Value = DBNull.Value;
            }
            else
            {
                cmd.Parameters.Add("@ma", SqlDbType.Char, 15).Value = manv;
            }

            DataTable dt = dangnhap.OpenDataSet(cmd).Tables[0];

            dtgv.DataSource = dt;

            try
            {
                tt = Convert.ToInt32(dt.Rows[0][7]);
            }
            catch
            {
                tt = 0;
            }
        }
Beispiel #4
0
        public void loadDatatoDSLop(DataGridView dtgv, int tc, int ms)
        {
            SqlCommand cmd = new SqlCommand("sp_GetClassInfo");

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("@hk", SqlDbType.Char, 5).Value      = "";
            cmd.Parameters.Add("@namhoc", SqlDbType.Char, 15).Value = "";
            cmd.Parameters.Add("@tc", SqlDbType.Int).Value          = tc;
            cmd.Parameters.Add("@ms", SqlDbType.Int).Value          = ms;
            cmd.Parameters.Add("@dadk", SqlDbType.Int).Value        = 0;

            DataTable dt = dangnhap.OpenDataSet(cmd).Tables[0];

            dtgv.DataSource = dt;
        }
Beispiel #5
0
        public void loadThongTin(TextBox txtTen, TextBox txtHo, DateTimePicker txtNgaySinh, ComboBox txtGioiTinh, TextBox txtSdt, TextBox txtQueQuan, TextBox txtTenDN, TextBox txtPass)
        {
            SqlCommand cmd = new SqlCommand("sp_GetInfo");

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("@ms", SqlDbType.Int).Value = GlobalVariable.GVMaSo;
            cmd.Parameters.Add("@tc", SqlDbType.Int).Value = GlobalVariable.GVTuCach;

            DataTable dt = dangnhap.OpenDataSet(cmd).Tables[0];

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                {
                    txtHo.Text       = dt.Rows[i][3].ToString();
                    txtTen.Text      = dt.Rows[i][2].ToString();
                    txtNgaySinh.Text = DateTime.Parse(dt.Rows[i][5].ToString()).ToString();
                    txtGioiTinh.Text = (Convert.ToInt32(dt.Rows[i][6]) == 1) ? "Nam" : "Nữ";
                    txtSdt.Text      = dt.Rows[i][7].ToString();
                    txtQueQuan.Text  = dt.Rows[i][8].ToString();
                    txtTenDN.Text    = dt.Rows[i][1].ToString();
                    txtPass.Text     = dt.Rows[i][4].ToString();
                }
            }
        }
        public bool checkDangNhap(TextBox txtMaSo, TextBox txtPass)
        {
            SqlCommand cmd = new SqlCommand("sp_GetAllPerson");

            cmd.CommandType = CommandType.StoredProcedure;

            string maso     = Convert.ToString(txtMaSo.Text);
            string password = txtPass.Text;

            string    passdt, tendangnhap;
            int       daxoa;
            DataTable dt = dangnhap.OpenDataSet(cmd).Tables[0];

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                tendangnhap = Convert.ToString(dt.Rows[i][0]);
                passdt      = dt.Rows[i][1].ToString();
                daxoa       = Convert.ToInt32(dt.Rows[i][4]);

                if (maso == tendangnhap && password == passdt && daxoa == 0)
                {
                    GlobalVariable.GVtendn    = tendangnhap;
                    GlobalVariable.GVPassword = passdt;
                    GlobalVariable.GVMaSo     = Convert.ToInt32(dt.Rows[i][2]);
                    GlobalVariable.GVTuCach   = Convert.ToInt32(dt.Rows[i][3]);

                    return(true);
                }
            }
            return(false);
        }
        public bool checkTenDangNhap(string tendn)
        {
            SqlCommand cmd = new SqlCommand("sp_GetAllP");

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("@d", SqlDbType.Int).Value = DBNull.Value;

            DataTable dt = dangnhap.OpenDataSet(cmd).Tables[0];

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                if (tendn == dt.Rows[i][1].ToString())
                {
                    return(false);
                }
            }
            return(true);
        }
        public void loadThongTin(TextBox txtMaSo, TextBox txtHoTen, TextBox txtNgaySinh, TextBox txtGioiTinh, TextBox txtSdt, TextBox txtQueQuan, TextBox txtTuCach, PictureBox pictureBox)
        {
            SqlCommand cmd = new SqlCommand("sp_GetInfo");

            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("@ms", SqlDbType.Int).Value = GlobalVariable.GVMaSo;
            cmd.Parameters.Add("@tc", SqlDbType.Int).Value = GlobalVariable.GVTuCach;

            DataTable dt = dangnhap.OpenDataSet(cmd).Tables[0];

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                {
                    txtMaSo.Text     = GlobalVariable.GVMaSo.ToString();
                    txtHoTen.Text    = dt.Rows[i][3].ToString() + " " + dt.Rows[i][2].ToString();
                    txtNgaySinh.Text = DateTime.Parse(dt.Rows[i][5].ToString()).ToString();
                    txtGioiTinh.Text = (Convert.ToInt32(dt.Rows[i][6]) == 1) ? "Nam" : "Nữ";
                    txtSdt.Text      = dt.Rows[i][7].ToString();
                    txtQueQuan.Text  = dt.Rows[i][8].ToString();
                    txtTuCach.Text   = (Convert.ToInt32(dt.Rows[i][10]) == 0) ? "Sinh Viên" : (Convert.ToInt32(dt.Rows[i][10]) == 1) ? "Giảng Viên" : "Admin";
                    try
                    {
                        pictureBox.Image = Image.FromStream(new MemoryStream((byte[])(dt.Rows[i][9])));
                    }
                    catch
                    {
                    }
                    try
                    {
                        GlobalVariable.GVAnh = (byte[])(dt.Rows[i][9]);
                    }
                    catch
                    {
                        GlobalVariable.GVAnh = null;
                    }
                }
            }
        }