Ejemplo n.º 1
0
        public List <BusinessObjects.Sales_BM> getSalesForChart(string connString, DateTime sDate, DateTime eDate)
        {
            try
            {
                List <BusinessObjects.Sales_BM> ProductList = new List <BusinessObjects.Sales_BM>();
                string query = "select customer_name,total, date_time,sales_id,credit,paid from _Sales ";

                SqlConnection conn = DBHelper.GetConnection(connString);

                conn.Open();

                SqlDataReader reader = DBHelper.ReadData(query, conn);
                while (reader.Read())
                {
                    BusinessObjects.Sales_BM pObj = new BusinessObjects.Sales_BM();
                    pObj.sales_id      = Convert.ToInt32(reader[3].ToString());
                    pObj.total         = Convert.ToDecimal(reader[1].ToString());
                    pObj.date_time     = Convert.ToDateTime(reader[2].ToString());
                    pObj.customer_name = reader[0].ToString();
                    pObj.credit        = Convert.ToDecimal(reader[4].ToString());
                    pObj.paid          = Convert.ToDecimal(reader[5].ToString());


                    ProductList.Add(pObj);
                }
                conn.Close();


                return(ProductList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
        public BusinessObjects.Sales_BM getSalesByIDSalesReturn(string connString, int salesID)
        {
            try
            {
                string query = "select customer_name,total, date_time,sales_id,credit,paid from _Sales WHERE sales_id= " + salesID + "";

                SqlConnection conn = DBHelper.GetConnection(connString);

                conn.Open();
                BusinessObjects.Sales_BM pObj   = new BusinessObjects.Sales_BM();
                SqlDataReader            reader = DBHelper.ReadData(query, conn);
                while (reader.Read())
                {
                    pObj.sales_id      = Convert.ToInt32(reader[3].ToString());
                    pObj.total         = Convert.ToDecimal(reader[1].ToString());
                    pObj.date_time     = Convert.ToDateTime(reader[2].ToString());
                    pObj.customer_name = reader[0].ToString();
                    pObj.credit        = Convert.ToDecimal(reader[4].ToString());
                    pObj.paid          = Convert.ToDecimal(reader[5].ToString());
                }
                conn.Close();


                return(pObj);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 3
0
        public List <BusinessObjects.Sales_BM> getSalesByP_Name(string connString, string p_nameS)
        {
            try
            {
                List <BusinessObjects.Sales_BM> ProductList = new List <BusinessObjects.Sales_BM>();
                string        query = @"exec getSalesByProductName '" + p_nameS + "' ";
                SqlConnection conn  = DBHelper.GetConnection(connString);

                conn.Open();

                SqlDataReader reader = DBHelper.ReadData(query, conn);
                while (reader.Read())
                {
                    BusinessObjects.Sales_BM pObj = new BusinessObjects.Sales_BM();
                    pObj.sales_id      = Convert.ToInt32(reader[0].ToString());
                    pObj.total         = Convert.ToDecimal(reader[2].ToString());
                    pObj.date_time     = Convert.ToDateTime(reader[4].ToString());
                    pObj.customer_name = reader[1].ToString();
                    pObj.credit        = Convert.ToDecimal(reader[3].ToString());
                    pObj.paid          = Convert.ToDecimal(reader[5].ToString());


                    ProductList.Add(pObj);
                }
                conn.Close();


                return(ProductList);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }