示例#1
0
        private void đăngNhậpToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.xuathienten.ResetText();
            dangnhap dn = new dangnhap();

            dn.ShowDialog();
            if (Form1.tinhtrang == true)
            {
                this.label11.Show();
                this.xuathienten.Show();
                this.đăngNhậpToolStripMenuItem.Enabled = false;
                label5.Text = dangnhap.tenhienthi;
                this.chứcNăngToolStripMenuItem1.Enabled = true;
                if (nduser == dangnhap.quyendangnhap)
                {
                    this.liênHệToolStripMenuItem.Enabled   = true;
                    this.adminToolStripMenuItem1.Visible   = false;
                    this.userToolStripMenuItem1.Enabled    = true;
                    this.chỉnhSửaToolStripMenuItem.Visible = true;
                    this.toolStripMenuItem6.Enabled        = true;
                    this.toolStripMenuItem7.Enabled        = false;
                }
                else if (ndadmin == dangnhap.quyendangnhap)
                {
                    this.hỗTrợToolStripMenuItem.Enabled    = false;
                    this.userToolStripMenuItem1.Visible    = false;
                    this.adminToolStripMenuItem1.Visible   = true;
                    this.chỉnhSửaToolStripMenuItem.Visible = false;
                    this.toolStripMenuItem6.Enabled        = true;
                    this.toolStripMenuItem8.Enabled        = false;
                    this.toolStripMenuItem9.Enabled        = false;
                }
            }
        }
示例#2
0
        public void LoadData1()
        {
            try
            {
                dangnhap dn = new dangnhap();
                hienthitendangnhap.Text = dangnhap.tenhienthi;

                dtdocgia = new DataTable();
                dtdocgia.Clear();
                DataSet ds1 = blDG.LayDocGiatheotendangnhap(hienthitendangnhap.Text);
                dtdocgia = ds1.Tables[0];
                // Đưa dữ liệu lên DataGridView
                dataGridView4.DataSource = dtdocgia;
                laymadocgia.Text         = this.dataGridView4.CurrentRow.Cells[0].Value.ToString();
            }

            catch (SqlException)
            {
                MessageBox.Show("Không lấy được nội dung trong table NguoiDung. Lỗi rồi!!!");
            }
        }
        //lấy dữ liệu của user tương ứng với tendangnhap
        public void LoadData2()
        {
            try
            {
                dangnhap dn = new dangnhap();
                textBox4.Text = dangnhap.tenhienthi;
                dtdocgia      = new DataTable();
                dtdocgia.Clear();
                //DataSet ds1 = dbQLTG.LayTacGia();
                DataSet ds1 = dbDG.LayDocGiatheotendangnhap(textBox4.Text);
                dtdocgia = ds1.Tables[0];
                // Đưa dữ liệu lên DataGridView
                dataGridView1.DataSource = dtdocgia;
                coidiachi.Text           = this.dataGridView1.CurrentRow.Cells[3].Value.ToString();
                coisdt.Text       = this.dataGridView1.CurrentRow.Cells[4].Value.ToString();
                coitendocgia.Text = this.dataGridView1.CurrentRow.Cells[2].Value.ToString();
            }

            catch (SqlException)
            {
                MessageBox.Show("Không lấy được nội dung trong table NguoiDung. Lỗi rồi!!!");
            }
        }