Ejemplo n.º 1
0
        protected override void RunActualProcess()
        {
            var arr = ExcelHelper.ExtractDataFromExcel(@"U:\SimZukunft\RawDataForMerging\LeftoverAdressTranslationTable.xlsx", 1, "A1", "B400");

            SqlConnection.RecreateTable <AdressTranslationEntry>(Stage.Raw, Constants.PresentSlice);

            var db = SqlConnection.GetDatabaseConnection(Stage.Raw, Constants.PresentSlice).Database;

            db.BeginTransaction();
            for (var row = 1; row < arr.GetLength(0); row++)
            {
                var a = new AdressTranslationEntry();
                if (arr[row, 1] == null)
                {
                    continue;
                }

                a.OriginalStandort = (string)arr[row, 1];
                if (arr[row, 2] == null)
                {
                    throw new Exception("dst adress was null");
                }

                a.TranslatedAdress = (string)arr[row, 2];
                db.Save(a);
            }

            db.CompleteTransaction();
        }
Ejemplo n.º 2
0
        protected override void RunActualProcess()
        {
            string      fn  = CombineForRaw("LeftoverAdressTranslationTable.xlsx");
            ExcelHelper eh  = new ExcelHelper(Services.Logger, MyStage);
            var         arr = eh.ExtractDataFromExcel2(fn, 1, "A1", "B400", out var _);

            var db = Services.SqlConnectionPreparer.GetDatabaseConnection(Stage.Raw, Constants.PresentSlice);

            db.RecreateTable <AdressTranslationEntry>();
            db.BeginTransaction();
            for (var row = 0; row < arr.GetLength(0); row++)
            {
                var a = new AdressTranslationEntry();
                if (arr[row, 0] == null)
                {
                    continue;
                }

                a.OriginalStandort = (string)arr[row, 0];
                if (arr[row, 1] == null)
                {
                    throw new Exception("dst adress was null");
                }

                a.TranslatedAdress = (string)arr[row, 1];
                db.Save(a);
            }

            db.CompleteTransaction();
        }