Пример #1
0
        private void btnAddCiclo_Click(object sender, EventArgs e)
        {
            if (CalendarCicloPrescricao.SelectionStart < DateTime.Now.Date)
            {
                MessageBox.Show("Selecione uma data ou intervalo de datas maior que a data atual", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            try
            {
                btnAddDia.Enabled = btnNewLine.Enabled = btnRemoveDia.Enabled = true;

                prescricaoMedica.IdChavePrescricao = presenterGeneric.Salvar(new ChavePrescricao()
                {
                    idPaciente = Sessao.Paciente.Id, NomePrescricao = textBoxNomePrescricao.Text
                }, Procedure.SP_ADD_CHAVE_PRESCRICAO);
                textBoxNomePrescricao.Text = string.Empty;

                CalendarCicloPrescricao.SelectionRange = new SelectionRange(CalendarCicloPrescricao.SelectionStart, CalendarCicloPrescricao.SelectionEnd);
                lst = new List <DateTime>();
                DateTime dateTime = CalendarCicloPrescricao.SelectionStart;

                CriaDataTable();

                prescricaoMedica.IdPaciente = Sessao.Paciente.Id;
                prescricaoMedica.Prescricao = null;
                prescricaoMedica.Horario    = null;

                prescricaoMedica.Id = presenterGeneric.InsertPrescricao(prescricaoMedica);

                while (dateTime <= CalendarCicloPrescricao.SelectionEnd)
                {
                    table.Columns.Add(new DataColumn(dateTime.ToString("dd/MM"), typeof(Image)));
                    lst.Add(dateTime);
                    dateTime = dateTime.AddDays(1);
                }

                DateTime[] det = lst.ToArray();
                lst.Clear();

                dataGridViewPrescricoes.DataSource  = null;
                dataGridViewPrescricoes.DataSource  = table;
                CalendarCicloPrescricao.BoldedDates = det;

                DataTable dataTable = TableInsert();

                GetDatas();
                presenterGeneric.InsertCiclo(dataTable);

                AddNewRows();

                btnNewLine.Enabled  = table != null;
                btnAddDia.Enabled   = btnRemoveDia.Enabled = dataTable.Rows.Count > 0;
                btnAddCiclo.Visible = false;
            }
            catch (Exception exCiclo)
            {
                FrmMain.Alert(100, exCiclo);
            }
        }
Пример #2
0
        private void dataGridViewLeito_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.ColumnIndex == 3)
                {
                    var sendGrid = (DataGridView)sender;
                    if (sendGrid.Columns[e.ColumnIndex] is DataGridViewImageColumn && e.RowIndex >= 0)
                    {
                        Leito = (Leito)dataGridViewLeito.Rows[e.RowIndex].DataBoundItem;
                    }
                }

                if (e.ColumnIndex == 4)
                {
                    var sendGrid = (DataGridView)sender;
                    if (sendGrid.Columns[e.ColumnIndex] is DataGridViewImageColumn && e.RowIndex >= 0)
                    {
                        obj = (Leito)dataGridViewLeito.Rows[e.RowIndex].DataBoundItem;

                        if (MessageBox.Show($"Deseja excluir o Leito {obj.NomeLeito} ?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            Leito          = obj;
                            presenterLeito = new LeitoPresenter(this);
                            Leito          = new Leito();
                            FrmMain.Alert(presenterLeito.Excluir());
                        }
                    }
                }
            }
            catch (Exception exG)
            {
                throw new Exception("Erro ao tentar listar os Leitos:\n" + exG.Message);
            }
        }
Пример #3
0
        private void dataGridViewPrescricoes_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (dataGridViewPrescricoes.Columns[e.ColumnIndex].DataPropertyName.Equals("Horário"))
                {
                    bool item = DateTime.TryParse(dataGridViewPrescricoes.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString(), out DateTime time);
                    if (!item)
                    {
                        MessageBox.Show($"Horario invalido", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                }

                prescricaoMedica.Id         = Convert.ToInt32(dataGridViewPrescricoes.Rows[e.RowIndex].Cells["Id"].Value);
                prescricaoMedica.IdPaciente = Sessao.Paciente.Id;
                prescricaoMedica.Prescricao = dataGridViewPrescricoes.Rows[e.RowIndex].Cells["Prescrição"].Value.ToString();
                prescricaoMedica.Horario    = TimeSpan.Parse(dataGridViewPrescricoes.Rows[e.RowIndex].Cells["Horário"].Value.ToString());

                presenterGeneric.InsertPrescricao(prescricaoMedica);
            }
            catch (Exception exEditRow)
            {
                FrmMain.Alert(100, exEditRow);
            }
        }
