Exemple #1
0
        private void btnquanlikho_Click(object sender, EventArgs e)
        {
            panel2.Controls.Clear();
            string[]        username = label1.Text.Split(':');
            page_nguyenlieu trangchu = new page_nguyenlieu(username[1], error);

            trangchu.form = this;
            panel2.Controls.Add(trangchu);
            //btntrangchu.BackColor = Color.Transparent;
            btntrangchu.Normalcolor  = Color.Transparent;
            btnthucdon.Normalcolor   = Color.Transparent;
            btnnhanvien.Normalcolor  = Color.Transparent;
            btnquanlikho.Normalcolor = Color.IndianRed;
            btnkhachhang.Normalcolor = Color.Transparent;
            btnthongke.Normalcolor   = Color.Transparent;
        }
Exemple #2
0
        public void phanquyen()
        {
            using (DatabaseQLTSEntities quanli = new DatabaseQLTSEntities())
            {
                string[] username = label1.Text.Split(':');
                string   user     = username[1].ToString();
                Console.WriteLine(user);
                NhanVien nv   = quanli.NhanViens.FirstOrDefault(p => p.TenDangNhap == user.Trim());
                int      macv = (int)nv.IdChucVu;
                ChucVu   cv   = quanli.ChucVus.FirstOrDefault(p => p.IdChucVu == macv);
                if (cv.BanHang == false)
                {
                    btntrangchu.Visible = false;
                }
                else
                {
                    page_banhang trangchu = new page_banhang(username[1], null);
                    panel2.Controls.Add(trangchu);
                    dem++;
                }

                if (cv.QuanLy == false)
                {
                    btnnhanvien.Visible = false;
                }
                else
                {
                    if (dem == 0)
                    {
                        page_nhanvien nhanvien = new page_nhanvien();
                        panel2.Controls.Add(nhanvien);
                        dem++;
                    }
                }
                if (cv.ThongKe == false)
                {
                    btnthongke.Visible = false;
                }
                else
                {
                    if (dem == 0)
                    {
                        page_thongke nhanvien = new page_thongke();

                        panel2.Controls.Add(nhanvien);
                        dem++;
                    }
                }
                if (cv.Kho == false)
                {
                    btnquanlikho.Visible = false;
                }

                else
                {
                    if (dem == 0)
                    {
                        page_nguyenlieu nguyenlieu = new page_nguyenlieu(username[1], erro());

                        panel2.Controls.Add(nguyenlieu);
                        dem++;
                    }
                }
                if (cv.KhachHang == false)
                {
                    btnkhachhang.Visible = false;
                }
                else
                {
                    if (dem == 0)
                    {
                        page_khachhang nhanvien = new page_khachhang();

                        panel2.Controls.Add(nhanvien);
                        dem++;
                    }
                }
            }
        }