Exemplo n.º 1
0
        public DrugForm(string _drugName, int _drugQuantity, float _drugPrice, string _drugDescription, DateTime _drugManufactureDate,
                        DateTime _drugExpirationDate, int _drugManufacurerID, int _drugCategoryID)
        {
            InitializeComponent();

            drugName            = _drugName;
            drugQuantity        = _drugQuantity;
            drugPrice           = _drugPrice;
            drugDescription     = _drugDescription;
            drugManufactureDate = _drugManufactureDate;
            drugExpirationDate  = _drugExpirationDate;
            drugManufacurerID   = _drugManufacurerID;
            drugCategoryID      = _drugCategoryID;

            // заповнюємо manufacturerTable
            string query = "SELECT id, name FROM manufacturer";

            manufacturerTable = DBQueries.ExecuteQuery(query, new MySqlConnection(Settings.Default.connectionString));
            foreach (DataRow dr in manufacturerTable.Rows)
            {
                CB_Drug_Manufacturer.Items.Add(dr["name"]);
            }

            // заповнюємо categoryTable
            query         = "SELECT id, name FROM category";
            categoryTable = DBQueries.ExecuteQuery(query, new MySqlConnection(Settings.Default.connectionString));
            foreach (DataRow dr in categoryTable.Rows)
            {
                CB_Drug_Category.Items.Add(dr["name"]);
            }

            FillInputBoxes();
        }
Exemplo n.º 2
0
        public static DataTable SELECTQuery()
        {
            string query = "SELECT drug.*, category.name AS cname FROM drug " +
                           "LEFT JOIN category ON drug.category_id = category.id ";

            return(DBQueries.ExecuteQuery(query, new MySqlConnection(Settings.Default.connectionString)));
        }
Exemplo n.º 3
0
        public static DataTable SELECTQuery()
        {
            string query = "SELECT * FROM category";

            return(DBQueries.ExecuteQuery(query, new MySqlConnection(Settings.Default.connectionString)));
        }