예제 #1
0
        internal override Column Duplicate()
        {
            ManyToMany c = new ManyToMany(ColumnId, m_Table);

            CopyTo(c);
            return(c);
        }
예제 #2
0
 internal override Column CopyTo(Column column)
 {
     if (column.ColumnType == ColumnType.ManyToMany)
     {
         ManyToMany mk = (ManyToMany)base.CopyTo(column);
         mk.m_ForeignDataSource     = m_ForeignDataSource;
         mk.m_ValueColumn           = m_ValueColumn;
         mk.m_Manytomanytype        = m_Manytomanytype;
         mk.m_ForeignIdentityColumn = m_ForeignIdentityColumn;
         mk.m_MatrixidentityColumn  = m_MatrixidentityColumn;
         mk.m_MatrixDatasource      = m_MatrixDatasource;
         mk.m_TreeParentId          = m_TreeParentId;
         mk.m_RecordsPerRow         = m_RecordsPerRow;
         mk.m_FilterExpression      = m_FilterExpression;
         mk.ConnectionString        = ConnectionString;
         mk.m_SortExpression        = m_SortExpression;
         mk.m_CheckedAlias          = m_CheckedAlias;
         mk.m_UncheckedAlias        = m_UncheckedAlias;
         mk.m_MatrixTable           = m_MatrixTable;
         return(mk);
     }
     return(base.CopyTo(column));
 }
예제 #3
0
        internal override void CopyFrom(Column column)
        {
            base.CopyFrom(column);
            if (column.ColumnType != ColumnType.ManyToMany)
            {
                return;
            }
            ManyToMany mk = (ManyToMany)column;

            m_ForeignDataSource     = mk.m_ForeignDataSource;
            m_ValueColumn           = mk.m_ValueColumn;
            m_Manytomanytype        = mk.m_Manytomanytype;
            m_ForeignIdentityColumn = mk.m_ForeignIdentityColumn;
            m_MatrixidentityColumn  = mk.m_MatrixidentityColumn;
            m_MatrixDatasource      = mk.m_MatrixDatasource;
            m_FilterExpression      = mk.m_FilterExpression;
            ConnectionString        = mk.ConnectionString;
            m_TreeParentId          = mk.m_TreeParentId;
            m_RecordsPerRow         = mk.m_RecordsPerRow;
            m_SortExpression        = mk.m_SortExpression;
            m_CheckedAlias          = mk.m_CheckedAlias;
            m_UncheckedAlias        = mk.m_UncheckedAlias;
            m_MatrixTable           = mk.m_MatrixTable;
        }
예제 #4
0
        public void ManyToMany()
        {
            Testpage.Controls.Clear();
               Grid grid = new Grid();

            ManyToMany column = new ManyToMany("column", grid.MasterTable);
            column.MatrixIdentityColumn = "EmployeeID";
            column.MatrixDataSource = "EmployeeTerritories";
            column.FilterExpression = "RegionID = 3";
            column.ValueColumn = "TerritoryDescription";
            column.ForeignDataSource = "Territories";
            column.ForeignIdentityColumn = "TerritoryID";
            column.RecordsPerRow = 4;
            column.ManyToManyType = ManyToManyType.Checkboxes;

            ManyToMany column2 = new ManyToMany("column2", grid.MasterTable);
            column2.MatrixIdentityColumn = "EmployeeID";
            column2.MatrixDataSource = "EmployeeTerritories";
            column2.FilterExpression = "RegionID = 2";
            column2.ValueColumn = "TerritoryDescription";
            column2.ForeignDataSource = "Territories";
            column2.ForeignIdentityColumn = "TerritoryID";
            column2.ManyToManyType = ManyToManyType.Multiselect;

            grid.MasterTable.Columns.Add(column);
            grid.MasterTable.Columns.Add(column2);

            SetupGrid(grid);
            grid.DisplayView = DisplayView.Detail;
            grid.StayInDetail = true;
            grid.EditIndex = "4";
            grid.DataSourceId = "Employees";
            grid.ConnectionString = ConnectionAccessOleDb;

            grid.RaisePostBackEvent("RecordUpdateClick!!False");
            StringBuilder sb = new StringBuilder();
            StringWriter sw = new StringWriter(sb);
            HtmlTextWriter gridwriter = new HtmlTextWriter(sw);
            grid.RenderControl(gridwriter);
            Assert.AreEqual(grid.MasterTable.Rows.Count, 1);
            Assert.Greater(column.Items.Count, 1);
            Assert.Greater(column2.Items.Count, 1);
            if (grid.SystemMessage.Count > 2)
                foreach (SystemMessage message in grid.SystemMessage)
                    Console.WriteLine(message.Message);

            //When running bulk tests we get an extra systemmessage because Grid.ID stored in TestPage object.
            Assert.LessOrEqual(grid.SystemMessage.Count, 2); // 15-day license key message
            Assert.AreEqual(grid.DisplayView, DisplayView.Detail);

            string[] triggerStrings = new[]
                                          {
                                              "type=\"checkbox\"",
                                              "id=\"cb_wggrid_4_column_01581\"",
                                          "for=\"cb_wggrid_4_column_01581\"",
                                              "type=\"checkbox\" id=\"cb_wggrid_4_column_55439\""
                                          };
            string content = sb.ToString();
            foreach (string part in triggerStrings)
            {
                int res = content.IndexOf(part);
                Assert.Greater(res, -1, part + Environment.NewLine + content);
            }
        }
