示例#1
0
        public TLCGenSettingsModel()
        {
            CustomData = new CustomDataModel();

            DefaultControllerSettings = new TLCGenDefaultControllerSettings();
            DefaultFaseCyclusSettings = new TLCGenDefaultFaseCyclusSettings();
        }
示例#2
0
        CustomDataModel CreateCustomDataModel()
        {
            var customDataModel = new CustomDataModel();

            foreach (var dataItem in CreateDataItems())
            {
                customDataModel.Add(dataItem);
            }
            return(customDataModel);
        }
        public SolidifyConfiguration(CustomDataModel model)
        {
            var config = model.CustomData as dynamic;

            Engine      = new EngineConfiguration();
            Engine.Path = config.engine.path;

            Source      = new SourceConfiguration();
            Source.Path = config.source.path;

            Output      = new OutputConfiguration();
            Output.Path = config.output.path;
        }
示例#4
0
        public void ConstructorTest()
        {
            var model = new CustomDataModel();

            model.Id         = ConfigurationService.CONFIGURATION_FILE;
            model.ContentRaw = _config;
            model.Parse();

            var config = new SolidifyConfiguration(model);

            Assert.AreEqual("engine", config.Engine.Path);
            Assert.AreEqual("src", config.Source.Path);
            Assert.AreEqual("www", config.Output.Path);
        }
