Ejemplo n.º 1
0
        public static ArrayList GetAllBillInfo(string u)
        {
            SqlConnection conn     = new SqlConnection();
            SqlCommand    comm     = new SqlCommand();
            ArrayList     products = new ArrayList();

            try
            {
                conn.ConnectionString = GSM_CONN_STR;
                conn.Open();
                comm.Connection  = conn;
                comm.CommandText = "SELECT * from Bill where guestid=@guestid ";
                comm.Parameters.AddWithValue("@guestid", u);
                SqlDataReader dr = comm.ExecuteReader();

                while (dr.Read())
                {
                    billing p = new billing(dr["guestid"].ToString(), dr["extrabillID"].ToString(), dr["description"].ToString(), dr["fees"].ToString(), dr["quantity"].ToString(), dr["total"].ToString());
                    products.Add(p);
                }

                dr.Close();
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();
            }
            return(products);
        }
Ejemplo n.º 2
0
        private void button5_Click(object sender, EventArgs e)
        {
            string  id    = textBox1.Text;
            sales   m     = DataBase.Getsalesinfo(id);
            billing n     = DataBase.Getallbillinfobyid(id);
            double  total = 0;
            string  H     = "<html><h2 align='center'>Invoice Information</h2><body>"
                            + "<div>CusotmerID:" + id + "</div>";

            H += "<div>productID: " + m.Productid + "</div>"
                 + "<div>product Name: " + m.Productname + "</div>"
                 + "<div>prices: " + m.Price + "</div>"
                 + "<div>quantity: " + m.Quan + "</div>"
                 + "<div>total: " + m.Total + "</div>";
            H += "<br>";
            H += "<div>bill ID: " + n.Extrabillid + "</div>"
                 + "<div>description: " + n.Desc + "</div>"
                 + "<div>fees: " + n.Fees + "</div>"
                 + "<div>quantity: " + n.Qan + "</div>"
                 + "<div>total: " + n.Total + "</div>";
            H    += "<br>";
            total = Convert.ToDouble(m.Total) + Convert.ToDouble(n.Total);
            H    += "<div>Overall Total: " + total.ToString() + "</div>";
            H    += "</body></html>";

            webBrowser1.DocumentText = H;
        }
Ejemplo n.º 3
0
        public static billing Getallbillinfobyid(string guestid)
        {
            SqlConnection conn = new SqlConnection();
            SqlCommand    comm = new SqlCommand();

            billing u = new billing();

            try
            {
                conn.ConnectionString = GSM_CONN_STR;
                conn.Open();
                comm.Connection  = conn;
                comm.CommandText = "SELECT * FROM Bill WHERE guestid=@guestid ";
                comm.Parameters.AddWithValue("@guestid", guestid);
                SqlDataReader dr = comm.ExecuteReader();

                if (dr.Read())
                {
                    u.Extrabillid = (string)dr["extrabillID"];
                    u.Desc        = (string)dr["description"];
                    u.Fees        = (string)dr["fees"];
                    u.Qan         = (string)dr["quantity"];

                    u.Total = (string)dr["total"];
                }
            }
            catch (SqlException ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                conn.Close();
            }
            return(u);
        }