Esempio n. 1
0
        public static ColumnInfo GetSvmColumnInfo(ViewsManager views, int dynamicCategoryColumnID, bool needCreate)
        {
            if (dynamicCategoryColumnID > 0)
            {
                var dynamicCategory = views.MainForm.datasetMain.DynamicColumns.FirstOrDefault(x => x.ID == dynamicCategoryColumnID);
                if (dynamicCategory == null)
                {
                    return(null);
                }

                var svmColumnName = dynamicCategory.Title + " (SVM)";

                ///////////////////////////////////////////////////////////////////////////////

                var columnInfo = views.MainForm.adapterDocuments.GetActualColumnsList()
                                 .FirstOrDefault(x => String.Compare(x.Name, svmColumnName, StringComparison.InvariantCultureIgnoreCase) == 0);
                if (columnInfo == null && needCreate)
                {
                    views.MainForm.adapterDocuments.AddExtraColumn(svmColumnName, "INTEGER", true);
                    columnInfo = views.MainForm.adapterReviewMLDocumentsNew.AddExtraColumn(svmColumnName, "INTEGER", false);
                    views.BeforeDocumentsTableLoad(true);
                    views.AfterDocumentsTableLoad(true);
                }

                return(columnInfo);
            }
            else
            {
                var columnInfo = views.MainForm.adapterDocuments.GetActualColumnsList()
                                 .FirstOrDefault(x => String.Compare(x.Name, "Proc1SVM", StringComparison.InvariantCultureIgnoreCase) == 0);
                return(columnInfo);
            }
        }