Example #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            SupplierCollection sc = new SupplierCollection();

            sc.LoadAll();
            dataGridView1.DataSource = sc.LoadedTable;
        }
        public SoldProductForm()
        {
            InitializeComponent();
            if (LoginForm.USERTYPE == "hqmanager")
            {
                BranchCollection obj = new BranchCollection();
                obj.LoadAll();
                BranchnamecomboBox1.DataSource    = obj.LoadedTable;
                BranchnamecomboBox1.ValueMember   = "Branch_ID";
                BranchnamecomboBox1.DisplayMember = "Branch_Name";
                Branchnamelabel2.Visible          = false;


                BranchProductColletion bpc = new BranchProductColletion();
                bpc.LoadAll();
                productidcomboBox2.DataSource    = bpc.LoadedTable;
                productidcomboBox2.DisplayMember = "PName";
                productidcomboBox2.ValueMember   = "PID";
                SoldproducCollection sp = new SoldproducCollection();
                sp.LoadAll();
                datecomboBox3.DataSource    = sp.LoadedTable;
                datecomboBox3.ValueMember   = "Sold_Date";
                datecomboBox3.DisplayMember = "Sold_Date";

                SupplierCollection sc = new SupplierCollection();
                sc.LoadAll();
                supplieridcomboBox4.DataSource    = sc.LoadedTable;
                supplieridcomboBox4.ValueMember   = "Supplier_ID";
                supplieridcomboBox4.DisplayMember = "Supplier_Name";
            }
            else if (LoginForm.USERTYPE == "manager")
            {
                Branchnamelabel2.Text       = LoginForm.BNAME;
                BranchnamecomboBox1.Visible = false;

                BranchProductColletion bpc = new BranchProductColletion();

                bpc.LoadAll2(LoginForm.BRCHID);
                productidcomboBox2.DataSource    = bpc.LoadedTable;
                productidcomboBox2.DisplayMember = "PName";
                productidcomboBox2.ValueMember   = "PID";
                SoldproducCollection sp = new SoldproducCollection();
                sp.LoadAll();
                datecomboBox3.DataSource    = sp.LoadedTable;
                datecomboBox3.ValueMember   = "Sold_Date";
                datecomboBox3.DisplayMember = "Sold_Date";

                SupplierCollection sc = new SupplierCollection();
                sc.LoadAll();
                supplieridcomboBox4.DataSource    = sc.LoadedTable;
                supplieridcomboBox4.ValueMember   = "Supplier_ID";
                supplieridcomboBox4.DisplayMember = "Supplier_Name";
            }
        }