예제 #1
0
        private void btnBack_Click(object sender, EventArgs e)
        {
            this.Hide();
            frmHomepage home = new frmHomepage();

            home.Show();
        }
예제 #2
0
        private void Connect_Click(object sender, EventArgs e)
        {
            con = new SqlConnection(conString);
            con.Open();
            if (con.State == System.Data.ConnectionState.Open)
            {
                string [] read = File.ReadAllLines(LowStockSettingFile);
                if (read[3] != "0")
                {
                    Alert_Box();
                }
                else
                {
                    frmHomepage hp = new frmHomepage();
                    hp.Show();
                    this.Hide();
                }
            }

            //Random rnd = new Random();
            //SqlCommand cmd = new SqlCommand();
            //cmd.Connection = con;

            //string query = "SELECT * FROM Products";
            //cmd.CommandText = query;
            //List<string> products = new List<string>();

            //using (SqlDataReader reader = cmd.ExecuteReader())
            //{
            //    while (reader.Read())
            //    {
            //        products.Add($"{reader[0]}");
            //    }
            //}

            //for (int i = 2000; i <= 2020; i++)
            //{
            //    for (int j = 0; j < 2000; j++)
            //    {
            //        string prodID = products[rnd.Next(0, products.Count - 1)];
            //        string quant = $"{rnd.Next(5, 50)}";
            //        string date = $"{i}-{rnd.Next(1, 12)}-{rnd.Next(1, 27)}";
            //        query = $"INSERT INTO Sales (ProductID, Quantity, Date) VALUES ({prodID}, {quant}, '{date}')";
            //        cmd.CommandText = query;
            //        cmd.ExecuteNonQuery();
            //    }
            //}
        }
예제 #3
0
 private void Alert_Box()
 {
     string[] text = System.IO.File.ReadAllLines(LowStockSettingFile);
     if (text[1] == "true")
     {
         string message = "Your product(s) are running low!\nPlease check the product list for more information.\n"
                          + "Would you like to check now?";
         const string caption = "Low Stock Alert";
         var          result  = MessageBox.Show(message, caption, MessageBoxButtons.YesNo);
         if (result == DialogResult.Yes)
         {
             ProductList pl = new ProductList();
             pl.Show();
             this.Hide();
         }
         else
         {
             frmHomepage hp = new frmHomepage();
             hp.Show();
             this.Hide();
         }
     }
 }