예제 #1
0
 private void frmTrocaSenha_Load(object sender, EventArgs e)
 {
     //Busca o usuario logado e preenche o textbox.
     txtUsuario.Text = LoginUsuario.getUsuarioLogado().Replace("Usuário: ", "");
     usuario         = txtUsuario.Text;
     txtSenha.Focus();
 }
예제 #2
0
 //Evento salvar o recebimento.
 private void btnSalvar_Click(object sender, EventArgs e)
 {
     if (txtValor.Text == "")
     {
         return;
     }
     if (Double.Parse(txtValor.Text) < Double.Parse(lblValor.Text.Replace("R$", "")))
     {
         MessageBox.Show("Valor recebido menor que o valor da reserva!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         Conexao conexao = new Conexao();
         conexao.conectar();
         SqlCommand cmd = new SqlCommand("sp_Upd_Financeiro", conexao.conexao);
         cmd.CommandType = CommandType.StoredProcedure;
         cmd.Parameters.AddWithValue("@STC_FINANCEIRO", "PAGO");
         cmd.Parameters.AddWithValue("@ID_HORARIORESERVA", LoginUsuario.getReserva());
         cmd.Parameters.AddWithValue("@FP_FINANCEIRO", cmbFormaPgto.Text);
         cmd.Parameters.AddWithValue("@DT_PAGAMENTO", DateTime.Now.ToShortDateString());
         cmd.ExecuteReader(CommandBehavior.SingleRow);
         conexao.desconectar();
         MessageBox.Show("Troco: " + (Double.Parse(txtValor.Text) - Double.Parse(lblValor.Text.Replace("R$", ""))).ToString("C"), "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
         MessageBox.Show("Concluído com Sucesso!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
         this.Close();
     }
 }
예제 #3
0
        //Evento efetur login
        private void btnLogin_Click(object sender, EventArgs e)
        {
            Conexao conexao = new Conexao();

            conexao.conectar();
            SqlCommand cmd = new SqlCommand("sp_Sel_UsuarioLogin", conexao.conexao);

            cmd.Parameters.AddWithValue("@Nm_Usuario", txtUsuario.Text);
            cmd.Parameters.AddWithValue("@Sh_Usuario", txtSenha.Text);
            cmd.Parameters.AddWithValue("@St_Usuario", "True");
            cmd.CommandType = CommandType.StoredProcedure;
            SqlDataReader dr = cmd.ExecuteReader();

            if (dr.Read())
            {
                LoginUsuario.login(dr["NM_USUARIO"].ToString(), dr["SH_USUARIO"].ToString(), Convert.ToInt32(dr["ID_USUARIO"]));
                txtUsuario.Enabled           = false;
                txtSenha.Enabled             = false;
                btnLogin.Enabled             = false;
                Settings.Default.UltimoLogin = txtUsuario.Text;
                Settings.Default.Save();
                frmMenu frmMenu = new frmMenu();
                this.Hide();
                frmMenu.Show();
            }
            else
            {
                MessageBox.Show("Usuário/Senha Inválidos! Tente Novamente ...", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            dr.Close();
            conexao.desconectar();
        }
 private void btnEstorno_Click(object sender, EventArgs e)
 {
     //Formata Visual
     SidePanel.Height = btnEstorno.Height;
     SidePanel.Top    = btnEstorno.Top;
     LoginUsuario.reserva(Convert.ToInt32(dgvDados.CurrentRow.Cells[4].Value));
     if (dgvDados.CurrentRow.Cells[3].Value.ToString() == "EM ABERTO")
     {
         MessageBox.Show("Financeiro em Aberto!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
         return;
     }
     if (dgvDados.RowCount > 0)
     {
         //Mensagem para o usuário
         DialogResult iResposta;
         iResposta = MessageBox.Show("Deseja realmente estorno?", "Confirmar!", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
         if (iResposta.ToString() == "Yes")
         {
             Conexao conexao = new Conexao();
             conexao.conectar();
             SqlCommand cmd = new SqlCommand("sp_Upd_Financeiro", conexao.conexao);
             cmd.CommandType = CommandType.StoredProcedure;
             cmd.Parameters.AddWithValue("@STC_FINANCEIRO", "EM ABERTO");
             cmd.Parameters.AddWithValue("@ID_HORARIORESERVA", LoginUsuario.getReserva());
             cmd.Parameters.AddWithValue("@FP_FINANCEIRO", "");
             cmd.Parameters.AddWithValue("@DT_PAGAMENTO", DateTime.Now.ToShortDateString());
             cmd.ExecuteReader(CommandBehavior.SingleRow);
             conexao.desconectar();
             MessageBox.Show("Concluído com Sucesso!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
             atualizaGridView();
         }
     }
 }
예제 #5
0
 public frmMenu()
 {
     InitializeComponent();
     SidePanel.Height = btnHome.Height;
     SidePanel.Top    = btnHome.Top;
     permitirAcesso(LoginUsuario.getUsuarioId());
     lblUsuarioLogado.Text = LoginUsuario.getUsuarioLogado();
 }
예제 #6
0
        //Metodo preencher tela com dados.
        public void preencheCadastro()
        {
            Conexao conexao = new Conexao();

            conexao.conectar();
            SqlCommand cmd = new SqlCommand("sp_Sel_FinanceiroEsp", conexao.conexao);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.AddWithValue("@ID_HORARIORESERVA", LoginUsuario.getReserva());
            cmd.Parameters.AddWithValue("@ST_FINANCEIRO", "True");
            SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.SingleRow);

            if (dr.Read())
            {
                lblCliente.Text = dr[("Nome Cliente")].ToString();
                lblValor.Text   = "R$ " + dr[("Valor").ToString()];
            }
            conexao.desconectar();
        }
        private void btnReceber_Click(object sender, EventArgs e)
        {
            //Formata Visual
            SidePanel.Height = btnReceber.Height;
            SidePanel.Top    = btnReceber.Top;
            if (dgvDados.CurrentRow.Cells[3].Value.ToString() == "PAGO")
            {
                MessageBox.Show("Financeiro já finalizado!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            if (dgvDados.RowCount > 0)
            {
                LoginUsuario.reserva(Convert.ToInt32(dgvDados.CurrentRow.Cells[4].Value));
                funcao = "BAIXAR";
                frmRecebimento frmRecebimento = new frmRecebimento();
                frmRecebimento.ShowDialog();
            }
            atualizaGridView();
        }
예제 #8
0
 private void btnSalvar_Click(object sender, EventArgs e)
 {
     //Verifica se as senhas novas são iguais.
     if (txtSenha1.Text != txtSenha2.Text)
     {
         MessageBox.Show("Senhas NOVAS estão Diferentes! Tente Novamente ...", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
     else
     {
         //Verifica se a senha atual é igual a informada, se 'SIM', Altera a senha.
         Conexao conexao = new Conexao();
         conexao.conectar();
         SqlCommand cmd = new SqlCommand("sp_Sel_UsuarioSenha", conexao.conexao);
         cmd.Parameters.AddWithValue("@Nm_Usuario", txtUsuario.Text);
         cmd.Parameters.AddWithValue("@Sh_Usuario", txtSenha.Text);
         cmd.CommandType = CommandType.StoredProcedure;
         SqlDataReader dr = cmd.ExecuteReader();
         if (dr.Read())
         {
             //Altera a senha.
             Conexao conexaoUpdate = new Conexao();
             conexaoUpdate.conectar();
             SqlCommand cmdUpdate = new SqlCommand("sp_Upd_UsuarioSenha", conexaoUpdate.conexao);
             cmdUpdate.Parameters.AddWithValue("@Id_Usuario", LoginUsuario.getUsuarioId());
             cmdUpdate.Parameters.AddWithValue("@Sh_Usuario", txtSenha1.Text.ToUpper());
             cmdUpdate.CommandType = CommandType.StoredProcedure;
             cmdUpdate.ExecuteReader(CommandBehavior.SingleRow);
             conexaoUpdate.desconectar();
             MessageBox.Show("Senha Alterada com SUCESSO!", "Sucesso", MessageBoxButtons.OK, MessageBoxIcon.Information);
             Close();
         }
         else
         {
             conexao.desconectar();
             MessageBox.Show("Senhas ANTIGA é Diferente! Tente Novamente ...", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Warning);
             txtSenha.Focus();
         }
     }
 }
예제 #9
0
        private void btnSalvar_Click(object sender, EventArgs e)
        {
            horario = string.Empty;
            criatextoHorario();
            //Formata Visual
            SidePanel.Height = btnSalvar.Height;
            SidePanel.Top    = btnSalvar.Top;
            //Verifica se todos os campos estão preenchidos
            if (cmbCampo.Text == "" || dtpReserva.Text == "" || dgvClientes.Rows.Count == 0 || vezes == 0)
            {
                //Mensagem para o usuário
                MessageBox.Show("Informe todos os campos!", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                Conexao conexao = new Conexao();
                conexao.conectar();

                if (funcao == "ADICIONAR")
                {
                    SqlCommand cmd = new SqlCommand("sp_Ins_HorariosReserva", conexao.conexao);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@ID_Cliente", dgvClientes.CurrentRow.Cells[0].Value);
                    cmd.Parameters.AddWithValue("@ID_Campo", cmbCampo.SelectedValue);
                    cmd.Parameters.AddWithValue("@HR_Reservada", horario.Trim());
                    cmd.Parameters.AddWithValue("@ST_Horario", "True");
                    cmd.Parameters.AddWithValue("@DT_Reserva", dtpReserva.Value);
                    cmd.Parameters.AddWithValue("@TP_Reservado", 1);
                    cmd.Parameters.AddWithValue("@Vl_Reserva", Double.Parse(txtValorCampo.Text.Replace("R$", "")) * vezes);
                    SqlDataReader dr = cmd.ExecuteReader(CommandBehavior.SingleRow);
                    if (dr.Read())
                    {
                        idReserva = int.Parse(dr[("Retorno")].ToString());
                        criarFinanceiro(idReserva, LoginUsuario.getUsuarioId());
                    }
                    else
                    {
                        idReserva = 0;
                    }
                }
                else
                {
                    SqlCommand cmd = new SqlCommand("sp_Ins_HorariosReserva", conexao.conexao);
                    cmd.Parameters.AddWithValue("@ID_Cliente", dgvClientes.CurrentRow.Cells[0].Value);
                    cmd.Parameters.AddWithValue("@ID_Campo", cmbCampo.SelectedValue);
                    cmd.Parameters.AddWithValue("@HR_Reservada", " ");//Verificar CheckBox
                    cmd.Parameters.AddWithValue("@ST_Horario", "True");
                    cmd.Parameters.AddWithValue("@DT_Reserva", dtpReserva.Value);
                    cmd.Parameters.AddWithValue("@TP_Reservado", 1);
                    cmd.Parameters.AddWithValue("@Vl_Reserva", Double.Parse(txtValorCampo.Text.Replace("R$", "")));
                    cmd.ExecuteReader(CommandBehavior.SingleRow);
                }
                conexao.desconectar();
                DialogResult iResposta;
                iResposta = MessageBox.Show("Deseja receber a reserva?", "Confirmar!", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                if (iResposta.ToString() == "Yes")
                {
                    LoginUsuario.reserva(Convert.ToInt32(idReserva));
                    frmRecebimento frmRecebimento = new frmRecebimento();
                    frmRecebimento.ShowDialog();
                }
                iResposta = MessageBox.Show("Deseja imprimir o comprovante?", "Confirmar!", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);
                if (iResposta.ToString() == "Yes")
                {
                    Imprimir();
                }
                controleBotao(true);
                atualizaGridView();
                idReserva = 0;
            }
        }