示例#1
0
        public List <OrderR> GetAllOrder()
        {
            string        query     = "SELECT * from all_order WHERE Status='Order' ";
            List <OrderR> orderList = new List <OrderR>();

            DatabaseConnection dc = new DatabaseConnection();

            dc.ConnectWithDB();
            SqlDataReader       sdr = dc.GetData(query);
            InventoryRepository ir  = new InventoryRepository();

            while (sdr.Read())
            {
                OrderR i = new OrderR();

                i.OrderId      = sdr["OrderId"].ToString();
                i.ProductId    = sdr["ProductId"].ToString();
                i.ProductName  = sdr["ProductName"].ToString();
                i.Quantity     = Convert.ToInt32(sdr["Quantity"]);
                i.Address      = sdr["Address"].ToString();
                i.EmployeeName = sdr["EmployeeName"].ToString();
                i.Catagory     = sdr["Catagory"].ToString();
                i.Available    = ir.checkAvailable(i.ProductId);

                orderList.Add(i);
            }
            dc.CloseConnection();
            return(orderList);
        }
示例#2
0
        public List <OrderR> searchOrder(string text)
        {
            string query = "SELECT * from all_order WHERE ProductId like '%" + text + "%' or ProductName like '%" + text + "%' or Quantity like '%" + text + "%' or Address like '%" + text + "%' or EmployeeName like '%" + text + "%' ";

            List <OrderR>      iList = new List <OrderR>();
            DatabaseConnection dc    = new DatabaseConnection();

            dc.ConnectWithDB();
            SqlDataReader sdr = dc.GetData(query);

            while (sdr.Read())
            {
                OrderR i = new OrderR();

                i.OrderId      = sdr["OrderId"].ToString();
                i.ProductId    = sdr["ProductId"].ToString();
                i.ProductName  = sdr["ProductName"].ToString();
                i.Quantity     = Convert.ToInt32(sdr["Quantity"]);
                i.Address      = sdr["Address"].ToString();
                i.EmployeeName = sdr["EmployeeName"].ToString();

                iList.Add(i);
            }
            dc.CloseConnection();
            return(iList);
        }
示例#3
0
 public bool Update(OrderR i)
 {
     try
     {
         //string query = "UPDATE all_order SET  OrderId= '"+i.OrderId+"',ProductId = '" + i.ProductId + "',ProductName  = '" + i.ProductName + "', Quantity =" + i.Quantity + ", Address = '" + i.Address + "', EmployeeName = '" + i.EmployeeName + "WHERE OrderId = " + i.OrderId + " ";
         string             query = "UPDATE all_order SET  ProductId = '" + i.ProductId + "',OrderId= '" + i.OrderId + "', ProductName  = '" + i.ProductName + "', Address = '" + i.Address + "',EmployeeName = '" + i.EmployeeName + "',Quantity =" + i.Quantity + "WHERE OrderId = " + i.OrderId + " ";
         DatabaseConnection dc    = new DatabaseConnection();
         dc.ConnectWithDB();
         int x = dc.ExecuteSQL(query);
         dc.CloseConnection();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
示例#4
0
 public bool Insert(OrderR i)
 {
     try
     {
         //INSERT INTO order(OrderID,ProductId,ProductName,Quantity,Address,EmployeeID) VALUES ("y120","y180",y180,10,"basundhora","S101");
         string             query = " INSERT into all_order VALUES ('" + i.OrderId + "','" + i.ProductId + "',' " + i.ProductName + "', " + i.Quantity + ", '" + i.Address + "', '" + i.EmployeeName + "' ,'" + i.Status + "','" + i.Catagory + "' ) ";
         DatabaseConnection dc    = new DatabaseConnection();
         dc.ConnectWithDB();
         int x = dc.ExecuteSQL(query);
         dc.CloseConnection();
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
示例#5
0
        public OrderR GetProduct(string orderId)
        {
            string             query = "SELECT * from all_order WHERE OrderId = '" + orderId + "'";
            OrderR             i     = null;
            DatabaseConnection dc    = new DatabaseConnection();

            dc.ConnectWithDB();
            SqlDataReader sdr = dc.GetData(query);

            if (sdr.Read())
            {
                //(ProductName,ProductId,Volume,Price,Store,Category,Tax)
                i              = new OrderR();
                i.OrderId      = sdr["OrderId"].ToString();
                i.ProductId    = sdr["ProductId"].ToString();
                i.ProductName  = sdr["ProductName"].ToString();
                i.Quantity     = Convert.ToInt32(sdr["Quantity"]);
                i.Address      = sdr["Address"].ToString();
                i.EmployeeName = sdr["EmployeeName"].ToString();
            }
            dc.CloseConnection();
            return(i);
        }