Esempio n. 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            string        mal  = txtAcc.Text;
            string        pas  = txtPass.Text;
            SqlConnection Conn = new SqlConnection(@"Data Source=QUANG\SQLEXPRESS;Initial Catalog=QLDiem_SV;Integrated Security=True");
            string        sql  = "select * from GiangVien where maGV = '" + mal + "' and MaKhoa = '" + pas + "'";

            Conn.Open();
            SqlCommand    cmd = new SqlCommand(sql, Conn);
            SqlDataReader re  = cmd.ExecuteReader();

            if (re.Read() == true)
            {
                tblNhatKy nky = new tblNhatKy(mal);
                busNhatKy.themnk(nky);
                this.Hide();
                Form nk = new Main();
                nk.ShowDialog();
                this.Close();
            }
            else
            {
                MessageBox.Show("dang nhap khong thanh cong!");
                txtPass.Text = "";
                txtAcc.Focus();
            }
        }
Esempio n. 2
0
        public static void InsertNK(tblNhatKy gv)
        {
            SqlConnection Conn    = dbConnectionData.ketnoi();
            SqlCommand    command = new SqlCommand("themnhatky", Conn);

            command.CommandType = CommandType.StoredProcedure;
            command.Parameters.Add("@MaGV", SqlDbType.NVarChar, 10);
            command.Parameters["@MaGV"].Value = gv.MaGV1;
            Conn.Open();
            command.ExecuteNonQuery();
            Conn.Close();
        }
Esempio n. 3
0
 public static void themnk(tblNhatKy nk)
 {
     dalNhatKy.InsertNK(nk);
 }