protected Dictionary <int, Refectory> GetRefs(string[] refLines) { try { Dictionary <int, Refectory> ret = new Dictionary <int, Refectory>(); foreach (string line in refLines) { string[] aRef = line.Split(','); int id = int.Parse(aRef[0]); ret[id] = new Refectory { IdEvent = EVENTID, IdRefectory = id, Name = aRef[1], Capacity = int.Parse(aRef[2]), TableCapacity = int.Parse(aRef[3]), RegimeType = RegimeEnum.NONE }; } return(ret); } catch (Exception ex) { return(null); } }
private void GetRefectoryFromSpreadSheet(int row, ExcelWorksheet sheet, int EventId) { Refectory h = new Refectory(); h.Name = (string)sheet.Cells[REFECTORY_NAME + Convert.ToString(row)].Value; h.EventId = EventId; h.Persist(); Table t = new Table(); t.Name = (string)sheet.Cells[TABLE_NAME + Convert.ToString(row)].Value; t.RefectoryId = h.Id; try { t.Capacity = Convert.ToInt32(sheet.Cells[TABLE_CAPACITY + Convert.ToString(row)].Value); } catch (Exception) { t.Capacity = 0; } try { t.RegimeType = Convertors.GetRegimeType((string)sheet.Cells[TYPE_TABLE + Convert.ToString(row)].Value.ToString().ToLowerInvariant()); } catch (Exception) { t.RegimeType = RegimeEnum.NONE; } t.Persist(); }
private void EnsureLoaded() { if (this.IsAllDataLoaded) { return; //data already loaded } //Get list of attendees this.attendees = EventAttendee.GetAttendeeList(this.CurrentEvent.Id); if (this.attendees == null) { throw new System.NullReferenceException(string.Format("No Attendee registered yet for the event at {0}, starting on {1}" , this.CurrentEvent.Place , this.CurrentEvent.StartDate.ToString())); } //Get attendees information this.attendeesInfo = User.GetRegisteredUsersPerEventId(this.CurrentEvent.Id); if (this.attendeesInfo == null) { throw new System.NullReferenceException(string.Format("Infos not available for registered users for the event at {0}, starting on {1}" , this.CurrentEvent.Place , this.CurrentEvent.StartDate.ToString())); } this.IsAttendeeInfoLoaded = true; //Get list of seats this.seatsInHall = Hall.GetHallSections(this.CurrentEvent.Id); if (this.seatsInHall == null) { throw new System.NullReferenceException(string.Format("Seats not availaible for the event at {0}, starting on {1}" , this.CurrentEvent.Place , this.CurrentEvent.StartDate.ToString())); } this.IsSeatsDataLoaded = true; //Get list of beds this.bedsInDorms = Dormitory.GetDormitoryList(this.CurrentEvent.Id); if (this.bedsInDorms == null) { throw new System.NullReferenceException(string.Format("Beds not availaible for the event at {0}, starting on {1}" , this.CurrentEvent.Place , this.CurrentEvent.StartDate.ToString())); } this.IsBedsDataLoaded = true; //Get list of refectories this.refectories = Refectory.GetRefectoryList(this.CurrentEvent.Id); if (this.refectories == null) { throw new System.NullReferenceException(string.Format("Tables not availaible for the event at {0}, starting on {1}" , this.CurrentEvent.Place , this.CurrentEvent.StartDate.ToString())); } //Get list of tables this.tablesInRefs = Table.GetTableList(this.CurrentEvent.Id); if (this.tablesInRefs == null) { throw new System.NullReferenceException(string.Format("Tables not availaible for the event at {0}, starting on {1}" , this.CurrentEvent.Place , this.CurrentEvent.StartDate.ToString())); } this.IsTablesDataLoaded = true; //sharing groups this.sharingGroups = SharingGroup.GetSharingGroups(this.CurrentEvent.Id); if (this.sharingGroups == null) { throw new System.NullReferenceException(string.Format("Sharing groups not availaible for the event at {0}, starting on {1}" , this.CurrentEvent.Place , this.CurrentEvent.StartDate.ToString())); } this.IsSharingGroupLoaded = true; }