Пример #4
0
        private void comboBoxEstruturaFisica_SelectedIndexChanged(object sender, EventArgs e)
        {
            estruturaFisica = (EstruturaFisica)comboBoxEstruturaFisica.SelectedItem;
            try
            {
                LimparFolowTable();

                if (estruturaFisica.Id == 0)
                {
                    comboBoxTemplateExameFisico.DataSource = new List <TemplateName>();
                    return;
                }

                comboBoxTemplateExameFisico.SelectedIndexChanged -= comboBoxTemplateExameFisico_SelectedIndexChanged;

                lstTemplates = presenterGeneric.GetLista(new TemplateName()
                {
                    IdEstruturaFisica = estruturaFisica.Id, Ativo = true
                }, Procedure.SP_GET_TEMPLATE_NAME);
                if (lstTemplates.Count > 0)
                {
                    lstTemplates.Insert(0, new TemplateName()
                    {
                        Id = 0, Nome = "Selecione..."
                    });
                }
                comboBoxTemplateExameFisico.DataSource = lstTemplates;

                comboBoxTemplateExameFisico.SelectedIndexChanged += comboBoxTemplateExameFisico_SelectedIndexChanged;
            }
            catch (Exception ex)
            {
                FrmMain.Alert(100, ex);
            }
        }
Пример #5
0
        private void btnRemoveDia_Click(object sender, EventArgs e)
        {
            try
            {
                if (prescricaoMedica.IdChavePrescricao == 0)
                {
                    return;
                }

                DataColumn ob = table.Columns.OfType <DataColumn>().LastOrDefault(d => Convert.ToInt32(d.ExtendedProperties["Id"]) > 0);
                if (ob == null)
                {
                    return;
                }

                int ret = presenterGeneric.Salvar(new CicloPrescricao()
                {
                    Id         = Convert.ToInt32(ob.ExtendedProperties["Id"]),
                    IdPaciente = Sessao.Paciente.Id
                }, Procedure.SP_DEL_DATE_PRESCRICAO, Acao.Excluir);


                table.Columns.Remove(ob);
            }
            catch (Exception exRemovDia)
            {
                FrmMain.Alert(100, exRemovDia);
            }
        }
Пример #6
0
 public void Salvar(object sender, EventArgs e)
 {
     try
     {
         if(Valida())
         {
             FrmMain.Alert(templateNamePresenter.Salvar());
             Novo(null, null);
         }
     }
     catch (Exception exSalvar)
     {
         FrmMain.Alert(0,exSalvar);
     }
 }
 private void Salvar(object sender, EventArgs e)
 {
     try
     {
         DataView dv = tabelaItens.DefaultView;
         dv.Sort     = "IdItemArea asc";
         tabelaItens = dv.ToTable();
         templateExamePresenter.RemoveItens();
         FrmMain.Alert(templateExamePresenter.BulkInsert(tabelaItens, "TB_TemplateExame_Itens"));
         btnStepVoltar_Click(null, null);
     }
     catch (Exception exSalvar)
     {
         FrmMain.Alert(0, exSalvar);
     }
 }
Пример #8
0
 private void btnValidarPrescricao_Click(object sender, EventArgs e)
 {
     try
     {
         int idPrescricao = Convert.ToInt32(comboBoxDataPrescricao.SelectedValue);
         FrmMain.Alert(presenterGeneric.Salvar(new ChavePrescricao()
         {
             idPaciente = Sessao.Paciente.Id, Id = idPrescricao
         }, Procedure.SP_ADD_CHAVE_PRESCRICAO));
         GetDatas();
     }
     catch (Exception ex)
     {
         FrmMain.Alert(100, ex);
         throw;
     }
 }