예제 #5
0
 internal static Column GetColumnFromType(string columnName, Table table, ColumnType columnType)
 {
     Column column;
     switch (columnType)
     {
         case ColumnType.Text:
             column = new Text(columnName, table);
             break;
         case ColumnType.Number:
             column = new Number(columnName, table);
             break;
         case ColumnType.Decimal:
             column = new Decimal(columnName, table);
             break;
         case ColumnType.Checkbox:
             column = new Checkbox(columnName, table);
             break;
         case ColumnType.DateTime:
             column = new DateTime(columnName, table);
             break;
         case ColumnType.Foreignkey:
             column = new Foreignkey(columnName, table);
             break;
         case ColumnType.ManyToMany:
             column = new ManyToMany(columnName, table);
             break;
         case ColumnType.GridColumn:
             column = new GridColumn(columnName, table);
             break;
         case ColumnType.Chart:
             column = new Chart(columnName, table);
             break;
         case ColumnType.File:
             column = new File(columnName, table) { IsInDataSource = false };
             break;
         case ColumnType.Image:
             column = new Image(columnName, table) { IsInDataSource = false };
             break;
         case ColumnType.ToolTip:
             column = new ToolTipColumn(columnName, table) { IsInDataSource = false };
             break;
         case ColumnType.SystemColumn:
             column = new SystemColumn(columnName, Enums.SystemColumn.Undefined, table) { IsInDataSource = false };
             break;
         default:
             column = new UnknownColumn(columnName, table);
             break;
     }
     return column;
 }
예제 #6
0
        public void ManyToMany()
        {
            Testpage.Controls.Clear();
            Grid grid = new Grid();

            ManyToMany column = new ManyToMany("column", grid.MasterTable);

            column.MatrixIdentityColumn  = "EmployeeID";
            column.MatrixDataSource      = "EmployeeTerritories";
            column.FilterExpression      = "RegionID = 3";
            column.ValueColumn           = "TerritoryDescription";
            column.ForeignDataSource     = "Territories";
            column.ForeignIdentityColumn = "TerritoryID";
            column.RecordsPerRow         = 4;
            column.ManyToManyType        = ManyToManyType.Checkboxes;

            ManyToMany column2 = new ManyToMany("column2", grid.MasterTable);

            column2.MatrixIdentityColumn  = "EmployeeID";
            column2.MatrixDataSource      = "EmployeeTerritories";
            column2.FilterExpression      = "RegionID = 2";
            column2.ValueColumn           = "TerritoryDescription";
            column2.ForeignDataSource     = "Territories";
            column2.ForeignIdentityColumn = "TerritoryID";
            column2.ManyToManyType        = ManyToManyType.Multiselect;

            grid.MasterTable.Columns.Add(column);
            grid.MasterTable.Columns.Add(column2);

            SetupGrid(grid);
            grid.DisplayView      = DisplayView.Detail;
            grid.StayInDetail     = true;
            grid.EditIndex        = "4";
            grid.DataSourceId     = "Employees";
            grid.ConnectionString = ConnectionAccessOleDb;

            grid.RaisePostBackEvent("RecordUpdateClick!!False");
            StringBuilder  sb         = new StringBuilder();
            StringWriter   sw         = new StringWriter(sb);
            HtmlTextWriter gridwriter = new HtmlTextWriter(sw);

            grid.RenderControl(gridwriter);
            Assert.AreEqual(grid.MasterTable.Rows.Count, 1);
            Assert.Greater(column.Items.Count, 1);
            Assert.Greater(column2.Items.Count, 1);
            if (grid.SystemMessage.Count > 2)
            {
                foreach (SystemMessage message in grid.SystemMessage)
                {
                    Console.WriteLine(message.Message);
                }
            }

            //When running bulk tests we get an extra systemmessage because Grid.ID stored in TestPage object.
            Assert.LessOrEqual(grid.SystemMessage.Count, 2); // 15-day license key message
            Assert.AreEqual(grid.DisplayView, DisplayView.Detail);

            string[] triggerStrings = new[]
            {
                "type=\"checkbox\"",
                "id=\"cb_wggrid_4_column_01581\"",
                "for=\"cb_wggrid_4_column_01581\"",
                "type=\"checkbox\" id=\"cb_wggrid_4_column_55439\""
            };
            string content = sb.ToString();

            foreach (string part in triggerStrings)
            {
                int res = content.IndexOf(part);
                Assert.Greater(res, -1, part + Environment.NewLine + content);
            }
        }
예제 #7
0
 internal override Column Duplicate()
 {
     ManyToMany c = new ManyToMany(ColumnId, m_Table);
     CopyTo(c);
     return c;
 }