Ejemplo n.º 1
0
        //Search by ID
        public static Order SearchID(int searchedId)
        {
            Order        aorder  = new Order();
            StreamReader sReader = new StreamReader(ordFilePath);
            string       line    = sReader.ReadLine();

            while (line != null)
            {
                string[] fields = line.Split(',');
                if (searchedId == Convert.ToInt32(fields[0]))
                {
                    aorder.OrdId         = Convert.ToInt32(fields[0]);
                    aorder.OrdClient     = ClientDA.SearchID(Convert.ToInt32(fields[1]));
                    aorder.OrdBbook      = BookDA.SearchISBN(Convert.ToInt64(fields[2]));
                    aorder.OrdDate       = Convert.ToDateTime(fields[3]);
                    aorder.OrdBkQuantity = Convert.ToInt32(fields[4]);
                    aorder.OrdCost       = Convert.ToDecimal(fields[5]);
                    aorder.OrdType       = fields[6];
                    sReader.Close();
                    return(aorder);
                }
                line = sReader.ReadLine();
            }
            sReader.Close();
            return(null);
        }
Ejemplo n.º 2
0
        //List Method
        public static void ListOrder(ListView listview)
        {
            listview.Items.Clear();

            StreamReader sReader = new StreamReader(ordFilePath);
            string       line    = sReader.ReadLine();


            while (line != null)
            {
                string[]     fields = line.Split(',');
                ListViewItem order  = new ListViewItem(fields[0]);
                order.SubItems.Add(fields[1]);
                order.SubItems.Add(fields[2]);
                order.SubItems.Add(BookDA.SearchISBN(Convert.ToInt64(fields[2])).BkTitle.ToString());
                order.SubItems.Add(BookDA.SearchISBN(Convert.ToInt64(fields[2])).BkUnitPrice.ToString());
                order.SubItems.Add(fields[4]);
                order.SubItems.Add(fields[6]);
                order.SubItems.Add(fields[3]);
                order.SubItems.Add(fields[5]);
                listview.Items.Add(order);
                line = sReader.ReadLine();
            }
            sReader.Close();
        }