Esempio n. 1
0
        protected override bool salvar(object sender, EventArgs e)
        {
            bool Retorno = epValidaDados.Validar(true);

            if (Retorno)
            {
                try
                {
                    rotaBLL = new RotaBLL();
                    rotaBLL.UsuarioLogado = Program.usuario_logado;

                    Rota rota = LoadFromControls();

                    if (Id != null)
                    {
                        rotaBLL.AlterarRota(rota);
                    }
                    else
                    {
                        rotaBLL.AdicionarRota(rota);
                    }

                    if (rota.id != 0)
                    {
                        Id         = rota.id;
                        txtId.Text = rota.id.ToString();
                    }

                    Retorno = true;
                }
                catch (Exception ex)
                {
                    Retorno = false;
                    throw ex;
                }
            }
            return(Retorno);
        }