Example #1
0
        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;
            }
        }
Example #2
0
    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>");
        }
    }
Example #3
0
 public void Save()
 {
     Tipo.Save(this, new Endereco(), "IDTipoEndereco", "Nome");
 }
Example #4
0
 public void Save()
 {
     Tipo.Save(this, new Telefone(), "IDTipoTelefone", "Nome");
 }
Example #5
0
 public void Save()
 {
     Tipo.Save(this, new Documento(), "IDTipoDocumento", "Nome");
 }
Example #6
0
 public void Save()
 {
     Tipo.Save(this, new Email(), "IDTipoEmail", "Nome");
 }
Example #7
0
        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;
            }
        }