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; }
/// <summary> /// Build a join from an existing one. Add result to hte table. Join must be N:1 type /// </summary> /// <param name="joinSource">join to convert</param> /// <param name="destinationView"></param> /// <param name="destinationJoin"></param> /// <param name="parentView">new join will be added to parent view id null CurrentContext is used</param> /// <returns></returns> public static TabloidConfigJointure convertN11N(TabloidConfigJointure joinSource, TabloidConfigView destinationView, TabloidConfigJointureCollection destinationJoin, TabloidConfigView parentView = null) { if (joinSource.Relation != "N:1" && joinSource.Relation != null) { throw new Exception(Properties.Resources.ConvertOnlyN1Join); } parentView = parentView ?? CurrentContext.CurrentView; if (joinSource.Parent != null) { parentView = TabloidConfig.Config.Views[joinSource.Parent.NomTable]; } TabloidConfigJointure parent = null; if (destinationJoin.Count > 0) { parent = destinationJoin[0].Parent; } var result = new TabloidConfigJointure { Relation = "1:N", ChampDeRef = destinationView.NomTable + "." + joinSource.DbKey, ChampDeRef2 = ChampTools.RemoveTableName(joinSource.ChampDeRef), DbKey = parentView.DbKey, NomTable = parentView.NomTable, Parent = parent }; Tools.AddWithUniqueName(destinationView.Jointures, result, "J", destinationJoin); return(result); }
/// <summary> /// Delete column in table /// Remove constraint if exist /// </summary> /// <param name="table">Field table name without schema</param> /// <param name="schema"></param> public static void DropColumn(string table, string column, string schema, IWin32Window own) { string error; var constraints = DataTools.Data(SqlCommands.SqlGetForeignKey(table, schema), Program.AppSet.ConnectionString, out error); var columnConstraints = new DataView(constraints, constraints.Columns[0].ColumnName + " like '" + column + "'", "", DataViewRowState.Unchanged); foreach (DataRowView dr in columnConstraints) { var param1 = new string[] { schema, dr[3].ToString(), table }; WizardSQLHelper.ExecuteFromFile("DropForeignKey.sql", param1, Program.AppSet.ConnectionString, own); } var param = new string[] { schema + "." + table, ChampTools.RemoveTableName(column) }; WizardSQLHelper.ExecuteFromFile("supField.sql", param, Program.AppSet.ConnectionString, own); }