private static void setSerieFromChart(TabloidConfigView table, TabloidConfigGraph graph, Chart chart, bool main, ref string champX) { //int points = 0; ////For every row in the values table, plot the date against the variable value //foreach (DataRow row in Values.Rows) //{ // myChart.Series[Variable].Points.AddXY(Convert.ToDateTime(row["Date"].ToString()), row["Variable"].ToString()); // myChart.Series[Variable].Points[points].ToolTip = Variable + " = #VALY \r\nDate = #VALX{d} \r\nSerial = " + row["Serial"].ToString(); // points += 1; //} if (main) { champX = table.Colonnes.Contains(graph.ChampX) ? table.Colonnes[graph.ChampX].Titre : ChampTools.RemoveTableName(graph.ChampX); } var serieName = string.IsNullOrEmpty(graph.Serie) ? "g" + chart.Series.Count : graph.Serie; var g = chart.Series.Add(serieName); g.ChartType = (SeriesChartType)graph.Type; g.XValueMember = champX; // TODO use dbkey g.YValueMembers = "Valeur" + chart.Series.Count; g.LabelForeColor = graph.CouleurEtiquette; g["PieLabelStyle"] = "Outside"; g.Label = graph.Etiquette; }
internal static void afterViewModified(TabloidConfigView v) { if (v.AutomaticCreation) { v.AutomaticCreation = false; } }
public WizardLoc(TabloidConfigView v) { InitializeComponent(); _view = v; cmbType.SelectedIndex = 0; }
public WizardCalendrier(TabloidConfigView view, string connectionString, Provider provider) { InitializeComponent(); _connectionString = connectionString; _provider = provider; _view = view; string lastError; var dt = DataTools.Data(SqlCommands.SqlGetColums(view.NomTable), connectionString, out lastError);//01 //is there 2 timestamp cmbDeb.DataSource = new DataView(dt, dt.Columns[1].ColumnName + " like 'timestamp%'", null, DataViewRowState.CurrentRows); cmbFin.DataSource = new DataView(dt, dt.Columns[1].ColumnName + " like 'timestamp%'", null, DataViewRowState.CurrentRows); cmbDeb.DisplayMember = cmbFin.DisplayMember = dt.Columns[0].ColumnName; chkUtilDeb.Enabled = chkUtilFin.Enabled = cmbDeb.Items.Count != 0;//no timestamp field couldn't use existing fields //is there 1 or more character varying cmbTitre.DataSource = dt; cmbTitre.ValueMember = dt.Columns[0].ColumnName; var nameField = cmbTitre.FindStringExact("nom_" + _view.NomTable); if (nameField > -1) { cmbTitre.SelectedIndex = nameField; chkExistTitre.Checked = true; } ///create new field txtTitre.Text = "eve_" + view.NomTable; txtDebut.Text = "deb_" + view.NomTable; txtFin.Text = "fin_" + view.NomTable; }
public WizardImport(TabloidConfigImport i, TabloidConfigView view) { ImportResult = i ?? new TabloidConfigImport(); _linkList = new BindingList <ColumnFieldLink>(); _currentView = view; InitializeComponent(); dgv.AutoGenerateColumns = false; dgv.DataSource = _linkList; dgv.AllowUserToAddRows = false; dgv.AutoResizeColumns(); DataGridViewComboBoxColumn col = new DataGridViewComboBoxColumn(); col.DataSource = _currentView.Colonnes; col.DisplayMember = "CompleteName"; col.ValueMember = "Self"; col.DataPropertyName = "field"; col.HeaderText = "Champ de votre projet"; col.Width = 200; _ExcelColumnDDL = new DataGridViewComboBoxColumn(); _ExcelColumnDDL.DataPropertyName = "columnTitle"; _ExcelColumnDDL.HeaderText = "Colonne Excel"; _ExcelColumnDDL.Width = 200; dgv.Columns.Add(col); dgv.Columns.Add(_ExcelColumnDDL); }
public WizardSMS(TabloidConfigView v) { InitializeComponent(); _view = v; txtPass.Text = Program.AppSet.smsBoxPassword; txtUser.Text = Program.AppSet.smsBoxUser; }
public GridViewForm2(TabloidConfigView view, string connectionString) { InitializeComponent(); _view = view; _connectionString = connectionString; cmbVisibility.DataSource = Enum.GetValues(typeof(Visibilites)); }
public WizardIndic(TabloidConfigView view = null) { _view = view; InitializeComponent(); cmbType.DataSource = Enum.GetValues(typeof(TabloidConfigIndicateur.WidgetType)); Fin.CloseFromNext += Fin_CloseFromNext; }
public WizardCreaAuto(TabloidConfigView v) { InitializeComponent(); _view = v; lbListe.Text = $"à la création d'un enregistrement de '{_view.Nom}' compléter la liste :"; cmbListe.DataSource = v.Jointures.Where(j => j.Relation == "1:N" && j.Jointures.asN1()).ToList(); }
bool init;//prevent event fire during init public GraphicFormEditor(TabloidConfigView view, TabloidConfigGraphCollection tgc) { init = true; InitializeComponent(); _tgc = tgc; lstGraphic.DataSource = tgc; _view = view; init = false; }
private static void getChartSeries(TabloidConfigView table, TabloidConfigGraph graph, Chart chart, ref string champX) { chart.Series.Clear(); setSerieFromChart(table, graph, chart, true, ref champX); foreach (TabloidConfigGraph g in graph.Graphiques) { setSerieFromChart(table, g, chart, false, ref champX); } }
public static void SetMobile(TabloidConfigView view) { if (!string.IsNullOrEmpty(Program.AppSet.smsBoxPassword) && !string.IsNullOrEmpty(Program.AppSet.smsBoxUser)) { return; } var w = new WizardSMS(view); w.ShowDialog(); }
/// <summary> /// Add View to menu /// </summary> /// <param name="mn">menu to use as parent</param> public static void AddToMenu(IWin32Window own, TabloidConfigView view, string title = null, TabloidConfigMenuItem.MenuType mnType = TabloidConfigMenuItem.MenuType.Liste, TabloidConfigMenuItem mn = null) { var newChild = new TabloidConfigMenuItem { Titre = title ?? view.Titre, Type = mnType, Table = view.Nom, Parent = mn }; AddToMenu(own, newChild, mn); }
private void Init(TabloidConfigView v) { if (v == null) { this.Close(); } _provider = Program.AppSet.ProviderType; InitializeComponent(); _view = v; _connectionString = Program.AppSet.ConnectionString; cmbJoin.DataSource = get1NJoin(); cmbTable.DataSource = TabloidConfig.Config.Views;//.Where(x => x.NomTable != v.NomTable).ToList(); }
private void buildView(object sender, EventArgs e) { var avt = new ArrayVerify(); var newView = new TabloidConfigView(); BuildFromBase.GetTable(_own, ParentTableResult.TableName, Program.AppSet.Schema, ref newView, ref avt, new BuildFromBase.BaseImporterConfig { RemoveTableName = true, ToUpperCase = true, ReplaceUnderscrore = true, ConnectionString = Program.AppSet.ConnectionString }); TabloidConfig.Config.Views.Add(newView); }
private void addToMenu(TabloidConfigView t) { if (!chkAjMenu.Checked) { return; } if (radMnMain.Checked) { WizardSQLHelper.AddToMenu(this, t); } else { WizardSQLHelper.AddToParamMenu(t, this); } }
public void Init(TabloidConfigView v) { if (v == null) { this.Close(); } _provider = Program.AppSet.ProviderType; InitializeComponent(); _view = v; _connectionString = Program.AppSet.ConnectionString; Info.CloseFromNext += infoFromNext; Fin.CloseFromBack += finFromBack; cmbView.DataSource = TabloidConfig.Config.Views //.Where(x => x.Nom != _view.Nom) .OrderBy(x => x.Nom).ToList(); }
public TableFieldSelectorForm(TabloidConfigView view, string value, string tableName = null) { Value = value; InitializeComponent(); WizardSQLHelper.displayTable(fieldSelector1.cmbTable, Program.AppSet.ConnectionString, view.NomTable); fieldSelector1.ConnectionString = Program.AppSet.ConnectionString; fieldSelector1.cmdSchema.DataSource = AppSetting.GetSchemaList(Program.AppSet.ProviderType); fieldSelector1.lstChamp.SelectedIndexChanged += cmbChamp_SelectedIndexChanged; if (!string.IsNullOrEmpty(tableName)) { fieldSelector1.cmbTable.SelectedIndex = fieldSelector1.cmbTable.FindStringExact(tableName); } if (!string.IsNullOrEmpty(value)) { fieldSelector1.lstChamp.SelectedIndex = fieldSelector1.lstChamp.FindStringExact(value); } }
public WizardJoin(TabloidConfigView view, TabloidConfigJointure parentJoin, string connectionString) { _connectionString = connectionString; _view = view; _parentJoin = parentJoin; InitializeComponent(); wjStart.CloseFromNext += wjRef_CloseFromNext; wjRef2.ShowFromNext += Rel_ShowFromNext; wjRef2.ShowFromBack += Back_Rel_ShowFromNext; Fin.CloseFromBack += Fin_CloseFromBack; _srcView = parentJoin == null ? view : TabloidConfig.Config.Views[parentJoin.NomTable]; upDateList(); WizardSQLHelper.displayTable(cmbTable, Program.AppSet.ConnectionString, _srcView.NomTable, false); cmbTable.SelectedIndex = 0; lblChampRef.Text = string.Format(lblChampRef.Text, _srcView.NomTable); cmbTypeJointure.SelectedIndex = 0; cmbOrderType.Items.Add(Properties.Resources.Increasing); cmbOrderType.Items.Add(Properties.Resources.Decreasing); cmbOrderType.SelectedIndex = 0; WizardSQLHelper.SetVisibiliteCheckedBoxList(lstVisibilites); string lastError = ""; // list automatic join var searchTable = _parentJoin == null ? _view : TabloidConfig.Config.Views[_parentJoin.NomTable]; _autoJoinList = WizardSQLHelper.SetJoinFromConstraint(searchTable, Program.AppSet.ConnectionString, ref lastError, false); lstAutoJoin.DataSource = _autoJoinList; radManu.Checked = _autoJoinList.Count == 0; }
/// <summary> /// Add view/gridView field and distinct if required /// </summary> /// <param name="sourceView">tabloidConfigView containing the list field</param> /// <param name="FieldTitle">Title of created field</param> /// <param name="join">TabloidConfigJoin used for field</param> /// <param name="fieldName">datatable field name</param> /// <param name="gridView">true to create gridview false to create view</param> /// <param name="addDistinct">add distinct to source view</param> public static bool AddGridviewField(TabloidConfigView sourceView, string FieldTitle, TabloidConfigJointure join, string fieldName, bool gridView, bool addDistinct) { if (!string.IsNullOrEmpty(fieldName)) { var c = new TabloidConfigColonne { Type = DbType.String, Titre = FieldTitle, VisibleListe = false, Champ = fieldName, Jointure = join.Nom, Editeur = gridView ? TemplateType.GridView : TemplateType.View }; WizardTools.Tools.AddWithUniqueName(sourceView.Colonnes, c, "C"); } if (addDistinct) { var newDistinct = sourceView.NomTable + "." + sourceView.DbKey; sourceView.Distinct = addIfNotExist(sourceView.Distinct, newDistinct); if (string.IsNullOrEmpty(sourceView.Order)) { sourceView.Order = sourceView.Distinct; } else { var orderParts = sourceView.Order.Split(' ');//remove order asc/desc //orderParts[0] += "," + sourceView.Distinct; addIfNotExist(orderParts[0], newDistinct); sourceView.Order = string.Join(" ", orderParts);//retrieve asc/desc } } sourceView.Detail = true; return(true); }
public GraphForm(TabloidConfigView view, TabloidConfigGraph graph = null, TabloidConfigGraph parent = null) { InitializeComponent(); _currentGraph = graph; _view = view; _update = _currentGraph != null; _parentGraph = parent; if (!_update)//new { _currentGraph = new TabloidConfigGraph(); } else//edit existing { UpdatewizardView(); } SetFieldLists(); propertyGrid1.SelectedObject = _currentGraph; UpdateGraph(); }
/// <summary> /// Search join using constraint for a given table /// </summary> /// <param name="view">view of the table</param> /// <param name="connectionString"></param> /// <param name="lastError"></param> /// <param name="addToTable">if set to true search for field in table to set field join properties</param> /// <returns></returns> public static List <TabloidConfigJointure> SetJoinFromConstraint(TabloidConfigView view, string connectionString, ref string lastError, bool addToTable = true) { var result = new List <TabloidConfigJointure>(); var dfk = DataTools.Data(SqlCommands.SqlGetForeignKey(view.NomTable, view.Schema), connectionString, out lastError); if (!string.IsNullOrEmpty(lastError)) { return(null); } for (var a = 0; a < dfk.Rows.Count; a++) { var j = new TabloidConfigJointure { ChampDeRef = dfk.Rows[a][0].ToString(), NomTable = dfk.Rows[a][1].ToString(), TableSource = view.NomTable, DbKey = dfk.Rows[a][2].ToString() }; result.Add(j); if (addToTable) { WizardTools.Tools.AddWithUniqueName(view.Jointures, j, "J"); foreach (var i in view.Colonnes.FindIndex(j.ChampDeRef)) { view.Colonnes[i].Jointure = j.Nom; view.Colonnes[i].Editeur = TemplateType.ComboBoxPlus; view.Colonnes[i].Type = DbType.Int32; } } } return(result); }
public WizardSimpleListConverter(TabloidConfigView view, TabloidConfigColonne field) { InitializeComponent(); _field = field; _view = view; }
/// <summary> /// add field list to combobox from sql request /// </summary> /// <param name="cmb">Combobox to populate</param> /// <param name="view">View object</param> /// <param name="connectionString">connexction string</param> /// <param name="selectKey">Display table dbKey in list if true</param> /// <param name="allowNull">Add selectable null item</param> /// <param name="hideTabloidField">if true Tabloid fields are hidden</param> public static void displayField(ComboBox cmb, TabloidConfigView view, string connectionString, bool selectKey = false, bool allowNull = false, bool hideTabloidField = true) { displayField(cmb, view.NomTable, connectionString, view.Schema, selectKey ? "" : view.DbKey, allowNull, hideTabloidField); }
private void btn_Click(object sender, EventArgs e) { var error = false; progressBar1.Maximum = 100; progressBar1.Value = 0; var schema = txtSchema.Text == "" ? "public" : txtSchema.Text; object[] param = { txtHote.Text, txtUtil.Text, txtMdp.Text, txtBase.Text, schema }; var connectionString = cmbType.SelectedIndex == 0 ? string.Format("Datasource={0};Database={3};uid={1};pwd={2};", param) : string.Format("User ID={1};Password={2};Host={0};Port=5432;Database={3};SearchPath={4},public;", param); Program.AppSet = new AppSetting { ConnectionString = connectionString, ProviderType = cmbType.SelectedIndex == 0 ? Provider.MySql : Provider.Postgres, Titre = txtBase.Text, identParam = cmbType.SelectedIndex == 0 ? "?" : "@", sqlDebug = "oui" }; Tools.SetDefaultProviderFromAppSet(); lblState.Text = Resources.NewFromBaseForm_btn_Click_Récupération_des_Tables; lblState.Refresh(); SqlCommands.Provider = cmbType.SelectedIndex == 0 ? Provider.MySql : Provider.Postgres; Program.AppSet.Schema = schema; string lastError; var dt = DataTools.Data(SqlCommands.SqlGetTable(), connectionString, out lastError); if (dt == null) { MetroMessageBox.Show(this, Resources.NewFromBaseForm_btn_Click_ + lastError, Resources.Erreur, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!string.IsNullOrEmpty(lastError)) { lblState.Text = lastError; error = true; } else { TabloidConfig.Config = new TabloidConfig(); TabloidConfig.Config.TabloidConfigApp.UseLockDatabaseField = chkLockInDB.Checked; var avt = new ArrayVerify(); var config = new BuildFromBase.BaseImporterConfig { RemoveTableName = chkSuppNomTable.Checked, ToUpperCase = chkCasse.Checked, ReplaceUnderscrore = chkUnderscrore.Checked, ConnectionString = connectionString }; if (dt.Rows.Count > 0) { TabloidFields.TabloidFieldsArray = null; //Program.AppSet.pageDefaut = "/tabloid/BSliste.aspx?table=" + AppSetting.setDefaultPage(dt.Rows[0][0].ToString()); var delta = 100 / dt.Rows.Count; //read Tables foreach (DataRow dtr in dt.Rows) { progressBar1.Value += delta; progressBar1.Refresh(); var dtName = dtr[0].ToString(); var tableConfig = new TabloidConfigView(); try { BuildFromBase.GetTable(this, dtName, schema, ref tableConfig, ref avt, config); TabloidConfig.Config.Views.Add(tableConfig); } catch (Exception ex) { lblState.Text = ex.ToString(); } } if (error) { return; } } //verify tabloid table existance if (!avt.IsThereAll(TabloidTables.TabloidTablesArray.Count())) { var l = avt.NotInIndex(TabloidTables.TabloidTablesArray.Count()); //list unaviable tables var r = DialogResult.Yes; if (!chkAutoTable.Checked) { //Show message var strCh = string.Join("\n\t- ", TabloidTables.TabloidTablesArray .Where((f, index) => l.Any(i => i == index)) .Select((x, index) => x.Name).ToArray()); r = MetroMessageBox.Show(this, string.Format( Resources.NewFromBaseForm_tables_inutiles, strCh), Resources.Information, MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); } if (r == DialogResult.Yes) { var toCreate = TabloidTables.TabloidTablesArray .Where((f, index) => l.Any(i => i == index)) .ToList(); TabloidTables.CreateTable( toCreate, connectionString, this); foreach (var t in toCreate)// table to config { var tableConfig = new TabloidConfigView(); try { BuildFromBase.GetTable(this, t.Name, schema, ref tableConfig, ref avt, config); TabloidConfig.Config.Views.Add(tableConfig); } catch (Exception ex) { lblState.Text = ex.ToString(); } } } } OlStyleCollection.olStyles = new List <OlStyle>(); DialogResult = DialogResult.OK; Close(); } }
public JoinWithNoConstraint(TabloidConfigJointure join, TabloidConfigView view, IWin32Window own) { _own = own; Join = join; View = view; }
/// <summary> /// add field to main table with constraint /// add join to main table collection collection /// add new table to table collection /// /// return true if job done /// </summary> /// <param name="complexList"></param> /// <param name="schema"></param> /// <param name="newtableName"></param> /// <param name="sourceView"></param> /// <param name="tableSrcFieldRef"></param> /// <param name="connectionString"></param> /// <param name="provider"></param> /// <param name="alias">if not empty buil a new join with given alias</param> /// <param name="addFieldOnly">Add field and join but not new table</param> /// <param name="useJoin">if not null join is not created and given join is used</param> /// <param name="addFieldOnly">Add only join</param> /// <returns></returns> public static bool SetDataBaseForList(IWin32Window own, bool complexList, string schema, string newtableName, string newDbKey, string newViewName, bool addToParamMenu, TabloidConfigView sourceView, string tableSrcFieldRef, string connectionString, Provider provider, bool addNameField = true, bool addDistinct = false, string alias = null, bool addFieldOnly = false, string schemaNewtable = null, TabloidConfigJointure useJoin = null, bool addOnlyJoin = false) { try { var param = new[] { schema, newtableName.ToLower(), sourceView.NomTable, tableSrcFieldRef }; var complexParam = new[] { schema, newtableName.ToLower(), sourceView.NomTable, sourceView.DbKey }; string select = null; string aliasDbKey = null; if (!addOnlyJoin) { if (addFieldOnly) { // add field to table var sqlType = dataHelper.DbTypeConverter.ConvertFromGenericDbType(DbType.Int16, WizardTools.Tools.ConvertProviderType(Program.AppSet.ProviderType)); // var fieldOnlyParam = new[] { //sourceView.NomTable, //tableSrcFieldRef, //sqlType, //schema }; tableSrcFieldRef = addField(sourceView.NomTable, tableSrcFieldRef, sqlType, schema, own); if (tableSrcFieldRef == null) { return(false); } //var fieldOnlyParam = new[] { schema, newtableName, sourceView.NomTable, tableSrcFieldRef, schemaNewtable ?? schema, newDbKey };//"id_"+ newtableName //if (!ExecuteFromFile("addConstraint.sql", fieldOnlyParam, connectionString)) return false;//TO DO handel duplicate name //add constraint do not stop on error addConstraint(schema, newtableName, sourceView.NomTable, tableSrcFieldRef, schemaNewtable ?? schema, newDbKey, own); if (!string.IsNullOrEmpty(alias)) { aliasDbKey = "id_" + alias; select = $"{alias}.id_{newtableName} as id_{alias},{alias}.nom_{newtableName} as nom_{alias}"; } } else if (!ExecuteFromFile(complexList ? "fieldComplexList.sql" : "fieldList.sql", complexList ? complexParam : param, connectionString, own)) { return(false); } } //add join var newJoin = useJoin; if (useJoin == null) { var j = new TabloidConfigJointure { NomTable = newtableName, DbKey = newDbKey,//"id_" + newtableName, Relation = complexList ? "1:N" : "", AliasTable = alias, Select = select, AliasDbKey = aliasDbKey, ChampDeRef = complexList ? sourceView.Nom + "." + sourceView.DbKey : tableSrcFieldRef, ChampDeRef2 = complexList ? sourceView.Nom + "_id" : "", Order = complexList ? "" : "nom_" + newtableName + " asc" }; Classes.WizardTools.Tools.AddWithUniqueName(sourceView.Jointures, j, "J"); newJoin = j; } if (!complexList) {//add combo list field var c = new TabloidConfigColonne { Type = DbType.String, Titre = newViewName, Champ = "nom_" + (string.IsNullOrEmpty(alias) ? newtableName : alias), Jointure = newJoin.Nom, Editeur = TemplateType.ComboBoxPlus }; WizardTools.Tools.AddWithUniqueName(sourceView.Colonnes, c, "C"); } else {//add gridview field AddGridviewField(sourceView, newtableName, newJoin, "nom_" + newtableName, true, addDistinct); } if (addFieldOnly) { return(true); } //add new table var t = new TabloidConfigView { Schema = schema, Nom = newtableName, Titre = newViewName, DbKey = "id_" + newtableName }; if (!complexList || true) {// add field name to the new created table t.Order = "nom_" + newtableName + " asc"; var ct = new TabloidConfigColonne { Nom = "C" + t.Colonnes.Count, Type = DbType.String, Titre = "Nom", Champ = "nom_" + newtableName }; WizardTools.Tools.AddWithUniqueName(t.Colonnes, ct, "C"); } TabloidConfig.Config.Views.Add(t); //add new table in menu try { if (addToParamMenu) { AddToParamMenu(t, own); } } catch (Exception e) { MetroMessageBox.Show(own, e.Message, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error); return(true); } } catch (Exception e) { MetroMessageBox.Show(own, e.Message, "Erreur", MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } return(true); }
public static void AddToParamMenu(TabloidConfigView view, IWin32Window own) { var mn = getParamMenu(); AddToMenu(own, view, null, TabloidConfigMenuItem.MenuType.Liste, mn); }
/// <summary> /// Convert combox list to table list /// </summary> /// <param name="view"></param> /// <param name="field"></param> /// <param name="newTableName"></param> /// <returns></returns> public static bool ConvertSimpleList(TabloidConfigView view, TabloidConfigColonne field, string newTableName, IWin32Window own) { var join = view.Jointures.GetJointure(field.Jointure); //search for a unique constraint name var fk1Name = SearchConstraintUniqueName(view.NomTable + "_fk", view.Schema); var fk2Name = SearchConstraintUniqueName(join.NomTable + "_fk", view.Schema); var param = new[] { view.Schema, //0 schema view.NomTable, //1 master table join.NomTable, //2 actually joined table newTableName, //3 new intermediate table view.DbKey, //4 master table dbkey join.ChampDeRef, //5 master table foreign key field join.DbKey, //6 actually joined table primary key fk1Name, fk2Name }; var result = ExecuteFromFile("fieldListTOfieldComplexList.sql", param, Program.AppSet.ConnectionString, own); if (!result) { return(false); } SqlCommands.DropColumn(view.NomTable, join.ChampDeRef, view.Schema, own); var joinLst = new TabloidConfigJointure { Relation = "1:N", NomTable = newTableName, DbKey = "id_" + newTableName, ChampDeRef = view.NomTable + "." + view.DbKey, ChampDeRef2 = view.NomTable + "_id" }; var join2 = new TabloidConfigJointure { NomTable = join.NomTable, DbKey = join.DbKey, ChampDeRef = join.NomTable + "_id", Order = join.Order }; var joinLstRoleID = WizardTools.Tools.AddWithUniqueName(view.Jointures, joinLst, "J"); WizardTools.Tools.AddWithUniqueName(view.Jointures, join2, "J", joinLst.Jointures); view.Detail = true; view.Jointures.Remove(join); field.Jointure = joinLstRoleID; field.Editeur = TemplateType.GridView; field.VisibleListe = false; var lstView = new TabloidConfigView { Nom = newTableName, Titre = newTableName, Schema = view.Schema, DbKey = "id_" + newTableName }; var joinLstView = new TabloidConfigJointure { NomTable = view.NomTable, DbKey = view.DbKey, ChampDeRef = view.NomTable + "_id" }; var joinLstView2 = new TabloidConfigJointure { NomTable = join.NomTable, DbKey = join.DbKey, ChampDeRef = join.NomTable + "_id" }; var j1 = WizardTools.Tools.AddWithUniqueName(lstView.Jointures, joinLstView, "J"); var j2 = WizardTools.Tools.AddWithUniqueName(lstView.Jointures, joinLstView2, "J"); //var c1 = new TabloidConfigColonne //{ // Titre = view.NomTable, // Type = DbType.Int16, // Champ = view.DbKey, // Editeur = TemplateType.ComboBoxPlus, // Jointure = j1 //}; var c2 = new TabloidConfigColonne { Titre = field.Titre, Type = DbType.Int16, Champ = field.Champ, Valideurs = field.Valideurs, Obligatoire = field.Obligatoire, Information = field.Information, Editeur = TemplateType.ComboBoxPlus, Jointure = j2 }; //WizardTools.addWithUniqueName(lstView.Colonnes, c1, "C"); WizardTools.Tools.AddWithUniqueName(lstView.Colonnes, c2, "C"); TabloidConfig.Config.Views.Add(lstView); return(true); }
/// <summary> /// Convert field to list /// </summary> /// <param name="view"></param> /// <param name="field"></param> /// <param name="newTableName"></param> /// <returns></returns> public static bool ConvertFieldToList(TabloidConfigView view, TabloidConfigColonne field, string newTableName, IWin32Window own) { //search for a unique constraint name var fk1Name = SearchConstraintUniqueName(newTableName + "_fk", view.Schema); var fieldType = dataHelper.DbTypeConverter.ConvertFromGenericDbType(field.Type, WizardTools.Tools.ConvertProviderType(Program.AppSet.ProviderType)); var param = new[] { view.Schema, //0 schema newTableName, //1 new table name view.NomTable, //2 old table name field.Champ, //3 field name to convert fieldType, //4 field type fk1Name //5 constraint name }; var result = ExecuteFromFile("fieldToList.sql", param, Program.AppSet.ConnectionString, own); if (!result) { return(false); } var join = new TabloidConfigJointure { NomTable = newTableName, DbKey = "id_" + newTableName, ChampDeRef = newTableName + "_id", }; var tabloidJoinID = WizardTools.Tools.AddWithUniqueName(view.Jointures, join, "J"); field.Jointure = tabloidJoinID; field.Editeur = TemplateType.ComboBoxPlus; var lstView = new TabloidConfigView { Nom = newTableName, Titre = newTableName, Schema = view.Schema, DbKey = "id_" + newTableName }; var c2 = new TabloidConfigColonne { Titre = field.Titre, Type = field.Type, Champ = field.Champ, Valideurs = field.Valideurs, Obligatoire = field.Obligatoire, Information = field.Information, DSID = field.DSID, Editeur = field.Editeur }; field.DSID = ""; WizardTools.Tools.AddWithUniqueName(lstView.Colonnes, c2, "C"); TabloidConfig.Config.Views.Add(lstView); AddToParamMenu(lstView, own); return(true); }