Beispiel #1
0
 private void FrmMorbiditySupplyForecastAdj_Load(object sender, EventArgs e)
 {
     p      = new ProductQuantityInStock(_forecast);
     p.Dock = DockStyle.Fill;
     this.panel1.Controls.Add(p);
 }
Beispiel #2
0
        private void btnPrint_Click(object sender, EventArgs e)
        {
            //variables;
            string  ProductName;
            string  ProductType;
            int     ProductQuantityInStock;
            decimal ProductPrice;

            SqlConnection sqlcon = new SqlConnection(Globals_Class.ConnectionString);

            sqlcon.Open();
            string        cmd    = "Select ProductName, ProductType, ProductQuantityInStock, ProductPrice FROM Products";
            SqlCommand    sqlcom = new SqlCommand(cmd, sqlcon);
            SqlDataReader reader;

            reader = sqlcom.ExecuteReader();
            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    ProductName            = (reader["ProductName"].ToString());
                    ProductType            = (reader["ProductType"].ToString());
                    ProductQuantityInStock = Convert.ToInt32((reader["ProductQuantityInStock"]));
                    ProductPrice           = Convert.ToDecimal((reader["ProductPrice"]));


                    Details += "\n" + "Product Name:" + " " + ProductName + "\n" + "Product Type:" + " " + ProductType + "\n" + "Quantity in Stock:" + " " + ProductQuantityInStock.ToString() + "\n" + "Price:" + " " + ProductPrice.ToString() + "\n";
                }
            }

            reader.Close();
            sqlcon.Close();

            SqlConnection sqlcon2 = new SqlConnection(Globals_Class.ConnectionString);

            sqlcon2.Open();
            string        cmd2    = "SELECT SUM(ProductQuantityInStock) as Total FROM Products;";
            SqlCommand    sqlcom2 = new SqlCommand(cmd2, sqlcon2);
            SqlDataReader dr;

            dr = sqlcom2.ExecuteReader();
            if (dr.HasRows)
            {
                while (dr.Read())
                {
                    TotalQinStock = Convert.ToInt32((dr["Total"]));
                }
            }
            dr.Close();
            sqlcon2.Close();
            documentWriter();
        }