public void LoadData()
        {
            cbUserName.DataSource    = Account.GetAccountList().Tables[0].DefaultView;
            cbUserName.DisplayMember = "UserName";
            cbUserName.ValueMember   = "UserName";

            cbCongViec.DataSource    = Job.GetJobList().Tables[0].DefaultView;
            cbCongViec.DisplayMember = "Tên Công Việc";
            cbCongViec.ValueMember   = "Mã Công Việc";
        }
Example #2
0
        private void LoadData()
        {
            dtgvNhanVien.DataSource = Employee.GetEmployeeList().Tables[0].DefaultView;

            cbJob.DataSource    = Job.GetJobList().Tables[0].DefaultView;
            cbJob.DisplayMember = "Tên Công Việc";
            cbJob.ValueMember   = "Mã Công Việc";

            cbUserName.DataSource    = Account.GetAccountList().Tables[0].DefaultView;
            cbUserName.DisplayMember = "UserName";
            cbUserName.ValueMember   = "UserName";
        }
        private string AccountValidation(string username, string password)
        {
            string  flag = "";
            DataSet ds   = Account.GetAccountList();

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                string user = ds.Tables[0].Rows[i][0].ToString().Split(' ')[0];
                string pass = ds.Tables[0].Rows[i][1].ToString().Split(' ')[0];
                if (user.Equals(username) && pass.Equals(password))
                {
                    flag = ds.Tables[0].Rows[i][2].ToString();
                    break;
                }
            }
            return(flag);
        }
        private void cbTable_SelectedIndexChanged(object sender, EventArgs e)
        {
            string category = cbTable.SelectedItem.ToString();

            switch (category)
            {
            case "Customers":
            {
                DisplayTable(cbSearchAttr, dtgvTable, Customers, Customer.GetCustomerList());
                break;
            }

            case "Drinks":
            {
                DisplayTable(cbSearchAttr, dtgvTable, Drinks, Drink.GetDrinkList());
                break;
            }

            case "Elements":
            {
                DisplayTable(cbSearchAttr, dtgvTable, Elements, Element.GetElementList());
                break;
            }

            case "Employees":
            {
                DisplayTable(cbSearchAttr, dtgvTable, Employees, Employee.GetEmployeeList());
                break;
            }

            case "ImportBills":
            {
                DisplayTable(cbSearchAttr, dtgvTable, ImportBills, ImportBill.GetAllBills());
                break;
            }

            case "ExportBills":
            {
                DisplayTable(cbSearchAttr, dtgvTable, ExportBills, ExportBill.GetAllBills());
                break;
            }

            case "Jobs":
            {
                DisplayTable(cbSearchAttr, dtgvTable, Jobs, Job.GetJobList());
                break;
            }

            case "Suppliers":
            {
                DisplayTable(cbSearchAttr, dtgvTable, Suppliers, Supplier.GetSupplierList());
                break;
            }

            case "Accounts":
            {
                DisplayTable(cbSearchAttr, dtgvTable, Accounts, Account.GetAccountList());
                break;
            }
            }
        }