Пример #1
0
        private void btnThemNguyenLieu_Click(object sender, EventArgs e)
        {
            bool allowAccess = false;
            List <ChucNang_LoaiTaiKhoanDTO> lsChucNang = ChucNang_LoaiTaiKhoanBUS.LayDanhSachChucNang_LoaiTaiKhoanTheoMaTaiKhoan(TaiKhoanBUS.LayTaiKhoanDangNhap());

            foreach (ChucNang_LoaiTaiKhoanDTO chucNang in lsChucNang)
            {
                if (chucNang.MaChucNang == 3)
                {
                    FrmQuanLyKho frmQuanLyKho = FrmQuanLyKho.Instance;
                    frmQuanLyKho.Resizable   = true;
                    frmQuanLyKho.Movable     = true;
                    frmQuanLyKho.ControlBox  = true;
                    frmQuanLyKho.MaximizeBox = true;
                    frmQuanLyKho.Size        = new Size(1250, 650);
                    frmQuanLyKho.FormClosed += FrmQuanLyKho_FormClosed;

                    ((FrmMain)this.ParentForm).TopMost = false;
                    frmQuanLyKho.ShowDialog();

                    return;
                }
            }
            if (!allowAccess)
            {
                MessageBox.Show("Bạn không có quyền truy cập mục này", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
Пример #2
0
        public void XuLyDangNhapThanhCong(int maTaiKhoan)
        {
            startTime = DateTime.Now;
            timer1.Start();

            panelTaiKhoan.Visible = true;
            this.WindowState      = FormWindowState.Maximized;
            XuLyFormMain();
            TaiKhoanBUS.LuuTaiKhoanDangNhap(maTaiKhoan);
            TaiKhoanDTO taiKhoan = TaiKhoanBUS.LayThongTinTaiKhoan(maTaiKhoan);

            lblHoTen.Text         = taiKhoan.HoTen;
            lblCapBac.Text        = TaiKhoanBUS.LayTenLoaiTaiKhoan(taiKhoan.LoaiTaiKhoan);
            picHinh.ImageLocation = "img\\accounts\\" + taiKhoan.Hinh;

            List <ChucNang_LoaiTaiKhoanDTO> lsChucNang_LoaiTaiKhoan = ChucNang_LoaiTaiKhoanBUS.LayDanhSachChucNang_LoaiTaiKhoanTheoMaTaiKhoan(maTaiKhoan);

            foreach (ChucNang_LoaiTaiKhoanDTO chucNang_LoaiTaiKhoan in lsChucNang_LoaiTaiKhoan)
            {
                switch (chucNang_LoaiTaiKhoan.MaChucNang)
                {
                case 1:
                    metroPanel5.Visible = true;
                    metroPanel5.BringToFront();
                    break;

                case 2:
                    metroPanel6.Visible = true;
                    metroPanel6.BringToFront();
                    break;

                case 3:
                    metroPanel10.Visible = true;
                    metroPanel10.BringToFront();
                    break;

                case 4:
                    metroPanel7.Visible = true;
                    metroPanel7.BringToFront();
                    break;

                case 5:
                    metroPanel8.Visible = true;
                    metroPanel8.BringToFront();
                    break;

                case 6:
                    metroPanel11.Visible = true;
                    metroPanel11.BringToFront();
                    break;

                case 7:
                    metroPanel13.Visible = true;
                    metroPanel13.BringToFront();
                    break;

                case 8:
                    metroPanel14.Visible = true;
                    metroPanel14.BringToFront();
                    break;

                case 9:
                    metroPanel15.Visible = true;
                    metroPanel15.BringToFront();
                    break;

                case 10:
                    metroPanel16.Visible = true;
                    metroPanel16.BringToFront();
                    break;
                }
            }
            if (metroPanel5.Visible || metroPanel6.Visible || metroPanel7.Visible || metroPanel8.Visible)
            {
                metroPanel1.Visible = true;
            }
            else
            {
                metroPanel1.Visible = false;
            }
            if (metroPanel10.Visible || metroPanel11.Visible)
            {
                metroPanel2.Visible = true;
            }
            else
            {
                metroPanel2.Visible = false;
            }
        }
        private void dgvLoaiTaiKhoan_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dgvLoaiTaiKhoan.SelectedRows.Count > 0)
            {
                LamMoiLoaiTaiKhoan(false);
                txtMaLoaiTaiKhoan.Text  = dgvLoaiTaiKhoan.SelectedRows[0].Cells["colMaLoaiTaiKhoan"].Value.ToString();
                txtTenLoaiTaiKhoan.Text = dgvLoaiTaiKhoan.SelectedRows[0].Cells["colTenLoaiTaiKhoan"].Value.ToString();
                List <ChucNang_LoaiTaiKhoanDTO> lsChucNang_LoaiTaiKhoan = ChucNang_LoaiTaiKhoanBUS.LayDanhSachChucNang_LoaiTaiKhoanTheoMaLoaiTaiKhoan(Convert.ToInt32(txtMaLoaiTaiKhoan.Text));
                foreach (ChucNang_LoaiTaiKhoanDTO chucNang_LoaiTaiKhoan in lsChucNang_LoaiTaiKhoan)
                {
                    switch (chucNang_LoaiTaiKhoan.MaChucNang)
                    {
                    case 1:
                        chkQuanLyTaiKhoan.Checked = true;
                        break;

                    case 2:
                        chkQuanLyMon.Checked = true;
                        break;

                    case 3:
                        chkQuanLyKho.Checked = true;
                        break;

                    case 4:
                        chkThongKeHoaDon.Checked = true;
                        break;

                    case 5:
                        chkThongKeNhapHang.Checked = true;
                        break;

                    case 6:
                        chkThongKeDoanhThu.Checked = true;
                        break;

                    case 7:
                        chkNhapHang.Checked = true;
                        break;

                    case 8:
                        chkBanHang.Checked = true;
                        break;

                    case 9:
                        chkBaoCao.Checked = true;
                        break;

                    case 10:
                        chkCaiDat.Checked = true;
                        break;
                    }
                }

                if (txtMaLoaiTaiKhoan.Text == "1")
                {
                    txtTenLoaiTaiKhoan.Enabled = false;
                    gpbChucNang.Enabled        = false;
                    btnSuaLoaiTaiKhoan.Enabled = false;
                    btnXoaLoaiTaiKhoan.Enabled = false;
                }
                else
                {
                    if (lnkDSLoaiTaiKhoan.AccessibleName == "DSLoaiTaiKhoan")
                    {
                        txtTenLoaiTaiKhoan.Enabled = true;
                        gpbChucNang.Enabled        = true;
                    }
                    else
                    {
                        txtTenLoaiTaiKhoan.Enabled = false;
                        gpbChucNang.Enabled        = false;
                    }
                }
            }
        }