private void CarregarMedicoExecucaoAgenda()
        {
            try
            {
                MedicoExecucaoAgenda medicoExecucaoAgenda = new MedicoExecucaoAgenda();
                this.ddlMedicoExecucaoAgenda.DataSource =
                    new MedicoExecucaoAgendaRepository().Retreave(new MedicoExecucaoAgenda());

                this.ddlMedicoExecucaoAgenda.DataValueField = "MedicoExecucaoAgendaID";
                this.ddlMedicoExecucaoAgenda.DataTextField  = "Nome";
                this.ddlMedicoExecucaoAgenda.DataBind();
                this.ddlMedicoExecucaoAgenda.Items.Insert(0, new ListItem("Selecione", "0"));
            }
            catch (Exception e)
            {
                Log.Create(e);
                Email.Send("Agendamento de congelação - falha na aplicação", e);
                this.msgDialog.Show
                (
                    "Erro"
                    , "Ocorreu uma falha ao carregar os registros de médicos de execução de agenda."
                    , UserControl.Message.Type.Error
                );
            }
        }
 private void Excluir(Int32 id)
 {
     try
     {
         MedicoExecucaoAgenda medicoExecucaoAgenda = new MedicoExecucaoAgenda();
         medicoExecucaoAgenda.MedicoExecucaoAgendaID = id;
         new MedicoExecucaoAgendaRepository().Delete(medicoExecucaoAgenda);
     }
     catch (Exception e)
     {
         Log.Create(e);
         Email.Send("Agendamento de congelação - falha na aplicação", e);
         this.msgDialog.Show("Erro", "Ocorreu uma falha ao excluir o registro.", UserControl.Message.Type.Error);
     }
 }
        protected void gvMedicoExecucaoAgenda_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                MedicoExecucaoAgenda medicoExecucaoAgenda = (MedicoExecucaoAgenda)e.Row.DataItem;

                Literal litNome    = (Literal)e.Row.FindControl("litNome");
                Literal litEmail   = (Literal)e.Row.FindControl("litEmail");
                Literal litCelular = (Literal)e.Row.FindControl("litCelular");

                litNome.Text  = medicoExecucaoAgenda.Nome;
                litEmail.Text = medicoExecucaoAgenda.Email;
                String celularMascara =
                    String.Format
                    (
                        "({0}) {1}"
                        , medicoExecucaoAgenda.Celular.Substring(0, 2)
                        , medicoExecucaoAgenda.Celular.Remove(0, 2)
                    );
                litCelular.Text = celularMascara;
            }
        }
        private void CarregarParaEdicao(Int32 id)
        {
            try
            {
                MedicoExecucaoAgenda medicoExecucaoAgenda = new MedicoExecucaoAgenda();
                medicoExecucaoAgenda =
                    new MedicoExecucaoAgendaRepository().Details(new MedicoExecucaoAgenda()
                {
                    MedicoExecucaoAgendaID = id
                });

                this.txtNome.Text    = medicoExecucaoAgenda.Nome;
                this.txtEmail.Text   = medicoExecucaoAgenda.Email;
                this.txtCelular.Text = medicoExecucaoAgenda.Celular;
            }
            catch (Exception e)
            {
                Log.Create(e);
                Email.Send("Agendamento de congelação - falha na aplicação", e);
                this.msgDialog.Show("Erro", "Ocorreu uma falha ao carregar o registro para edição.", UserControl.Message.Type.Error);
            }
        }
        private void CarregarMedicoExecucaoAgendas()
        {
            try
            {
                MedicoExecucaoAgenda medicoExecucaoAgenda = new MedicoExecucaoAgenda();

                if (this.txtNome.Text.Length > 0)
                {
                    medicoExecucaoAgenda.Nome = this.txtNome.Text;
                }

                if (this.txtEmail.Text.Length > 0)
                {
                    medicoExecucaoAgenda.Email = this.txtEmail.Text;
                }

                if (this.txtCelular.Text.Length > 0)
                {
                    medicoExecucaoAgenda.Celular = Text.OnlyNumbers(this.txtCelular.Text);
                }

                List <MedicoExecucaoAgenda> medicoExecucaoAgendas
                    = new MedicoExecucaoAgendaRepository().Retreave(medicoExecucaoAgenda);

                VsMedicoExecucaoAgenda = medicoExecucaoAgendas;
                this.gvMedicoExecucaoAgenda.DataSource = medicoExecucaoAgendas;
                this.gvMedicoExecucaoAgenda.DataBind();
                this.lblTotalRegistros.Text     = medicoExecucaoAgendas.Count.ToString();
                this.infoTotalRegistros.Visible = true;
            }
            catch (Exception e)
            {
                Log.Create(e);
                Email.Send("Agendamento de congelação - falha na aplicação", e);
                this.msgDialog.Show("Erro", "Ocorreu uma falha ao carregar os registros de médicos de execução de agenda.", UserControl.Message.Type.Error);
            }
        }
        public void CarreagarMedicoExecucaoAgenda(MedicoExecucaoAgenda medicoExecucaoAgenda)
        {
            try
            {
                medicoExecucaoAgenda            = new MedicoExecucaoAgendaRepository().Details(medicoExecucaoAgenda);
                this.txtNomeMedicoExecutor.Text = medicoExecucaoAgenda.Nome;

                String celularMascara =
                    String.Format
                    (
                        "({0}) {1}"
                        , medicoExecucaoAgenda.Celular.Substring(0, 2)
                        , medicoExecucaoAgenda.Celular.Remove(0, 2)
                    );
                this.txtCelular.Text = celularMascara;
                this.txtEmail.Text   = medicoExecucaoAgenda.Email;
            }
            catch (Exception e)
            {
                Log.Create(e);
                Email.Send("Agendamento de congelação - falha na aplicação", e);
                this.msgDialog.Show("Erro", "Ocorreu uma falha ao carregar o registro do médico executor da agenda.", UserControl.Message.Type.Error);
            }
        }