private ColumnModel CreateColumnDefinition() { var colName = UtilConsole.ReadString("Column name"); var dataType = UtilConsole.SelectFromEnum("Data type", DataType.None); if (dataType == DataType.None) { return(null); } var sourceDic = new Dictionary <DataType, List <ColumnDefinitionType> > { { DataType.Integer, new List <ColumnDefinitionType> { ColumnDefinitionType.IntegerRange, ColumnDefinitionType.DatabaseQuery } }, { DataType.Double, new List <ColumnDefinitionType> { ColumnDefinitionType.DoubleRange, ColumnDefinitionType.DatabaseQuery } }, { DataType.DateTime, new List <ColumnDefinitionType> { ColumnDefinitionType.DateRange, ColumnDefinitionType.DateTimeRange, ColumnDefinitionType.DatabaseQuery } }, { DataType.String, new List <ColumnDefinitionType> { ColumnDefinitionType.RandomPattern, ColumnDefinitionType.RandomChars, ColumnDefinitionType.Template, ColumnDefinitionType.DatabaseQuery } }, { DataType.Guid, new List <ColumnDefinitionType> { ColumnDefinitionType.Guid } } }; var sourceList = sourceDic[dataType]; var sourceListAsString = sourceList.Select(itm => itm.ToString()).ToList(); var sourceTypeAsString = UtilConsole.SelectFromList(sourceListAsString, "Select generator source"); var sourceType = UtilEnum.Get <ColumnDefinitionType>(sourceTypeAsString); var def = _columnModelFactory.GetInstance(sourceType); var loader = _consoleLoaderFactory.GetInstance(sourceType); def.Name = colName; loader.LoadFromConsole(def); return(def); }
public ColumnModel Load(string json) { var j = JObject.Parse(json); var columnDefinitionTypeName = j["columnDefinitionType"].ToString(); var columnDefinitionType = UtilEnum.Get <ColumnDefinitionType>(columnDefinitionTypeName); var column = _columnModelFactory.GetInstance(columnDefinitionType, j); return(column); }
public ItemSourceModel Load(string json) { var j = JObject.Parse(json); var itemSourceTypeName = j["type"].ToString(); var itemSourceType = UtilEnum.Get <ItemSourceType>(itemSourceTypeName); var source = _itemSourceModelFactory.GetInstance(itemSourceType, j); return(source); }
/// <summary> /// Au lancement du formulaire /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FormImage_Load(object sender, EventArgs e) { //Création des variables qui contiendront les deux images de type BitmapMatricielle this.ImgSource = new BitmapMatricielle(); // Image originale this.ImgTransfo = new BitmapMatricielle(); // Image Transformée //Inititalisation du text de la durée en ms à 100ms this.txtTemps.Text = "100"; //Affichages des choix de transformations dans le comboBox. this.cboTransformation.DataSource = UtilEnum.GetAllDescriptions <TransformationType>(); }
private SqlServerVersion GetSqlServerVersion(ConnectionInfo connectionInfo) { string versionString; using (var cn = GetConnection(connectionInfo)) { versionString = cn.ExecuteScalar <string>("SELECT @@VERSION"); } var versionMatch = Regex.Match(versionString, "Microsoft SQL Server (\\d+)"); var versionNumber = Convert.ToInt32(versionMatch.Groups[1].Value); var versionValue = UtilEnum.Get <SqlServerVersion>("Sql" + versionNumber); return(versionValue); }