Ejemplo n.º 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);
            }
        }
Ejemplo n.º 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;
            }
        }