public static void CheckParam(DBProcedure procedure, Dictionary <string, object> parameterList) { bool showDialog = false; foreach (DBProcParameter param in procedure.Parameters) { if (!parameterList.ContainsKey(param.Name)) { showDialog = true; break; } } if (showDialog) { if (!FormParam.Initialize(procedure, parameterList)) { throw new Exception("Cancel!"); } } }
public static bool Initialize(DBProcedure procedure, Dictionary <string, object> existingParam) { var window = new FormParam(); window.Label.Text = procedure.ToString(); var table = new DBTable <DBItem>(procedure.Name + "Param") { Schema = procedure.Schema, BlockSize = 1 }; foreach (var param in procedure.Parameters) { if (existingParam.ContainsKey(param.Name.ToString())) { continue; } DBColumn col = new DBColumn { Name = param.Name != null && param.Name.Length > 0 ? param.Name : "NewColumn", Table = table }; if (param.Column != null) { if (param.Column.IsPrimaryKey) { col.ReferenceTable = param.Column.Table; } if (param.Column.IsReference) { col.ReferenceTable = param.Column.ReferenceTable; } } col.DataType = param.DataType; table.Columns.Add(col); } var row = table.NewItem(); window.propertyes.FieldSource = row; window.propertyes.ResetFields(); window.propertyes.EditState = EditListState.Edit; window.ButtonAcceptClick += (s, e) => { foreach (var column in table.Columns) { if (row[column] == DBNull.Value && MessageDialog.AskQuestion("Параметры", "Не все Параметры были указаны, продолжить?", Command.No, Command.Yes) == Command.No) { return; } existingParam.Add(column.Name, row[column]); } window.Hide(); }; window.Show(null, Point.Zero); //p.Dispose(); //ts.Dispose(); return(true); }