Ejemplo n.º 1
0
        public static void importTrade(Trade trade)
        {
            DataSet1.TradeDataTable tradeRows = GetTradeRows();
            DataRow[] dataRows = tradeRows.Select();
            int       number   = 0;

            if (dataRows.Length > 0)
            {
                int size = dataRows.Length;
                for (int i = 0; i < size; i++)
                {
                    if ((int)dataRows[i][15] > number)
                    {
                        number = (int)dataRows[i][15];
                    }
                }
                number++;
            }
            DataRow dataRow = tradeRows.NewRow();

            dataRow[0]  = trade.category;
            dataRow[1]  = trade.transaction;
            dataRow[2]  = trade.deadline;
            dataRow[3]  = trade.orderer;
            dataRow[4]  = trade.demander;
            dataRow[5]  = trade.contents;
            dataRow[6]  = trade.product;
            dataRow[7]  = trade.OS;
            dataRow[8]  = trade.quantity;
            dataRow[9]  = trade.price;
            dataRow[10] = trade.manager;
            dataRow[11] = trade.inspection;
            dataRow[12] = trade.bill;
            dataRow[13] = trade.modify;
            dataRow[14] = trade.registrar;
            dataRow[15] = number;
            tradeRows.Rows.Add(dataRow);
            tradeRows.WriteXml(filepath + "trade_data.xml");

            DirectoryInfo di = new DirectoryInfo(filepath + '/' + dataRow[15].ToString());

            if (!di.Exists)
            {
                di.Create();
            }
            else
            {
                di.Delete(true);
                di.Create();
            }

            return;
        }
Ejemplo n.º 2
0
        public static void Delete(int number)
        {
            DataSet1.TradeDataTable tradeRows = GetTradeRows();
            DataRow[] dataRows = tradeRows.Select();
            int       i;

            for (i = 0; i < dataRows.Length; i++)
            {
                if ((int)dataRows[i][15] == number)
                {
                    break;
                }
            }
            tradeRows.Rows[i].Delete();
            tradeRows.AcceptChanges();
            tradeRows.WriteXml(filepath + "trade_data.xml");
        }
Ejemplo n.º 3
0
        public static void Modify(int number, DateTime ins, DateTime bill)
        {
            DataSet1.TradeDataTable tradeRows = GetTradeRows();
            DataRow[] dataRows = tradeRows.Select();
            int       i;

            for (i = 0; i < dataRows.Length; i++)
            {
                if ((int)dataRows[i][15] == number)
                {
                    break;
                }
            }
            tradeRows.Rows[i][11] = ins;
            tradeRows.Rows[i][12] = bill;
            tradeRows.Rows[i][13] = DateTime.Now;
            tradeRows.AcceptChanges();
            tradeRows.WriteXml(filepath + "trade_data.xml");
        }
Ejemplo n.º 4
0
 public static DataRow[] getAllRows()
 {
     DataSet1.TradeDataTable tradeRows = GetTradeRows();
     return(tradeRows.Select());
 }