public static void Save(IType objiTypeValues, IType iType, string namePropertyId, string namePropertyName) { var tipoTabelaColuna = new TipoTabelaColuna(iType); try { tipoTabelaColuna.IsTransaction = true; tipoTabelaColuna.Get(); tipoTabelaColuna.Save(); var tipo = new Tipo(); tipo.Transaction = tipoTabelaColuna.Transaction; tipo.IDTipo = (int?)objiTypeValues.GetType().GetProperty(namePropertyId).GetValue(objiTypeValues, null); tipo.Nome = (string)objiTypeValues.GetType().GetProperty(namePropertyName).GetValue(objiTypeValues, null); tipo.TipoTabelaColuna = tipoTabelaColuna; tipo.Save(); tipoTabelaColuna.Commit(); } catch (Exception err) { tipoTabelaColuna.Rollback(); throw err; } }
protected void btnSalvar_Click(object sender, EventArgs e) { var Tipo = new Tipo(); try { if (txtId.Text != "") { Tipo.IDTipo = int.Parse(txtId.Text); Tipo.Get(); } Tipo.Nome = txtNome.Text; Tipo.IDTipoTabelaColuna = int.Parse(txtIDTipoTabelaColuna.Text); Tipo.Save(); GetTipo((int)Tipo.IDTipo); Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>alert('Registro salvo.')</script>"); } catch (Exception err) { Page.ClientScript.RegisterStartupScript(this.GetType(), "script", "<script>alert('" + FormatError.FormatMessageForJAlert(err.Message) + "')</script>"); } }
public void Save() { Tipo.Save(this, new Endereco(), "IDTipoEndereco", "Nome"); }
public void Save() { Tipo.Save(this, new Telefone(), "IDTipoTelefone", "Nome"); }
public void Save() { Tipo.Save(this, new Documento(), "IDTipoDocumento", "Nome"); }
public void Save() { Tipo.Save(this, new Email(), "IDTipoEmail", "Nome"); }