示例#1
0
        public PrintOrder Search()
        {
            //string q = "Select * from PrintOrder";
            SqlCommand cmd = new SqlCommand("SP_OrderDetailSearch", connection.GetConnection());

            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@OrderId", OrderId);
            SqlDataReader sdr = cmd.ExecuteReader();
            PrintOrder    po  = new PrintOrder();

            while (sdr.Read())
            {
                po.OrderId      = (int)sdr["OrderId"];
                po.ProductId    = (int)sdr["ProductId"];
                po.Heigth       = (decimal)sdr["Heigth"];
                po.Width        = (decimal)sdr["Width"];
                po.Size         = (int)sdr["Size"];
                po.Quantity     = (int)sdr["Quantity"];
                po.Price        = (int)sdr["Price"];
                po.RequiredDate = (int)sdr["RequiredDate"];
                po.OrderDate    = (int)sdr["OrderDate"];
            }
            sdr.Close();
            return(po);
        }
示例#2
0
        public List <PrintOrder> ShowAll()
        {
            //string q = "Select * from PrintOrder";
            SqlCommand cmd = new SqlCommand("OrderDetailShowAll", connection.GetConnection());

            cmd.CommandType = System.Data.CommandType.StoredProcedure;
            SqlDataReader     sdr = cmd.ExecuteReader();
            List <PrintOrder> lst = new List <PrintOrder>();

            while (sdr.Read())
            {
                PrintOrder po = new PrintOrder();
                po.OrderId      = (int)sdr["OrderId"];
                po.ProductId    = (int)sdr["ProductId"];
                po.Heigth       = (decimal)sdr["Heigth"];
                po.Width        = (decimal)sdr["Width"];
                po.Size         = (int)sdr["Size"];
                po.Quantity     = (int)sdr["Quantity"];
                po.Price        = (int)sdr["Price"];
                po.RequiredDate = (int)sdr["RequiredDate"];
                po.OrderDate    = (int)sdr["OrderDate"];
                lst.Add(po);
            }
            sdr.Close();
            return(lst);
        }