Example #1
0
        public DataTable GetActualOrdersDataTable(List <Order> orders)
        {
            try
            {
                var dataTable = SuperGrid.DefineGridColumns(
                    Translations.OrdersPage.Orders,
                    new SuperGrid.ColumnDefinition("Order", "Order", typeof(Order), inUI: false),
                    new SuperGrid.ColumnDefinition("Order Id", "Order Id", typeof(int), visible: false),
                    new SuperGrid.ColumnDefinition("Code", "Code", typeof(string), visible: true),
                    new SuperGrid.ColumnDefinition("Planned Start", "Planned Start", typeof(DateTime)),
                    new SuperGrid.ColumnDefinition("Resource", "Resource", typeof(string)),
                    new SuperGrid.ColumnDefinition("Article Number", "Article number", typeof(int)),
                    new SuperGrid.ColumnDefinition("Article", "Article", typeof(string)),
                    new SuperGrid.ColumnDefinition("Quantity", "Quantity", typeof(int)),
                    new SuperGrid.ColumnDefinition("Start Time", "Start Time", typeof(string))
                    );

                dataTable.BeginLoadData();

                foreach (var order in orders)
                {
                    Resource resource = new Resources().GetById(order.ResourceId);
                    Material material = new Materials().GetById(order.MaterialId);

                    int      id                  = order.Id;
                    string   code                = order.Code;
                    DateTime plannedStart        = order.PlannedStartDate;
                    string   resourceDescription = resource.Description;
                    int      articleNo           = material.Code;
                    string   article             = material.Description;
                    decimal  quantity            = order.TargetQuantity;
                    DateTime?startTime           = order.StartDate;

                    var row = dataTable.NewRow();

                    dataTable.Rows.Add(
                        order,
                        id,
                        code,
                        plannedStart,
                        resourceDescription,
                        articleNo,
                        article,
                        quantity,
                        startTime
                        );

                    row.AcceptChanges();
                }

                dataTable.EndLoadData();
                return(dataTable);
            }
            catch (Exception ex)
            {
                Trace.WriteError(ex.Message, Trace.GetMethodName(), CLASSNAME, ex);
                throw;
            }
        }
        public void CdlgFilterTest()
        {
            SuperGrid target = new SuperGrid(); // TODO: Initialize to an appropriate value
            string    actual;

            actual = target.CdlgFilter;
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
        public void DataTypeTest()
        {
            SuperGrid    target = new SuperGrid(); // TODO: Initialize to an appropriate value
            GridDataType actual;

            actual = target.DataType;
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
        public void LastErrorCodeTest()
        {
            SuperGrid target = new SuperGrid(); // TODO: Initialize to an appropriate value
            int       actual;

            actual = target.LastErrorCode;
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
        public void RasterColorTableColoringSchemeTest()
        {
            SuperGrid       target = new SuperGrid(); // TODO: Initialize to an appropriate value
            GridColorScheme actual;

            actual = target.RasterColorTableColoringScheme;
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
        public void MinimumTest()
        {
            SuperGrid target = new SuperGrid(); // TODO: Initialize to an appropriate value
            object    actual;

            actual = target.Minimum;
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
        public void ErrorMsgTest()
        {
            SuperGrid target    = new SuperGrid(); // TODO: Initialize to an appropriate value
            int       ErrorCode = 0;               // TODO: Initialize to an appropriate value
            string    actual;

            actual = target.get_ErrorMsg(ErrorCode);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
        public void GetHashCodeTest()
        {
            SuperGrid target   = new SuperGrid(); // TODO: Initialize to an appropriate value
            int       expected = 0;               // TODO: Initialize to an appropriate value
            int       actual;

            actual = target.GetHashCode();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
        public void CloseTest()
        {
            SuperGrid target   = new SuperGrid(); // TODO: Initialize to an appropriate value
            bool      expected = false;           // TODO: Initialize to an appropriate value
            bool      actual;

            actual = target.Close();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
        public void ToStringTest()
        {
            SuperGrid target   = new SuperGrid(); // TODO: Initialize to an appropriate value
            string    expected = string.Empty;    // TODO: Initialize to an appropriate value
            string    actual;

            actual = target.ToString();
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Example #11
0
        public DataTable GetDataTable(List <ApplicationSetting> applicationSettings)
        {
            try
            {
                var valueColumn = CurrentUser.HasPermission(ACICategory, ACIOptions.MODIFY)
          ? new SuperGrid.ColumnDefinition(
                    "Value", "Value", typeof(string), editorType: TypeExtensions.GetType(ApplicationSettings.Business.ApplicationSettings.Instance[nameof(ApplicationSettingsCategories.Actemium), $"DataType_{nameof(DataTypes.String)}_Editor"])) //TODO: Dynamic and better performance
          : new SuperGrid.ColumnDefinition("Value", "Value", typeof(string), editorType: typeof(GridLabelXEditControl));

                var dataTable = SuperGrid.DefineGridColumns(
                    Translations.ApplicationSettingsManagementForm.ApplicationSetting,
                    new SuperGrid.ColumnDefinition("ApplicationSetting", "ApplicationSetting", typeof(ApplicationSetting), inUI: false),
                    new SuperGrid.ColumnDefinition("ApplicationSettingCategory", "ApplicationSettingCategory", typeof(string), editorType: typeof(GridLabelXEditControl)),
                    new SuperGrid.ColumnDefinition("Name", "Name", typeof(string), editorType: typeof(GridLabelXEditControl)),
                    new SuperGrid.ColumnDefinition("Description", "Description", typeof(string), editorType: typeof(GridLabelXEditControl)),
                    new SuperGrid.ColumnDefinition("DataType", "DataType", typeof(string), editorType: typeof(GridLabelXEditControl)),
                    valueColumn
                    );
                dataTable.BeginLoadData();

                foreach (var item in applicationSettings)
                {
                    if (!CurrentUser.HasPermission(
                            ACICategories.APPLICATIONSETTINGSMANAGEMENT,
                            $"{ACIOptions.VIEW}_Category_{((ApplicationSettingsCategories)item.ApplicationSettingsCategoryId).ToString()}"))
                    {
                        continue;
                    }

                    var       row         = dataTable.NewRow();
                    var       name        = Translations.ApplicationSettings.TranslatedApplicationSettingsNameDictionary[item.ApplicationSettingId];
                    var       description = Translations.ApplicationSettings.TranslatedApplicationSettingsDescriptionDictionary[item.ApplicationSettingId];
                    var       category    = Translations.ApplicationSettings.TranslatedApplicationSettingsCategoryDictionary[item.ApplicationSettingsCategoryId];
                    DataTypes datatype    = (DataTypes)item.DataTypeId;

                    dataTable.Rows.Add(
                        item,
                        category,
                        name,
                        description,
                        datatype,
                        item.Value
                        );
                    row.AcceptChanges();
                }

                dataTable.EndLoadData();
                return(dataTable);
            }
            catch (Exception ex)
            {
                Trace.WriteError("()", Trace.GetMethodName(), CLASSNAME, ex);
                throw;
            }
        }
        public void GlobalCallbackTest()
        {
            SuperGrid target   = new SuperGrid(); // TODO: Initialize to an appropriate value
            ICallback expected = null;            // TODO: Initialize to an appropriate value
            ICallback actual;

            target.GlobalCallback = expected;
            actual = target.GlobalCallback;
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Example #13
0
        public DataTable GetDataTable(List <AccessControlItem> accessControlItems)
        {
            try
            {
                var definitions = new List <SuperGrid.ColumnDefinition>
                {
                    new SuperGrid.ColumnDefinition("ACI", "ACI", typeof(AccessControlItem), inUI: false),
                    new SuperGrid.ColumnDefinition("Id", "Id", typeof(int), visible: false, editorType: typeof(GridLabelXEditControl)),
                    new SuperGrid.ColumnDefinition("Category", "Category", typeof(string), editorType: typeof(GridLabelXEditControl)),
                    new SuperGrid.ColumnDefinition("Action", "Action", typeof(string), editorType: typeof(GridLabelXEditControl))
                };


                var dataTable = SuperGrid.DefineGridColumns(
                    Translations.UserManagement2Form.AccessControlItems,
                    definitions.ToArray()
                    );

                dataTable.BeginLoadData();

                foreach (var item in accessControlItems)
                {
                    var id       = item.Id;
                    var category = item.Category;
                    var action   = item.Action;

                    var row = dataTable.NewRow();

                    List <object> cells = new List <object>()
                    {
                        item,
                        id,
                        category,
                        action
                    };



                    dataTable.Rows.Add(
                        cells.ToArray()
                        );

                    row.AcceptChanges();
                }

                dataTable.EndLoadData();
                return(dataTable);
            }
            catch (Exception ex)
            {
                Trace.WriteError(ex.Message, Trace.GetMethodName(), CLASSNAME, ex);
                throw;
            }
        }
        public void AssignNewProjectionTest()
        {
            SuperGrid target     = new SuperGrid(); // TODO: Initialize to an appropriate value
            string    Projection = string.Empty;    // TODO: Initialize to an appropriate value
            bool      expected   = false;           // TODO: Initialize to an appropriate value
            bool      actual;

            actual = target.AssignNewProjection(Projection);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
        public void SetInvalidValuesToNodataTest()
        {
            SuperGrid target            = new SuperGrid(); // TODO: Initialize to an appropriate value
            double    MinThresholdValue = 0F;              // TODO: Initialize to an appropriate value
            double    MaxThresholdValue = 0F;              // TODO: Initialize to an appropriate value
            bool      expected          = false;           // TODO: Initialize to an appropriate value
            bool      actual;

            actual = target.SetInvalidValuesToNodata(MinThresholdValue, MaxThresholdValue);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Example #16
0
        public DataTable GetDataTable(List <User> users)
        {
            try
            {
                var dataTable = SuperGrid.DefineGridColumns(
                    Translations.UserManagement2Form.Users,
                    new SuperGrid.ColumnDefinition("User", "User", typeof(User), inUI: false),
                    new SuperGrid.ColumnDefinition("User Id", "User Id", typeof(int), visible: false),
                    new SuperGrid.ColumnDefinition("Username", "Username", typeof(string)),
                    new SuperGrid.ColumnDefinition("First Name", "First Name", typeof(string)),
                    new SuperGrid.ColumnDefinition("Last Name", "Last Name", typeof(string)),
                    new SuperGrid.ColumnDefinition("Account Type", "Account Type", typeof(string)),
                    new SuperGrid.ColumnDefinition("Domain", "Domain", typeof(string)),
                    new SuperGrid.ColumnDefinition("Active", "Active", typeof(bool))
                    );

                dataTable.BeginLoadData();

                foreach (var item in users)
                {
                    var id          = item.Id;
                    var username    = item.Username;
                    var firstName   = item.Name;
                    var lastName    = item.SurName;
                    var accountType = item.AccountType;
                    var domain      = item.Domain;
                    var active      = item.IsActive;
                    var row         = dataTable.NewRow();

                    dataTable.Rows.Add(
                        item,
                        id,
                        username,
                        firstName,
                        lastName,
                        accountType,
                        domain,
                        active
                        );

                    row.AcceptChanges();
                }

                dataTable.EndLoadData();
                return(dataTable);
            }
            catch (Exception ex)
            {
                Trace.WriteError(ex.Message, Trace.GetMethodName(), CLASSNAME, ex);
                throw;
            }
        }
        public void ValueTest()
        {
            SuperGrid target   = new SuperGrid(); // TODO: Initialize to an appropriate value
            int       Column   = 0;               // TODO: Initialize to an appropriate value
            int       Row      = 0;               // TODO: Initialize to an appropriate value
            object    expected = null;            // TODO: Initialize to an appropriate value
            object    actual;

            target.set_Value(Column, Row, expected);
            actual = target.get_Value(Column, Row);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
        public void SaveTest()
        {
            SuperGrid    target       = new SuperGrid();    // TODO: Initialize to an appropriate value
            string       Filename     = string.Empty;       // TODO: Initialize to an appropriate value
            GridFileType GridFileType = new GridFileType(); // TODO: Initialize to an appropriate value
            ICallback    cBack        = null;               // TODO: Initialize to an appropriate value
            bool         expected     = false;              // TODO: Initialize to an appropriate value
            bool         actual;

            actual = target.Save(Filename, GridFileType, cBack);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Example #19
0
 /// <summary>
 /// must be called when this space is created
 /// </summary>
 /// <param name="parentGrid"></param>
 /// <param name="assignedNumber"></param>
 public void initSpace(SuperGrid parentGrid, int assignedNumber)
 {
     button     = GetComponent <Button>();
     superGrid  = parentGrid;
     gridNumber = assignedNumber;
     spaceImage = GetComponent <Image>();
     for (int i = 0; i < 9; i++)
     {
         gameState[i] = GridValues.empty;
     }
     initHidenObjects();
     displaySmallGrid();
     setButtonToZoom();
 }
        public void GetRowTest()
        {
            SuperGrid target       = new SuperGrid(); // TODO: Initialize to an appropriate value
            int       Row          = 0;               // TODO: Initialize to an appropriate value
            float     Vals         = 0F;              // TODO: Initialize to an appropriate value
            float     ValsExpected = 0F;              // TODO: Initialize to an appropriate value
            bool      expected     = false;           // TODO: Initialize to an appropriate value
            bool      actual;

            actual = target.GetRow(Row, ref Vals);
            Assert.AreEqual(ValsExpected, Vals);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
        public void CellToProjTest()
        {
            SuperGrid target    = new SuperGrid(); // TODO: Initialize to an appropriate value
            int       Column    = 0;               // TODO: Initialize to an appropriate value
            int       Row       = 0;               // TODO: Initialize to an appropriate value
            double    x         = 0F;              // TODO: Initialize to an appropriate value
            double    xExpected = 0F;              // TODO: Initialize to an appropriate value
            double    y         = 0F;              // TODO: Initialize to an appropriate value
            double    yExpected = 0F;              // TODO: Initialize to an appropriate value

            target.CellToProj(Column, Row, ref x, ref y);
            Assert.AreEqual(xExpected, x);
            Assert.AreEqual(yExpected, y);
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
        public void ProjToCellTest()
        {
            SuperGrid target         = new SuperGrid(); // TODO: Initialize to an appropriate value
            double    x              = 0F;              // TODO: Initialize to an appropriate value
            double    y              = 0F;              // TODO: Initialize to an appropriate value
            int       Column         = 0;               // TODO: Initialize to an appropriate value
            int       ColumnExpected = 0;               // TODO: Initialize to an appropriate value
            int       Row            = 0;               // TODO: Initialize to an appropriate value
            int       RowExpected    = 0;               // TODO: Initialize to an appropriate value

            target.ProjToCell(x, y, ref Column, ref Row);
            Assert.AreEqual(ColumnExpected, Column);
            Assert.AreEqual(RowExpected, Row);
            Assert.Inconclusive("A method that does not return a value cannot be verified.");
        }
        public DataTable GetDataTable(List <UserHelper> users)
        {
            try
            {
                var dataTable = SuperGrid.DefineGridColumns(
                    Translations.UserManagement2Form.Users,
                    new SuperGrid.ColumnDefinition("Object", "Object", typeof(UserHelper), inUI: false),
                    new SuperGrid.ColumnDefinition(
                        "Member", "Member", typeof(bool), editorType: typeof(GridCheckBoxXEditControl)),
                    new SuperGrid.ColumnDefinition(
                        "Username", "Username", typeof(string), editorType: typeof(GridLabelXEditControl)),
                    new SuperGrid.ColumnDefinition(
                        "Name", "Name", typeof(string), editorType: typeof(GridLabelXEditControl)),
                    new SuperGrid.ColumnDefinition(
                        "SurName", "Surname", typeof(string), editorType: typeof(GridLabelXEditControl)),
                    new SuperGrid.ColumnDefinition(
                        "AccountType", "Account Type", typeof(string), editorType: typeof(GridLabelXEditControl))

                    );
                dataTable.BeginLoadData();

                foreach (var item in users)
                {
                    var row = dataTable.NewRow();

                    dataTable.Rows.Add(
                        item,
                        item.Member,
                        item.Username,
                        item.Name,
                        item.SurName,
                        item.AccountType
                        );

                    row.AcceptChanges();
                }

                dataTable.EndLoadData();
                return(dataTable);
            }
            catch (Exception ex)
            {
                Trace.WriteError("()", Trace.GetMethodName(), CLASSNAME, ex);
                throw;
            }
        }
        public void CreateNewTest()
        {
            SuperGrid    target       = new SuperGrid();    // TODO: Initialize to an appropriate value
            string       Filename     = string.Empty;       // TODO: Initialize to an appropriate value
            GridHeader   Header       = null;               // TODO: Initialize to an appropriate value
            GridDataType DataType     = new GridDataType(); // TODO: Initialize to an appropriate value
            object       InitialValue = null;               // TODO: Initialize to an appropriate value
            bool         InRam        = false;              // TODO: Initialize to an appropriate value
            GridFileType FileType     = new GridFileType(); // TODO: Initialize to an appropriate value
            ICallback    cBack        = null;               // TODO: Initialize to an appropriate value
            bool         expected     = false;              // TODO: Initialize to an appropriate value
            bool         actual;

            actual = target.CreateNew(Filename, Header, DataType, InitialValue, InRam, FileType, cBack);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Example #25
0
        public DataTable GetDataTable(List <ViewComputerPropertyValue> viewComputerPropertyValues, string aciCategory)
        {
            try
            {
                var valueColumn = CurrentUser.HasPermission(aciCategory, ACIOptions.MODIFY)
          ? new SuperGrid.ColumnDefinition(
                    "Value", "Value", typeof(string), editorType: typeof(GridTextBoxXEditControl))
          : new SuperGrid.ColumnDefinition("Value", "Value", typeof(string), editorType: typeof(GridLabelXEditControl));
                var defaultValueColumn = new SuperGrid.ColumnDefinition("DefaultValue", "Default value", typeof(string), editorType: typeof(GridLabelXEditControl));
                var dataTable          = SuperGrid.DefineGridColumns(
                    Translations.PropertiesPopupForm.Property,
                    new SuperGrid.ColumnDefinition("PropertyValue", "PropertyValue", typeof(ViewComputerPropertyValue), inUI: false),
                    new SuperGrid.ColumnDefinition("Name", "Name", typeof(string), editorType: typeof(GridLabelXEditControl)),
                    new SuperGrid.ColumnDefinition("DataType", "DataType", typeof(string), editorType: typeof(GridLabelXEditControl)),
                    defaultValueColumn,
                    valueColumn
                    );
                dataTable.BeginLoadData();

                foreach (var item in viewComputerPropertyValues)
                {
                    var       row      = dataTable.NewRow();
                    var       name     = Translations.Enums.TranslatedEnumDictionary[(UserManagementProperties)item.PropertyId];
                    DataTypes datatype = (DataTypes)item.DataType;

                    dataTable.Rows.Add(
                        item,
                        name,
                        datatype,
                        item.DefaultValue,
                        item.Value ?? String.Empty
                        );

                    row.AcceptChanges();
                }

                dataTable.EndLoadData();
                return(dataTable);
            }
            catch (Exception ex)
            {
                Trace.WriteError("()", Trace.GetMethodName(), CLASSNAME, ex);
                throw;
            }
        }
Example #26
0
        public DataTable GetDataTable(List <Computer> computers)
        {
            try
            {
                var dataTable = SuperGrid.DefineGridColumns(
                    Translations.UserManagement2Form.Computers,
                    new SuperGrid.ColumnDefinition("Computer", "Computer", typeof(Computer), inUI: false),
                    new SuperGrid.ColumnDefinition("Computer Id", "Computer Id", typeof(int), visible: false),
                    new SuperGrid.ColumnDefinition("Host name", "Host name", typeof(string)),
                    new SuperGrid.ColumnDefinition("Description", "Description", typeof(string)),
                    new SuperGrid.ColumnDefinition("ACI Managed", "ACI Managed", typeof(bool))
                    );

                dataTable.BeginLoadData();

                foreach (var item in computers)
                {
                    var id          = item.Id;
                    var name        = item.HostName;
                    var description = item.Description;
                    var aciManaged  = item.ACIManaged;
                    var row         = dataTable.NewRow();

                    dataTable.Rows.Add(
                        item,
                        id,
                        name,
                        description,
                        aciManaged
                        );

                    row.AcceptChanges();
                }

                dataTable.EndLoadData();
                return(dataTable);
            }
            catch (Exception ex)
            {
                Trace.WriteError(ex.Message, Trace.GetMethodName(), CLASSNAME, ex);
                throw;
            }
        }
        public void grd2ascTest()
        {
            SuperGrid target            = new SuperGrid(); // TODO: Initialize to an appropriate value
            string    sGridfile         = string.Empty;    // TODO: Initialize to an appropriate value
            string    sGridfileExpected = string.Empty;    // TODO: Initialize to an appropriate value
            string    sAscfile          = string.Empty;    // TODO: Initialize to an appropriate value
            string    sAscfileExpected  = string.Empty;    // TODO: Initialize to an appropriate value
            string    errMsg            = string.Empty;    // TODO: Initialize to an appropriate value
            string    errMsgExpected    = string.Empty;    // TODO: Initialize to an appropriate value
            bool      expected          = false;           // TODO: Initialize to an appropriate value
            bool      actual;

            actual = target.grd2asc(ref sGridfile, ref sAscfile, ref errMsg);
            Assert.AreEqual(sGridfileExpected, sGridfile);
            Assert.AreEqual(sAscfileExpected, sAscfile);
            Assert.AreEqual(errMsgExpected, errMsg);
            Assert.AreEqual(expected, actual);
            Assert.Inconclusive("Verify the correctness of this test method.");
        }
Example #28
0
        public DataTable GetDataTable(List <Group> groups)
        {
            try
            {
                var dataTable = SuperGrid.DefineGridColumns(
                    Translations.UserManagement2Form.Groups,
                    new SuperGrid.ColumnDefinition("Group", "Group", typeof(Group), inUI: false),
                    new SuperGrid.ColumnDefinition("Group Id", "Group Id", typeof(int), visible: false),
                    new SuperGrid.ColumnDefinition("Name", "Name", typeof(string)),
                    new SuperGrid.ColumnDefinition("Description", "Description", typeof(string)),
                    new SuperGrid.ColumnDefinition("Domain Group Identifier", "Domain Group Identifier", typeof(string))
                    );

                dataTable.BeginLoadData();

                foreach (var item in groups)
                {
                    var id                    = item.Id;
                    var name                  = item.Name;
                    var description           = item.Description;
                    var domainGroupIdentifier = item.DomainGroupIdentifier;
                    var row                   = dataTable.NewRow();

                    dataTable.Rows.Add(
                        item,
                        id,
                        name,
                        description,
                        domainGroupIdentifier
                        );

                    row.AcceptChanges();
                }

                dataTable.EndLoadData();
                return(dataTable);
            }
            catch (Exception ex)
            {
                Trace.WriteError(ex.Message, Trace.GetMethodName(), CLASSNAME, ex);
                throw;
            }
        }
        public DataTable GetDataTable(List <Material> materials)
        {
            try {
                var dataTable = SuperGrid.DefineGridColumns(
                    Translations.MasterData.Materials,
                    new SuperGrid.ColumnDefinition("Material", "Material", typeof(Material), inUI: false),
                    new SuperGrid.ColumnDefinition("Material Id", "Material Id", typeof(int), visible: false),
                    new SuperGrid.ColumnDefinition("Material Group", "Material Group", typeof(string), visible: true),
                    new SuperGrid.ColumnDefinition("Code", "Code", typeof(string)),
                    new SuperGrid.ColumnDefinition("Description", "Description", typeof(string))
                    );

                dataTable.BeginLoadData();

                foreach (var item in materials)
                {
                    var id          = item.Id;
                    var groupId     = new MaterialGroups().GetById(item.MaterialGroupId).Description;
                    var code        = item.Code;
                    var description = item.Description;
                    var row         = dataTable.NewRow();

                    dataTable.Rows.Add(
                        item,
                        id,
                        groupId,
                        code,
                        description
                        );

                    row.AcceptChanges();
                }

                dataTable.EndLoadData();
                return(dataTable);
            }
            catch (Exception ex) {
                Trace.WriteError(ex.Message, Trace.GetMethodName(), CLASSNAME, ex);
                throw;
            }
        }
Example #30
0
        public DataTable GetDataTable(List <HistoryKey> historyKeys)
        {
            try
            {
                var dataTable = SuperGrid.DefineGridColumns(
                    Translations.HistoryKeyManagementForm.HistoryKey,
                    new SuperGrid.ColumnDefinition("HistoryKey", "HistoryKey", typeof(HistoryKey), inUI: false),
                    new SuperGrid.ColumnDefinition("Key", "History Key", typeof(string), editorType: typeof(GridLabelXEditControl)),
                    new SuperGrid.ColumnDefinition("ShowInClient", "Show in client", typeof(bool), editorType: typeof(GridCheckBoxXEditControl)),
                    new SuperGrid.ColumnDefinition("SaveInDatabase", "Save in database", typeof(bool), editorType: typeof(GridCheckBoxXEditControl)),
                    new SuperGrid.ColumnDefinition("TraceLevel", "Trace Level", typeof(int), editorType: typeof(GridSourceLevelsComboBoxExEditControl))
                    );
                dataTable.BeginLoadData();

                foreach (var item in historyKeys)
                {
                    var row = dataTable.NewRow();

                    dataTable.Rows.Add(
                        item,
                        item.HistoryKey,
                        item.ShowInClient,
                        item.SaveInDatabase,
                        item.TraceLevelValue
                        );

                    row.AcceptChanges();
                }

                dataTable.EndLoadData();
                return(dataTable);
            }
            catch (Exception ex)
            {
                Trace.WriteError("()", Trace.GetMethodName(), CLASSNAME, ex);
                throw;
            }
        }