Пример #9
0
        private void btnAddDia_Click(object sender, EventArgs e)
        {
            try
            {
                if (prescricaoMedica.IdChavePrescricao == 0)
                {
                    return;
                }

                DataColumn dataColumns = table.Columns.OfType <DataColumn>().LastOrDefault(dc => dc.DataType == typeof(Image) && dc.ColumnName != "Act");

                DateTime newDate = Convert.ToDateTime(dataColumns.ColumnName);
                newDate = newDate.AddDays(1);

                int idDateCiclo = presenterGeneric.Salvar(new CicloPrescricao()
                {
                    DataCiclo         = newDate,
                    IdChavePrescricao = Convert.ToInt32(comboBoxDataPrescricao.SelectedValue),
                    IdPaciente        = Sessao.Paciente.Id
                },
                                                          Procedure.SP_ADD_DATE);

                DataColumn dataColumn = table.Columns["Act"];
                table.Columns.Remove(dataColumn);

                DataColumn dataColumnNewDate = new DataColumn(newDate.ToString("dd/MM"), typeof(Image));
                dataColumnNewDate.ExtendedProperties.Add("Id", idDateCiclo);

                table.Columns.Add(dataColumnNewDate);
                table.Columns.Add(dataColumn);

                foreach (DataRow item in table.Rows)
                {
                    item["Act"] = Properties.Resources.rubbishbin_102620;
                    item[newDate.ToString("dd/MM")] = Properties.Resources.Wait;
                }

                ConfigGrid();
            }
            catch (Exception exEAddDia)
            {
                FrmMain.Alert(100, exEAddDia);
            }
        }
Пример #10
0
        private void btnAlterarSenha_Click(object sender, EventArgs e)
        {
            try
            {
                if (textBoxSenha.Text.Length < 5)
                {
                    MessageBox.Show("A nova senha deve conter pelo menos 5 caracteres!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    return;
                }

                if (!textBoxSenha.Text.Equals(textBoxConfirmarSenha.Text, StringComparison.CurrentCulture))
                {
                    MessageBox.Show("As senhas informada não coincidem!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                    return;
                }

                if ((bool)Sessao.Usuario.AlterarSenha)
                {
                    FrmMain          frmMain          = (FrmMain)FindForm();
                    UsuarioPresenter usuarioPresenter = new UsuarioPresenter();

                    Sessao.Usuario.Senha        = CriptoGrafaSenha();
                    Sessao.Usuario.AlterarSenha = false;

                    int ret = (int)usuarioPresenter.Salvar(Sessao.Usuario);
                    if (ret == 1)
                    {
                        FrmMain.Alert(5);
                        frmMain.BloquearSistema(true);
                        Dispose();
                    }
                    else
                    {
                        FrmMain.Alert(ret);
                    }
                }
            }

            catch (Exception exalter)
            {
                FrmMain.Alert(0, exalter);
            }
        }
Пример #11
0
        private void dataGridViewPrescricoes_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (dataGridViewPrescricoes.Columns[e.ColumnIndex].DataPropertyName.Equals("Act"))
            {
                if (Sessao.Usuario.Perfil.HasFlag(Perfil.Medicos))
                {
                    try
                    {
                        int _id = Convert.ToInt32(table.Rows[e.RowIndex][0]);
                        _id = presenterGeneric.Salvar(new PrescricaoMedica()
                        {
                            Id = _id
                        }, Procedure.SP_DEL_PRESCRICAO, Acao.Excluir);

                        if (_id > 0)
                        {
                            _id = Convert.ToInt32(table.Rows[e.RowIndex]["IdChavePrescricao"]);
                            table.Rows.RemoveAt(e.RowIndex);

                            if (table.Rows.Count == 0)
                            {
                                _id = presenterGeneric.Salvar(new PrescricaoMedica()
                                {
                                    Id = _id
                                }, Procedure.SP_DEL_CHAVE_PRESCRICAO, Acao.Excluir);
                                table = null;
                                dataGridViewPrescricoes.DataSource = null;
                                lblCicloPrescricao.Visible         = false;
                                btnAddDia.Enabled = btnNewLine.Enabled = btnRemoveDia.Enabled = false;
                                GetDatas();
                            }
                        }
                    }
                    catch (Exception exRemoveItem)
                    {
                        FrmMain.Alert(100, exRemoveItem);
                    }
                }
            }
        }
Пример #12
0
        private void comboBoxTemplateExameFisico_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                LimparFolowTable();
                TemplateName templateName = (TemplateName)comboBoxTemplateExameFisico.SelectedItem;

                if (templateName.Id == 0)
                {
                    return;
                }

                lstAreaItem = presenterGeneric.GetLista(new Area_Itens()
                {
                    IdTemplate = templateName.Id
                }, Procedure.SP_GET_ITENS_TEMPLATE);
                Populatemplate();
            }
            catch (Exception ex)
            {
                FrmMain.Alert(100, ex);
            }
        }