示例#5
0
        /// Loads settings for a given TLCGen addin, such as a generator or importer. The settings are retrieved from
        /// the instance of CustomDataModel parsed, which is searched for the name of the addin.
        /// The settings are applied to the addin by loading the properties of the Type parsed, and calling
        /// SetValue for the properties that have the TLCGenCustomSetting attribute, and for which settings are found.
        /// </summary>
        /// <param name="addin">An instance of ITLCGenAddin</param>
        /// <param name="addintype">And instance of Type, indicating the type of the addin. This is used to read its properties (through reflection).</param>
        /// <param name="customdata">Instance of CustomDataModel to read settings from.</param>
        public static void LoadAddinSettings(ITLCGenPlugin addin, Type addintype, CustomDataModel customdata)
        {
            // Cast the addin to ITLCGenAddin so we can read its name
            var iaddin = addin as ITLCGenPlugin;

            // Loop the settings data, to see if we have settings for this Generator
            foreach (AddinSettingsModel addindata in customdata.AddinSettings)
            {
                if (addindata.Naam == iaddin.GetPluginName())
                {
                    // From the Generator, real all properties attributed with [TLCGenGeneratorSetting]
                    var dllprops = addintype.GetProperties().Where(
                        prop => Attribute.IsDefined(prop, typeof(TLCGenCustomSettingAttribute)));
                    // Loop the saved settings, and load if applicable
                    foreach (AddinSettingsPropertyModel dataprop in addindata.Properties)
                    {
                        foreach (var propinfo in dllprops)
                        {
                            // Only load here, if it is a controller specific setting
                            TLCGenCustomSettingAttribute propattr = (TLCGenCustomSettingAttribute)Attribute.GetCustomAttribute(propinfo, typeof(TLCGenCustomSettingAttribute));
                            if (propinfo.Name == dataprop.Naam)
                            {
                                if (propattr != null && propattr.SettingType == TLCGenCustomSettingAttribute.SettingTypeEnum.Application)
                                {
                                    try
                                    {
                                        string type = propinfo.PropertyType.ToString();
                                        switch (type)
                                        {
                                        case "System.Double":
                                            double d;
                                            if (Double.TryParse(dataprop.Setting, out d))
                                            {
                                                propinfo.SetValue(addin, d);
                                            }
                                            break;

                                        case "System.Int32":
                                            int i32;
                                            if (Int32.TryParse(dataprop.Setting, out i32))
                                            {
                                                propinfo.SetValue(addin, i32);
                                            }
                                            break;

                                        case "System.String":
                                            propinfo.SetValue(addin, dataprop.Setting);
                                            break;

                                        default:
                                            throw new InvalidCastException("False IGenerator property type: " + type);
                                        }
                                    }
                                    catch
                                    {
                                        System.Windows.MessageBox.Show("Error load generator settings.");
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
示例#6
0
 public TLCGenSettingsModel()
 {
     CustomData = new CustomDataModel();
 }
        public CustomDataModel CustomerProvider_GetCustomData(CompanyModel Customer, string ProviderPublicId)
        {
            List <System.Data.IDbDataParameter> lstParams = new List <IDbDataParameter>();

            lstParams.Add(DataInstance.CreateTypedParameter("vCustomerPublicId", Customer.CompanyPublicId));
            lstParams.Add(DataInstance.CreateTypedParameter("vProviderPublicId", ProviderPublicId));

            ADO.Models.ADOModelResponse response = DataInstance.ExecuteQuery(new ADO.Models.ADOModelRequest()
            {
                CommandExecutionType = ADO.Models.enumCommandExecutionType.DataSet,
                CommandText          = "IP_CustomerRedirect_GetAll",
                CommandType          = CommandType.StoredProcedure,
                Parameters           = lstParams,
            });

            Models.Integration.CustomDataModel oReturn = new CustomDataModel();

            if (response.DataSetResult.Tables[0] != null &&
                response.DataSetResult.Tables[0].Rows.Count > 0)
            {
                oReturn.CustomField =
                    (from af in response.DataSetResult.Tables[0].AsEnumerable()
                     where !af.IsNull("AditionalFieldId")
                     select new Models.Integration.CustomFieldModel()
                {
                    AditionalFieldId = af.Field <int>("AditionalFieldId"),
                    AditionalFieldType = new ProveedoresOnLine.Company.Models.Util.CatalogModel()
                    {
                        ItemId = af.Field <int?>("AditionalFieldTypeId") != null ? af.Field <int>("AditionalFieldTypeId") : 0,
                        ItemName = af.Field <string>("AditionalFieldTypeName"),
                    },
                    AditionalFieldTypeInfo = new ProveedoresOnLine.Company.Models.Util.CatalogModel()
                    {
                        ItemId = af.Field <int?>("AditionalFieldTypeInfoId") != null ? af.Field <int>("AditionalFieldTypeInfoId") : 0,
                        ItemName = af.Field <string>("AditionalFieldTypeInfoName"),
                    },
                    Label = af.Field <string>("Label"),
                    Enable = af.Field <UInt64>("Enable") == 1 ? true : false,
                    LastModify = af.Field <DateTime>("LastModify"),
                    CreateDate = af.Field <DateTime>("CreateDate"),
                }).ToList();
            }

            if (response.DataSetResult.Tables[1] != null &&
                response.DataSetResult.Tables[1].Rows.Count > 0)
            {
                oReturn.CustomData =
                    (from ad in response.DataSetResult.Tables[1].AsEnumerable()
                     where !ad.IsNull("AditionalDataId")
                     group ad by new
                {
                    AditionalDataId = ad.Field <int>("AditionalDataId"),
                    ProviderId = ad.Field <int>("ProviderId"),
                    AditionalFieldId = ad.Field <int>("AditionalFieldId"),
                    AditionalDataName = ad.Field <string>("AditionalDataName"),
                    AditionalDataEnable = ad.Field <UInt64>("AditionalDataEnable"),
                    AditionalDataLastModify = ad.Field <DateTime>("AditionalDataLastModify"),
                    AditionalDataCreateDate = ad.Field <DateTime>("AditionalDataCreateDate"),
                }
                     into adg
                     select new ProveedoresOnLine.Company.Models.Util.GenericItemModel()
                {
                    ItemId = adg.Key.AditionalDataId,
                    ItemName = adg.Key.AditionalDataName,
                    ItemType = new ProveedoresOnLine.Company.Models.Util.CatalogModel()
                    {
                        ItemId = adg.Key.AditionalFieldId,
                    },
                    Enable = adg.Key.AditionalDataEnable == 1 ? true : false,
                    LastModify = adg.Key.AditionalDataLastModify,
                    CreateDate = adg.Key.AditionalDataCreateDate,
                    ItemInfo =
                        (from adinf in response.DataSetResult.Tables[1].AsEnumerable()
                         where !adinf.IsNull("AditionalDataInfoId") &&
                         adinf.Field <int>("AditionalDataId") == adg.Key.AditionalDataId
                         select new ProveedoresOnLine.Company.Models.Util.GenericItemInfoModel()
                    {
                        ItemInfoId = adinf.Field <int>("AditionalDataInfoId"),
                        ItemInfoType = new ProveedoresOnLine.Company.Models.Util.CatalogModel()
                        {
                            ItemId = adinf.Field <int?>("AditionalDataInfoType") != null ? adinf.Field <int>("AditionalDataInfoType") : 0,
                        },
                        Value = adinf.Field <string>("AditionalDataInfoValue"),
                        LargeValue = adinf.Field <string>("AditionalDataInfoLargeValue"),
                        Enable = adinf.Field <UInt64>("AditionalDataInfoEnable") == 1 ? true : false,
                        LastModify = adinf.Field <DateTime>("AditionalDataInfoLastModify"),
                        CreateDate = adinf.Field <DateTime>("AditionalDataInfoCreateDate"),
                    }).ToList(),
                }).ToList();
            }

            oReturn.RelatedCompany = Customer;

            return(oReturn);
        }