コード例 #1
0
ファイル: CSVParser.cs プロジェクト: Psela/CSVExtractor
        private HashSet<BEACHED_LANGUAGE> RowToBeachedLanguageObject(HashSet<ADDITIONAL_LANGUAGE> additionLanguages, BEACHED beached)
        {
            var listOfBeachedLangauge = new HashSet<BEACHED_LANGUAGE>();

            foreach (var additionLanguage in additionLanguages)
            {
                var beachedLanguage = new BEACHED_LANGUAGE();
               // beachedLanguage.ADDITIONAL_LANGUAGE = additionLanguage;
                beachedLanguage.LANG_ID = additionLanguage.LANG_ID;
                beachedLanguage.BEACHED_ID = beached.BEACHED_ID;
               
                listOfBeachedLangauge.Add(beachedLanguage);
            }

            return listOfBeachedLangauge;

        }
コード例 #2
0
ファイル: DatabaseWriter.cs プロジェクト: Psela/CSVExtractor
        private static void writeToBeachedTable(BEACHED consultant)
        {

            using (var context = new LPPEntities())
            {
                context.Database.Log = Console.Write;

                var Existingbeached = context.BEACHEDs.FirstOrDefault(c => c.BEACHED_ID.Equals(consultant.BEACHED_ID));
                if (Existingbeached != null)
                {
                    context.BEACHEDs.Attach(Existingbeached);

                    Existingbeached.ACADEMY = consultant.ACADEMY;
                    Existingbeached.AVAILABLE = consultant.AVAILABLE;
                    Existingbeached.PREV_PLACEMENT = consultant.PREV_PLACEMENT;
                    Existingbeached.PREV_JOB_TITLE = consultant.PREV_JOB_TITLE;
                    Existingbeached.FULL_NAME = consultant.FULL_NAME;
                    Existingbeached.STREAM = consultant.STREAM;

                    context.SaveChanges();
                }
                else
                {
                    context.BEACHEDs.Add(consultant);
                    try
                    {
                        context.SaveChanges();
                    }
                    catch (DbEntityValidationException e)
                    {
                        foreach (var item in e.EntityValidationErrors)
                        {
                            Console.WriteLine(item.ValidationErrors.ToString());
                        }

                    }
                    catch (Exception e)
                    {
                        Console.WriteLine((e.InnerException.InnerException));
                    }
                }
            }
        }
コード例 #3
0
ファイル: CSVParser.cs プロジェクト: Psela/CSVExtractor
        private BEACHED RowToBeachedObject(string[] fields)
        {
            BEACHED currentBeached = new BEACHED();

            long BeachedId;
            Int64.TryParse(fields[0], out BeachedId);
            currentBeached.BEACHED_ID = BeachedId;
            currentBeached.FULL_NAME = fields[9] + " " + fields[10];
            currentBeached.STREAM = fields[60];
            currentBeached.ACADEMY = fields[19];
            currentBeached.PREV_PLACEMENT = fields[11];
            currentBeached.PREV_JOB_TITLE = fields[12];
            currentBeached.AVAILABLE = 1;

            return currentBeached;
        }