public List <MLTAB_AGENDA> DiaAtual(DateTime Age_Data) { List <MLTAB_AGENDA> lstMLTAB_AGENDA = new List <MLTAB_AGENDA>(); using (SqlConnection objConexao = new SqlConnection(strConnection)) { using (SqlCommand objComando = new SqlCommand(strSelectDia, objConexao)) { objComando.Parameters.AddWithValue("@Age_Data", Age_Data); objConexao.Open(); SqlDataReader objDataReader = objComando.ExecuteReader(); if (objDataReader.HasRows) { while (objDataReader.Read()) { MLTAB_AGENDA objMLAGENDA = new MLTAB_AGENDA(); objMLAGENDA.Hora = objDataReader["Hora"].ToString(); objMLAGENDA.Cli_Nome = objDataReader["Cli_Nome"].ToString(); objMLAGENDA.Age_ValorSessao = Convert.ToInt16(objDataReader["Age_ValorSessao"]); lstMLTAB_AGENDA.Add(objMLAGENDA); } objDataReader.Close(); } objConexao.Close(); } } return(lstMLTAB_AGENDA); }
public List <MLTAB_AGENDA> ConsultaID(int ID_TAT) { List <MLTAB_AGENDA> listMLTAB_AGENDA = new List <MLTAB_AGENDA>(); using (SqlConnection objConexao = new SqlConnection(strConnection)) { using (SqlCommand objComando = new SqlCommand(strSelectID, objConexao)) { objComando.Parameters.AddWithValue("@ID_TAT", ID_TAT); objConexao.Open(); SqlDataReader objDataReader = objComando.ExecuteReader(); if (objDataReader.HasRows) { while (objDataReader.Read()) { MLTAB_AGENDA objMLTAB_AGENDA = new MLTAB_AGENDA(); objMLTAB_AGENDA.ID_AGE = Convert.ToInt32(objDataReader["ID_AGE"].ToString()); listMLTAB_AGENDA.Add(objMLTAB_AGENDA); } } objDataReader.Close(); } objConexao.Close(); } return(listMLTAB_AGENDA); }
public int ConsultarIDAGE(MLTAB_AGENDA objml) { int ID_AGE = 0; using (SqlConnection objConexao = new SqlConnection(strConnection)) { using (SqlCommand objComando = new SqlCommand(strSelectIDAGE, objConexao)) { objComando.Parameters.AddWithValue("@Age_Data", objml.Age_Data); objComando.Parameters.AddWithValue("@Hora", objml.Hora); objComando.Parameters.AddWithValue("@Cli_Nome", objml.Cli_Nome); objConexao.Open(); SqlDataReader objDataReader = objComando.ExecuteReader(); if (objDataReader.HasRows) { while (objDataReader.Read()) { ID_AGE = Convert.ToInt16(objDataReader["ID_AGE"].ToString()); } } objDataReader.Close(); } objConexao.Close(); } return(ID_AGE); }
public List <MLTAB_AGENDA> ValorSessoes(int ID_TAT) { List <MLTAB_AGENDA> lstMLTAB_AGENDA = new List <MLTAB_AGENDA>(); using (SqlConnection objConexao = new SqlConnection(strConnection)) { using (SqlCommand objComando = new SqlCommand(strValor, objConexao)) { objComando.Parameters.AddWithValue("@ID_TAT", ID_TAT); objConexao.Open(); SqlDataReader objDataReader = objComando.ExecuteReader(); if (objDataReader.HasRows) { while (objDataReader.Read()) { MLTAB_AGENDA objMLAGENDA = new MLTAB_AGENDA(); objMLAGENDA.Age_ValorSessao = Convert.ToInt32(objDataReader["Age_ValorSessao"].ToString()); lstMLTAB_AGENDA.Add(objMLAGENDA); } objDataReader.Close(); } objConexao.Close(); } } return(lstMLTAB_AGENDA); }
public int Gravar(MLTAB_AGENDA objMLTAB_AGENDA) { int retorno = 0; using (SqlConnection objConexao = new SqlConnection(strConnection)) { using (SqlCommand objComando = new SqlCommand(strInsert, objConexao)) { objComando.Parameters.AddWithValue("@ID_TAT", objMLTAB_AGENDA.ID_TAT); objComando.Parameters.AddWithValue("@ID_FUN", objMLTAB_AGENDA.ID_FUN); objComando.Parameters.AddWithValue("@ID_HOR", objMLTAB_AGENDA.ID_HOR); objComando.Parameters.AddWithValue("@Age_Data", objMLTAB_AGENDA.Age_Data); objComando.Parameters.AddWithValue("@Age_Realizada", objMLTAB_AGENDA.Age_Realizada); objComando.Parameters.AddWithValue("@Age_ValorSessao", objMLTAB_AGENDA.Age_ValorSessao); objConexao.Open(); //Utilizo o ExecuteScalar para obter o ID Gravado. retorno = Convert.ToInt32(objComando.ExecuteScalar()); objConexao.Close(); } } return(retorno); }
private void Salvar(int ID_TAT, int ID_FUN, DateTime Age_Data, int ID_HOR, Double Age_ValorSessao) { var objMLTAB_AGENDA = new MLTAB_AGENDA(); var objBLTAB_AGENDA = new BLTAB_AGENDA(); objMLTAB_AGENDA.ID_TAT = ID_TAT; objMLTAB_AGENDA.ID_FUN = ID_FUN; objMLTAB_AGENDA.Age_Data = Age_Data; objMLTAB_AGENDA.ID_HOR = ID_HOR; objMLTAB_AGENDA.Age_Realizada = "A"; objMLTAB_AGENDA.Age_ValorSessao = Age_ValorSessao; ID_AGE = objBLTAB_AGENDA.Gravar(objMLTAB_AGENDA); }
private void Excluir() { var objML = new MLTAB_AGENDA(); var objBL = new BLTAB_AGENDA(); objML.Hora = lstData.SelectedItems[0].Text; objML.Cli_Nome = lstData.SelectedItems[0].SubItems[1].Text; objML.Age_ValorSessao = Convert.ToDouble(lstData.SelectedItems[0].SubItems[2].Text); objML.Age_Data = Convert.ToDateTime(Data); if (objBL.Excluir(objML)) { MessageBox.Show("Agendamento excluido com sucesso"); } }
private void Alterar() { var objMLTAB_AGENDA = new MLTAB_AGENDA(); try { if (lstData.SelectedItems.Count > 0) { objMLTAB_AGENDA.Cli_Nome = lstData.SelectedItems[0].Text; objMLTAB_AGENDA.ID_AGE = Convert.ToInt16(lstData.SelectedItems[0].SubItems[1].Text); objMLTAB_AGENDA.Hora = lstData.SelectedItems[0].SubItems[2].Text; objMLTAB_AGENDA.Age_Data = Convert.ToDateTime(lstData.SelectedItems[0].SubItems[3].Text); objMLTAB_AGENDA.Age_ValorSessao = Convert.ToDouble(lstData.SelectedItems[0].SubItems[4].Text); objMLTAB_AGENDA.Tpt_Tipo = lstData.SelectedItems[0].SubItems[5].Text; objMLTAB_AGENDA.Tat_Descricao = lstData.SelectedItems[0].SubItems[6].Text; objMLTAB_AGENDA.Fpg_Vezes = Convert.ToInt16(lstData.SelectedItems[0].SubItems[7].Text); objMLTAB_AGENDA.Fpg_Forma = lstData.SelectedItems[0].SubItems[8].Text; frmNovoAgendamento objfrmNovoAgendamento = new frmNovoAgendamento(); objfrmNovoAgendamento.NomeCli = objMLTAB_AGENDA.Cli_Nome; objfrmNovoAgendamento.HoraAg = objMLTAB_AGENDA.Hora; objfrmNovoAgendamento.Age_Data = objMLTAB_AGENDA.Age_Data; objfrmNovoAgendamento.Age_ValorSessao = objMLTAB_AGENDA.Age_ValorSessao; objfrmNovoAgendamento.Tpt_Tipo = objMLTAB_AGENDA.Tpt_Tipo; objfrmNovoAgendamento.Tat_Descricao = objMLTAB_AGENDA.Tat_Descricao; objfrmNovoAgendamento.Fpg_Vezes = objMLTAB_AGENDA.Fpg_Vezes; objfrmNovoAgendamento.editaAgendamento = 1; objfrmNovoAgendamento.Fpg_Forma = objMLTAB_AGENDA.Fpg_Forma; objfrmNovoAgendamento.ID_AGEe = objMLTAB_AGENDA.ID_AGE; objfrmNovoAgendamento.ShowDialog(); if (rdbNome.Checked) { CarregarSessoesPorNome(Nome); } else { CarregarSessoes(Data); } } } catch (Exception ex) { MessageBox.Show("Ocorreu um erro ao atualizar o agendamento: " + ex.Message); } }
public List <MLTAB_AGENDA> DiaAtualCliente(string Cli_Nome) { List <MLTAB_AGENDA> lstMLTAB_AGENDA = new List <MLTAB_AGENDA>(); using (SqlConnection objConexao = new SqlConnection(strConnection)) { using (SqlCommand objComando = new SqlCommand(strSelectDiaNomeP, objConexao)) { if (String.IsNullOrEmpty(Cli_Nome)) { objComando.Parameters.AddWithValue("@Cli_Nome", DBNull.Value); } else { objComando.Parameters.AddWithValue("@Cli_Nome", Cli_Nome); } objConexao.Open(); SqlDataReader objDataReader = objComando.ExecuteReader(); if (objDataReader.HasRows) { while (objDataReader.Read()) { MLTAB_AGENDA objMLAGENDA = new MLTAB_AGENDA(); objMLAGENDA.Cli_Nome = objDataReader["Cli_Nome"].ToString(); objMLAGENDA.ID_AGE = Convert.ToInt16(objDataReader["ID_AGE"].ToString()); objMLAGENDA.Hora = (objDataReader["Hora"].ToString()); objMLAGENDA.Age_Data = Convert.ToDateTime(objDataReader["Age_Data"]); objMLAGENDA.Age_ValorSessao = Convert.ToInt16(objDataReader["Age_ValorSessao"]); objMLAGENDA.Tpt_Tipo = objDataReader["Tpt_Tipo"].ToString(); objMLAGENDA.Tat_Descricao = objDataReader["Tat_Descricao"].ToString(); objMLAGENDA.Fpg_Forma = objDataReader["Fpg_Forma"].ToString(); objMLAGENDA.Fpg_Vezes = Convert.ToInt16(objDataReader["Fpg_Vezes"].ToString()); lstMLTAB_AGENDA.Add(objMLAGENDA); } objDataReader.Close(); } objConexao.Close(); } } return(lstMLTAB_AGENDA); }
private void SessaoRealizada(DateTime Data) { MLTAB_AGENDA objML = new MLTAB_AGENDA(); var objBL = new BLTAB_AGENDA(); objML.Age_Data = Data; objML.Hora = lstData.SelectedItems[0].Text; objML.Cli_Nome = lstData.SelectedItems[0].SubItems[1].Text; int registro = objBL.AtualizarSessao(objML); if (registro > 0) { MessageBox.Show("Sessão Atualizada"); } }
public int AtualizarSessao(MLTAB_AGENDA objml) { var objDLTAB_AGENDA = new DLTAB_AGENDA(); try { return(objDLTAB_AGENDA.Atualizar(objDLTAB_AGENDA.ConsultarIDAGE(objml))); } catch (Exception) { throw; } finally { objDLTAB_AGENDA = null; } }
public int Gravar(MLTAB_AGENDA objMLTAB_AGENDA) { var objDLTAB_AGENDA = new DLTAB_AGENDA(); try { return(objDLTAB_AGENDA.Gravar(objMLTAB_AGENDA)); } catch (Exception ex) { throw ex; } finally { objDLTAB_AGENDA = null; } }
private void Alterar() { var objBl = new BLTAB_AGENDA(); var objML = new MLTAB_AGENDA(); int ID_AGE; objML.Hora = lstData.SelectedItems[0].Text; objML.Cli_Nome = lstData.SelectedItems[0].SubItems[1].Text; objML.Age_ValorSessao = Convert.ToDouble(lstData.SelectedItems[0].SubItems[2].Text); objML.Age_Data = Data; ID_AGE = objBl.ConsultaIDAGE(objML); frmNovoAgendamento objNovo = new frmNovoAgendamento(); objNovo.ID_AGEe = ID_AGE; objNovo.ShowDialog(); }
public int ConsultaIDAGE(MLTAB_AGENDA objml) { var objAGE = new DLTAB_AGENDA(); int ID_AGE; try { return(ID_AGE = objAGE.ConsultarIDAGE(objml)); } catch (Exception) { throw; } finally { objAGE = null; } }
public bool Excluir(MLTAB_AGENDA objML) { var objDLFORMA = new DLTAB_FORMPAG(); var objAGE = new DLTAB_AGENDA(); try { int ID_AGE = objAGE.ConsultarIDAGE(objML); objDLFORMA.Excluir(ID_AGE); objAGE.ExcluirPorIDAGE(ID_AGE); return(true); } catch (Exception) { return(false); throw; } finally { objDLFORMA = null; objAGE = null; } }