Пример #13
0
        private void dataGridViewQuartos_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.ColumnIndex == 4)
                {
                    var sendGrid = (DataGridView)sender;
                    if (sendGrid.Columns[e.ColumnIndex] is DataGridViewImageColumn && e.RowIndex >= 0)
                    {
                        Quarto obj = (Quarto)dataGridViewQuartos.Rows[e.RowIndex].DataBoundItem;
                        QuartoLeito = obj;
                    }
                }

                if (e.ColumnIndex == 5)
                {
                    var ob = (Quarto)dataGridViewQuartos.Rows[e.RowIndex].DataBoundItem;
                    if (MessageBox.Show($"Deseja excluir o quarto {ob.NomeQuarto} ?", "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        presenterQuarto = new QuartoPresenter(this);
                        FrmMain.Alert(presenterQuarto.Excluir(ob.Id));
                    }
                }
            }
            catch (SqlException exSqEx)
            {
                if (exSqEx.Number == 547)
                {
                    MessageBox.Show("Existem leitos associados para este registro\nExclua os leitos deste quarto antes de remover o quarto " + QuartoLeito.NomeQuarto, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Erro: " + ex.Message);
            }
        }
Пример #14
0
        private void btnNewLine_Click(object sender, EventArgs e)
        {
            try
            {
                prescricaoMedica.IdPaciente        = Sessao.Paciente.Id;
                prescricaoMedica.Id                = 0;
                prescricaoMedica.IdChavePrescricao = Convert.ToInt32(comboBoxDataPrescricao.SelectedValue);
                prescricaoMedica.Prescricao        = null;
                prescricaoMedica.Horario           = null;

                if (prescricaoMedica.IdChavePrescricao == 0)
                {
                    return;
                }

                prescricaoMedica.Id = presenterGeneric.InsertPrescricao(prescricaoMedica);

                AddNewRows();
            }
            catch (Exception exNewLinhe)
            {
                FrmMain.Alert(100, exNewLinhe);
            }
        }
Пример #15
0
        private void MySalvar_Click(object sender, EventArgs e)
        {
            TabPage tab = tabControlQuartoLeito.SelectedTab;

            if (tab.Name.Equals("tabPageQuartos"))
            {
                if (Valida(0))
                {
                    presenterQuarto = new QuartoPresenter(this);
                    FrmMain.Alert(presenterQuarto.Salvar());
                    QuartoLeito = new Quarto();
                }
            }

            if (tab.Name.Equals("tabPageLeito"))
            {
                if (Valida(1))
                {
                    presenterLeito        = new LeitoPresenter(this);
                    Leito                 = new Leito();
                    textBoxlLeitoQtd.Text = string.Empty;
                    FrmMain.Alert(presenterLeito.Salvar());
                    PopulaOcupacoes();
                }
            }

            if (tab.Name.Equals("tabPageInernacao"))
            {
                Paciente paciente = Sessao.Paciente;
                if (paciente != null)
                {
                    RadioButton radioButton = flowLayoutPanelImgLeito.Controls.OfType <RadioButton>().FirstOrDefault(r => r.Checked == true);

                    if (radioButton == null)
                    {
                        MessageBox.Show("Selecione um Leito disponivel", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                        return;
                    }

                    obj = (Leito)radioButton.Tag;

                    if (obj.IsManutencao)
                    {
                        MessageBox.Show("Leito em MANUTENÇÃO", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        return;
                    }

                    string msg = $"Tem certeza que deseja associar o paciente {paciente.Nome} ao  leito {obj.NomeLeito} ?";

                    if (MessageBox.Show(msg, "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                    {
                        obj.IsDisponibilidade = false;
                        obj.Prontuario        = paciente.Prontuario;
                        obj.Nome = string.Empty;
                        obj.Act  = 'X';
                        presenterLeito.Salvar(obj);
                        AtualizaUserControls();
                    }
                }
                else
                {
                    MessageBox.Show("Selecione um paciente na lista ao lado, e tente novamente.", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                }

                Sessao.Paciente = null;
                paciente        = null;
            }
        }
Пример #16
0
        private void Salvar(object sender, EventArgs e)
        {
            try
            {
                if (!ValidaCampos())
                {
                    return;
                }
                bool ret = Funcoes.ValidaCpf(Regex.Replace(mskCpf.Text, @"[^0-9$]", string.Empty));
                if (!ret)
                {
                    errorProviderFields.SetError(mskCpf, "CPF inválido");
                    errorProviderFields.SetIconPadding(mskCpf, 3);
                    return;
                }
                else
                {
                    errorProviderFields.SetError(mskCpf, null);
                }

                usuarioPresenter = new UsuarioPresenter(this);
                int retorno = (int)usuarioPresenter.Salvar();
                if (retorno == 1)
                {
                    if (usuario.Id == 0)
                    {
                        Usuario objUsuario = usuario;
                        objUsuario.Senha = textBoxSenha.Text.Trim();
                        retorno          = Funcoes.EnviarEmail(objUsuario, true);

                        if (retorno == 0)
                        {
                            MessageBox.Show($"Usuário cadastrado com sucesso!\nEnviamos para o email {usuario.Email} as informações de acesso ao sistema SAE", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }

                        if (retorno == 1)
                        {
                            MessageBox.Show($"Envio de email cancelado!\nO serviço de email não consegui enviar as informas para o email {usuario.Email}", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }

                        if (retorno == 2)
                        {
                            MessageBox.Show($"Ocorreu um Erro!\nOcorreu um erro na tentativa de enviar o e-mail para {usuario.Email}", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }

                        objUsuario = null;
                    }
                    else
                    {
                        FrmMain.Alert(retorno);
                    }

                    Carregar();
                }
                MyNovo_Click(null, null);
            }
            catch (Exception exSalvar)
            {
                MessageBox.Show(exSalvar.Message, "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #17
0
        private void AddNewRows()
        {
            try
            {
                List <CicloPrescricao> lstCicloItem = presenterGeneric.GetLista(new CicloPrescricao()
                {
                    IdChavePrescricao = prescricaoMedica.IdChavePrescricao,
                    IdPaciente        = Sessao.Paciente.Id
                }
                                                                                , Procedure.SP_GET_CICLO);

                DataRow row = table.NewRow();

                if (!table.Columns.Contains("Act"))
                {
                    table.Columns.Add(new DataColumn("Act", typeof(Image)));
                }

                row["Id"]                = prescricaoMedica.Id;
                row["IdCliente"]         = Sessao.CodigoCliente;
                row["IdChavePrescricao"] = prescricaoMedica.IdChavePrescricao;
                row["IdPaciente"]        = Sessao.Paciente.Id;
                row["Horário"]           = TimeSpan.Parse(DateTime.Now.ToShortTimeString());
                row["Prescrição"]        = string.Empty;
                row["Justificativa"]     = string.Empty;
                row["Act"]               = Properties.Resources.rubbishbin_102620;

                foreach (DataColumn item in table.Columns)
                {
                    if (item.DataType == typeof(Image))
                    {
                        if (item.ColumnName.Equals("Act"))
                        {
                            continue;
                        }

                        if (Convert.ToDateTime(item.Caption) >= DateTime.Now.Date)
                        {
                            row[item.ColumnName] = Properties.Resources.Wait;
                        }
                        else
                        {
                            row[item.ColumnName] = Properties.Resources.integative;
                        }

                        if (table.Rows.Count == 0)
                        {
                            item.ExtendedProperties.Add("Id", lstCicloItem.Find(c => c.DataCiclo.Equals(Convert.ToDateTime(item.Caption))).Id);
                        }
                    }
                }

                table.Rows.Add(row);
                ConfigGrid();

                btnNewLine.Enabled = table != null;
                btnAddDia.Visible  = btnRemoveDia.Visible = table.Rows.Count > 0;
            }
            catch (Exception exNewLn)
            {
                FrmMain.Alert(100, exNewLn);
            }
        }
Пример #18
0
        private void dataGridViewPrescricoes_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                string       _justificativa = string.Empty;
                DataGridView sendGrid       = (DataGridView)sender;
                DataRow      dataRow        = table.Rows[e.RowIndex];

                if (sendGrid.Columns[e.ColumnIndex] is DataGridViewImageColumn)
                {
                    if (e.ColumnIndex >= 2 && dataGridViewPrescricoes.Columns[e.ColumnIndex].Name != "Act")
                    {
                        DateTime dateTime = Convert.ToDateTime(dataGridViewPrescricoes.Columns[e.ColumnIndex].HeaderText);
                        if (dateTime.Equals(DateTime.Now.Date))
                        {
                            if (Sessao.Usuario.Perfil.HasFlag(Perfil.Enfermeiro_Assistemcial) || Sessao.Usuario.Perfil.HasFlag(Perfil.Tecnico))
                            {
                                TimeSpan time = (TimeSpan)dataGridViewPrescricoes["Horário", e.RowIndex].Value;
                                if (DateTime.Now.TimeOfDay - time > new TimeSpan(1, 0, 59) || DateTime.Now.TimeOfDay - time < new TimeSpan(-1, 0, 59))
                                {
                                    string msgBox = "Essa linha de prescrição, tem mais de 1:00 atrasada ou adiantada do horario previsto.";
                                    msgBox += "\nDeseja realizar a checagem e justificar o motivo.";

                                    if (MessageBox.Show(msgBox, "Aviso", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                                    {
                                        table.Columns["Justificativa"].ReadOnly = false;

                                        DialogResult dialog = new Frm.FrmJustificarChecagem(dataRow).ShowDialog();
                                        table.Columns["Justificativa"].ReadOnly = true;
                                        if (dialog != DialogResult.OK)
                                        {
                                            return;
                                        }
                                        else
                                        {
                                            sendGrid.Rows[e.RowIndex].Cells["Justificativa"].ReadOnly = false;
                                            _justificativa = sendGrid.Rows[e.RowIndex].Cells["Justificativa"].Value.ToString();
                                            sendGrid.Rows[e.RowIndex].Cells["Justificativa"].ReadOnly = true;

                                            presenterGeneric.Salvar(new PrescricaoMedica()
                                            {
                                                Id                = Convert.ToInt32(table.Rows[e.RowIndex]["Id"]),
                                                IdPaciente        = Sessao.Paciente.Id,
                                                IdChavePrescricao = Convert.ToInt32(table.Rows[e.RowIndex]["IdChavePrescricao"]),
                                                Justificativa     = _justificativa
                                            }, Procedure.SP_UPDT_JUSTIFICATIVA, Acao.Atualizar);
                                        }
                                    }
                                    else
                                    {
                                        return;
                                    }
                                }
                            }
                            else
                            {
                                return;
                            }


                            if (dataGridViewPrescricoes.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag == null || (int)dataGridViewPrescricoes.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag == 0)
                            {
                                dataGridViewPrescricoes.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = Properties.Resources.IsOk;
                                dataGridViewPrescricoes.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag   = 1;
                            }
                            else
                            {
                                dataGridViewPrescricoes.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = Properties.Resources.Wait;
                                dataGridViewPrescricoes.Rows[e.RowIndex].Cells[e.ColumnIndex].Tag   = 0;
                            }

                            presenterGeneric.Salvar(new CicloPrescricao()
                            {
                                Id                = Convert.ToInt32(table.Columns[e.ColumnIndex].ExtendedProperties["Id"]),
                                IdPaciente        = Sessao.Paciente.Id,
                                IdPrescricao      = dataGridViewPrescricoes.Rows[e.RowIndex].Cells[0].Value.ToString(),
                                IdChavePrescricao = Convert.ToInt32(table.Rows[e.RowIndex]["IdChavePrescricao"]),
                                Checado           = DateTime.Now,
                            }, Procedure.SP_ADD_DATE, Acao.Atualizar);
                        }
                        else
                        {
                            MessageBox.Show("Não é permitido realizar checagem de cuidados prescritos em datas passadas ou futuras", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                        }
                    }
                }
                else
                if (sendGrid.Columns[e.ColumnIndex].Name.Equals("Justificativa"))
                {
                    new Frm.FrmJustificarChecagem(dataRow, false).ShowDialog();
                }
            }
            catch (Exception exChekPrescricao)
            {
                FrmMain.Alert(100, exChekPrescricao);
            }
        }