Ejemplo n.º 1
0
        // GET: Report
        public ActionResult PurchaseReport()
        {
            PurchaseView1 purchaseView1 = new PurchaseView1();

            purchaseView1.PurchaseView1s = _purchaseReportManager.LoadProducts();
            return(View(purchaseView1));
        }
Ejemplo n.º 2
0
        //double availableQuantity;
        //public double GetAvailableProduct(int productId)
        //{
        //    SqlConnection sqlConnection = new SqlConnection(connectionString);
        //    sqlConnection.Open();
        //    string query = "SELECT AvailableQuantity FROM PurchaseView1 WHERE ProductId = " + productId+ " ORDER BY AvailableQuantity DESC";
        //    SqlCommand sqlCommand = new SqlCommand(query, sqlConnection);
        //    SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCommand);

        //    DataTable dataTable = new DataTable();
        //    int isFill = sqlDataAdapter.Fill(dataTable);

        //    if (dataTable.Rows.Count > 0)
        //    {

        //        availableQuantity = double.Parse(dataTable.Rows[0][0].ToString());
        //    }
        //    return availableQuantity;
        //}

        public List <PurchaseView1> SearchProducts(PurchaseView1 purchaseView1)
        {
            List <PurchaseView1> purchaseView1s = new List <PurchaseView1>();
            SqlConnection        sqlConnection  = new SqlConnection(connectionString);

            sqlConnection.Open();
            string query = @"SELECT * FROM PurchaseView1 WHERE Date BETWEEN '" + purchaseView1.StartDate + "' AND '" + purchaseView1.EndDate + "'";

            SqlCommand    sqlCommand    = new SqlCommand(query, sqlConnection);
            SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();

            while (sqlDataReader.Read())
            {
                PurchaseView1 purchaseView = new PurchaseView1();
                purchaseView.Product           = sqlDataReader["Product"].ToString();
                purchaseView.Date              = sqlDataReader["Date"].ToString();
                purchaseView.AvailableQuantity = Convert.ToDouble(sqlDataReader["AvailableQuantity"].ToString());
                purchaseView.UnitPrice         = Convert.ToDouble(sqlDataReader["UnitPrice"].ToString());
                purchaseView.MRP    = Convert.ToDouble(sqlDataReader["MRP"].ToString());
                purchaseView.Profit = Convert.ToDouble(sqlDataReader["Profit"].ToString());

                purchaseView1s.Add(purchaseView);
            }
            sqlConnection.Close();

            return(purchaseView1s);
        }
Ejemplo n.º 3
0
        public List <PurchaseView1> LoadProducts()
        {
            List <PurchaseView1> purchaseView1s = new List <PurchaseView1>();
            SqlConnection        sqlConnection  = new SqlConnection(connectionString);

            sqlConnection.Open();
            string        query         = "SELECT * FROM PurchaseView1";
            SqlCommand    sqlCommand    = new SqlCommand(query, sqlConnection);
            SqlDataReader sqlDataReader = sqlCommand.ExecuteReader();

            while (sqlDataReader.Read())
            {
                PurchaseView1 purchaseView1 = new PurchaseView1();
                purchaseView1.Product           = sqlDataReader["Product"].ToString();
                purchaseView1.Date              = sqlDataReader["Date"].ToString();
                purchaseView1.AvailableQuantity = Convert.ToDouble(sqlDataReader["AvailableQuantity"].ToString());
                purchaseView1.UnitPrice         = Convert.ToDouble(sqlDataReader["UnitPrice"].ToString());
                purchaseView1.MRP    = Convert.ToDouble(sqlDataReader["MRP"].ToString());
                purchaseView1.Profit = Convert.ToDouble(sqlDataReader["Profit"].ToString());

                purchaseView1s.Add(purchaseView1);
            }
            sqlConnection.Close();

            return(purchaseView1s);
        }
Ejemplo n.º 4
0
 public ActionResult PurchaseReport(PurchaseView1 purchaseView1)
 {
     //PurchaseView1 purchaseView1 = new PurchaseView1();
     purchaseView1.PurchaseView1s = _purchaseReportManager.SearchProducts(purchaseView1);
     return(View(purchaseView1));
 }
 public List <PurchaseView1> SearchProducts(PurchaseView1 purchaseView1)
 {
     return(_purchaseReportRepository.SearchProducts(purchaseView1));
 }