private void ReadFromCsv(string fileName) { string data = File.ReadAllText(fileName); var dataRows = data.Split("\n"); for (int i = 1; i < dataRows.Length; i++) { var parameters = new List <double>(); var dataRowStrings = dataRows[i].Split(','); for (int j = 1; j < dataRowStrings.Length - 1; j++) { parameters.Add(double.Parse(dataRowStrings[j])); } var className = dataRowStrings.Last(); Entities.Add(new Entity(parameters, className)); var classNumber = ClassNames.IndexOf(className); if (classNumber == -1) { ClassNames.Add(className); Entities.Last().ClassNumber = ClassNames.Count - 1; } else { Entities.Last().ClassNumber = classNumber; } } }
/// <summary> /// Initializes the control properties. /// </summary> protected void SetupControl() { if (StopProcessing) { calItems.StopProcessing = true; } else { calItems.ControlContext = repEvent.ControlContext = ControlContext; // Calendar properties calItems.CacheItemName = CacheItemName; calItems.CacheDependencies = CacheDependencies; calItems.CacheMinutes = CacheMinutes; calItems.CheckPermissions = CheckPermissions; calItems.ClassNames = ClassNames; calItems.CombineWithDefaultCulture = CombineWithDefaultCulture; calItems.CultureCode = CultureCode; calItems.MaxRelativeLevel = MaxRelativeLevel; calItems.OrderBy = OrderBy; calItems.WhereCondition = WhereCondition; calItems.Columns = Columns; calItems.Path = Path; calItems.SelectOnlyPublished = SelectOnlyPublished; calItems.SiteName = SiteName; calItems.FilterName = FilterName; calItems.RelationshipName = RelationshipName; calItems.RelationshipWithNodeGuid = RelationshipWithNodeGuid; calItems.RelatedNodeIsOnTheLeftSide = RelatedNodeIsOnTheLeftSide; calItems.TransformationName = TransformationName; calItems.NoEventTransformationName = NoEventTransformationName; calItems.DayField = DayField; calItems.EventEndField = EventEndField; calItems.HideDefaultDayNumber = HideDefaultDayNumber; var currentDate = TimeZoneUIMethods.ConvertDateTime(DateTime.Now, this).Date; calItems.TodaysDate = currentDate; calItems.VisibleDate = currentDate; bool detail = false; // If calendar event path is defined event is loaded in accordance to the selected path string eventPath = QueryHelper.GetString("CalendarEventPath", null); if (!String.IsNullOrEmpty(eventPath)) { detail = true; repEvent.Path = eventPath; // Set selected date to specific document TreeNode node = GetDocument(eventPath); if (node != null) { object value = node.GetValue(DayField); if (ValidationHelper.GetDateTimeSystem(value, DateTimeHelper.ZERO_TIME) != DateTimeHelper.ZERO_TIME) { calItems.TodaysDate = TimeZoneUIMethods.ConvertDateTime((DateTime)value, this); } } } // By default select current event from current document value PageInfo currentPage = DocumentContext.CurrentPageInfo; if ((currentPage != null) && (ClassNames.IndexOf(currentPage.ClassName, StringComparison.InvariantCultureIgnoreCase) >= 0)) { detail = true; repEvent.Path = currentPage.NodeAliasPath; // Set selected date to current document object value = DocumentContext.CurrentDocument.GetValue(DayField); if (ValidationHelper.GetDateTimeSystem(value, DateTimeHelper.ZERO_TIME) != DateTimeHelper.ZERO_TIME) { calItems.SelectedDate = TimeZoneUIMethods.ConvertDateTime((DateTime)value, this).Date; calItems.VisibleDate = calItems.SelectedDate; // Get name of coupled class ID column string idColumn = DocumentContext.CurrentDocument.CoupledClassIDColumn; if (!string.IsNullOrEmpty(idColumn)) { // Set selected item ID and the ID column name so it is possible to highlight specific event in the calendar calItems.SelectedItemIDColumn = idColumn; calItems.SelectedItemID = ValidationHelper.GetInteger(DocumentContext.CurrentDocument.GetValue(idColumn), 0); } } } if (detail) { // Setup the detail repeater repEvent.Visible = true; repEvent.StopProcessing = false; repEvent.SelectedItemTransformationName = EventDetailTransformation; repEvent.ClassNames = ClassNames; repEvent.Columns = Columns; if (!String.IsNullOrEmpty(CacheItemName)) { repEvent.CacheItemName = CacheItemName + "|detail"; } repEvent.CacheDependencies = CacheDependencies; repEvent.CacheMinutes = CacheMinutes; repEvent.CheckPermissions = CheckPermissions; repEvent.CombineWithDefaultCulture = CombineWithDefaultCulture; repEvent.CultureCode = CultureCode; repEvent.SelectOnlyPublished = SelectOnlyPublished; repEvent.SiteName = SiteName; repEvent.WhereCondition = WhereCondition; } } }