Пример #1
0
 private void LoadProductionRecords(DataTable currentMonth, TerraNovaFile ms, DateTime currentDay)
 {
     foreach (var row in currentMonth.AsEnumerable())
     {
         string   productionCode = row["name"].ToString();
         DateTime day            = DateTime.ParseExact(row["ts"].ToString().Substring(0, 9), "dd-MMM-yy", CultureInfo.InvariantCulture);
         decimal  quantity       = TerraNovaFile.ParseDecimal(row["value"].ToString());
         ms.AddTagBalance(currentDay, "OPIS", productionCode, day.AddDays(-1), quantity);
     }
 }
Пример #2
0
        public TerraNovaFile LoadFile(string fileName, string plant, DateTime currentDay)
        {
            Filename = fileName;

            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
            TerraNovaFile ms = new TerraNovaFile(fileName, plant);

            ms.IsCurrentDay(currentDay);
            string    fileContents = File.ReadAllText(fileName);
            DataTable dt           = Utilities.ConvertTerraNovaCSVTexttoDataTable(fileContents);

            // load current month
            DataTable currentMonthSheet = dt;

            LoadProductionRecords(currentMonthSheet, ms, currentDay);
            return(ms);
        }