public StoredProcedure montaProcedure() { //vai conter nomeDoCampo e valor Dictionary<string, object> dic = new Dictionary<string, object>(); //Objeto Procedure BaseCore.StoredProcedure proc = new BaseCore.StoredProcedure(Procedure); StringBuilder sbuilder = new StringBuilder("exec " + Procedure + " " + "@operacao=" + Operacao + ", "); //operacao de update if (Operacao == "u") { dic.Add("id",Id); dic.Add("operacao", Operacao); } //operacao de insert else { dic.Add("operacao", Operacao); } //string ParamNomeValor = ""; foreach (Control ctrl in base.Controls) { if (ctrl.GetType() == typeof(TextBox)) { dic.Add(ctrl.Name,ctrl.Text); } else if (ctrl.GetType() == typeof(ComboBox)) { dic.Add(ctrl.Name, ctrl.Text); } else if (ctrl.GetType() == typeof(DateTimePicker)) { dic.Add(ctrl.Name, (ctrl as DateTimePicker).Value); } else if (ctrl.GetType() == typeof(MaskedTextBox)) { dic.Add(ctrl.Name, ctrl.Text); } } proc.addParameter(dic); return proc; }
public StoredProcedure montaProcedure() { //vai conter nomeDoCampo e valor Dictionary <string, object> dic = new Dictionary <string, object>(); //Objeto Procedure BaseCore.StoredProcedure proc = new BaseCore.StoredProcedure(Procedure); StringBuilder sbuilder = new StringBuilder("exec " + Procedure + " " + "@operacao=" + Operacao + ", "); //operacao de update if (Operacao == "u") { dic.Add("id", Id); dic.Add("operacao", Operacao); } //operacao de insert else { dic.Add("operacao", Operacao); } //string ParamNomeValor = ""; foreach (Control ctrl in base.Controls) { if (ctrl.GetType() == typeof(TextBox)) { dic.Add(ctrl.Name, ctrl.Text); } else if (ctrl.GetType() == typeof(ComboBox)) { dic.Add(ctrl.Name, ctrl.Text); } else if (ctrl.GetType() == typeof(DateTimePicker)) { dic.Add(ctrl.Name, (ctrl as DateTimePicker).Value); } else if (ctrl.GetType() == typeof(MaskedTextBox)) { dic.Add(ctrl.Name, ctrl.Text); } } proc.addParameter(dic); return(proc); }