Beispiel #1
0
        public ImportHistory create(ImportHistory i)
        {
            import_history entity = new import_history();

            entity.event_id    = i.event_id;
            entity.comments    = i.comments;
            entity.createdate  = DateTime.Now;
            entity.errored     = i.errored;
            entity.imported    = i.imported;
            entity.imported_by = i.imported_by;
            entity.status      = i.status;
            entity.total       = i.total;
            entity.type        = i.type;
            entity.filename    = i.filename;
            this.db.import_histories.InsertOnSubmit(entity);
            this.db.SubmitChanges();
            i.id = entity.id;
            return(i);
        }
Beispiel #2
0
        public ImportHistory parseData(DataTable dt, int event_id)
        {
            ImportHistory importHistory = new ImportHistory();

            importHistory.event_id = event_id;
            importHistory.errored  = 0;
            importHistory.imported = 0;
            importHistory.total    = 0;
            foreach (DataRow row in (InternalDataCollectionBase)dt.Rows)
            {
                Session s = new Session();
                s.name = row[0].ToString();
                DateTime result1;
                if (DateTime.TryParse(row[1].ToString() + " " + row[2].ToString(), out result1))
                {
                    s.start = result1;
                }
                DateTime result2;
                if (DateTime.TryParse(row[3].ToString() + " " + row[4].ToString(), out result2))
                {
                    s.end = result2;
                }
                s.event_type        = row[5].ToString();
                s.venue             = row[6].ToString();
                s.event_id          = event_id;
                s.venue_id          = this._locations.find_venue_reference_id(s.venue, s.event_id);
                s.event_key         = "IMPORT_" + Guid.NewGuid().ToString();
                s.speakers          = row[7].ToString();
                s.speaker_companies = row[8].ToString();
                s.speaker_images    = row[9].ToString();
                if (this.insert(s))
                {
                    ++importHistory.imported;
                }
                else
                {
                    ++importHistory.errored;
                }
            }
            return(importHistory);
        }