private void btnSimular_Click(object sender, EventArgs e)
        {
            try
            {
                if (Convert.ToInt32(cbxEspecialidade.SelectedValue) < 1)
                {
                    throw new Exception("Selecione uma especialidade!");
                }
                int    espec   = Convert.ToInt32(cbxEspecialidade.SelectedValue);
                double aumento = Convert.ToDouble(txtPorcentagem.Text) / 100 + 1;

                ServicoDAO servico = new ServicoDAO();
                DataTable  table   = servico.Simulacao(espec, aumento);
                dataGridView1.DataSource = table;
            }
            catch (FormatException)
            {
                Metodos.Mensagem("Campo numérico inválido!", TipoMsgEnum.Erro);
            }
            catch (SqlException)
            {
                Metodos.Mensagem("Ocorreu um erro no banco de dados.", TipoMsgEnum.Erro);
            }
            catch (Exception erro)
            {
                Metodos.Mensagem(erro.Message, TipoMsgEnum.Erro);
            }
        }
예제 #2
0
        public ActionResult IndexAgendaFuncionario()
        {
            AgendaDAO daoAgenda = new AgendaDAO();
            var       horarios  = daoAgenda.ListarHorarioAtendimento();

            ViewBag.Horarios = horarios;

            var agendamentos = daoAgenda.ListarAgendamentos();

            ViewBag.Cont   = agendamentos.Count();
            ViewBag.Agenda = agendamentos;

            ServicoDAO daoServico = new ServicoDAO();
            var        servico    = daoServico.ListaServicos();

            ViewBag.Servico = servico;

            FuncionarioDAO daoFuncionarios = new FuncionarioDAO();
            var            funcionarios    = daoFuncionarios.ListarFuncionarios();
            int            cont            = funcionarios.Count();

            ViewBag.ContFun = cont;

            return(View(horarios));
        }
예제 #3
0
        public CustomActionResult <MessageItem> add_servico(Servico servico)
        {
            MessageItem m = new MessageItem();

            ServicoDAO servDAO = new ServicoDAO();
            int        ID      = servDAO.BuscaSeqServico(null);

            servico.id = ID;
            if (!servDAO.Inclui(servico))
            {
                m.Code = "500";
                return(GetResultBadRequest(m));
            }
            else
            {
                foreach (var item in servico.lstAgendaServico)
                {
                    item.servico    = new Servico();
                    item.servico.id = ID;
                    new AgendaServicoDAO().Inclui(item);
                }
                m.Code = ID + "";
                return(GetResultOK(m));
            }
        }
예제 #4
0
        public void cadastrarServ(object sender, EventArgs e)
        {
            string    descUser = descuserForm.Value;
            Categoria cat      = new Categoria();

            cat.Id = serv.IdCat;
            Servico novoServ = new Servico(0, (int)Session["sId"], getEmpresaEscolhida, emp.IdComercial, DateTime.Now, cat, serv.Id, descUser, 0, serv.ValorAprox, "A definir", new DateTime(), 0, 0, 0, 0, 0, 0, "-", "-");

            new ServicoDAO().insertServico(novoServ);

            int idNovoServ = new ServicoDAO().selectUltimoId();

            ChatContrato chatNovo = new ChatContrato(0, idNovoServ, (int)Session["sId"], emp.IdComercial);

            new ChatContratoDAO().insertChatContrato(chatNovo);

            int idNovoCont = new ChatContratoDAO().selectUltimoId();


            ChatMensagem chatMens = new ChatMensagem(0, idNovoCont, emp.IdComercial, new DateTime(), "Obrigado pela solicitação, qualquer dúvida não hesite em perguntar!", 0);

            new ChatMensagemDAO().insertChatM(chatMens);



            Response.Redirect("solicitacoesCliente.aspx");
        }
예제 #5
0
        public void BuscaContrato(int idContrato)
        {
            ContratoDAO cDAO = new ContratoDAO();

            if (idContrato == 0)
            {
                contr = cDAO.GetByCliente(cli.Idcliente);
            }
            else
            {
                contr = cDAO.GetById(idContrato);
            }

            if (contr != null)
            {
                txtIdContrato.Text   = contr.Idcontrato.ToString();
                txtNomeContrato.Text = contr.Descricao;

                ServicoDAO sDAO = new ServicoDAO();
                cboServico.SelectedValue = contr.Idservico;
                sv = sDAO.GetById(Convert.ToInt32(cboServico.SelectedValue));
                AtualizaValor();
            }
            else
            {
                txtIdContrato.Text       = null;
                txtNomeContrato.Text     = null;
                cboServico.SelectedValue = config.CobrancaPadrao;
            }
        }
예제 #6
0
        private void Encerrar(object sender, RoutedEventArgs e)
        {
            if (MessageBox.Show("Deseja encerrar o Serviço?", "Cadastro de Serviço",
                                MessageBoxButton.YesNo, MessageBoxImage.Question) ==
                MessageBoxResult.Yes)
            {
                s.DataFim      = DateTime.Now;
                s.HorasTotal   = Math.Round((DateTime.Now - s.DataInicio).TotalHours, 3);
                s.ValorTotal   = s.HorasTotal * 10;
                s.Vaga.Ocupada = false;

                if (ServicoDAO.AlterarServico(s))
                {
                    MessageBox.Show("Serviço encerrado com sucesso!\n" +
                                    "Total de Horas: " + s.HorasTotal + ".\n" +
                                    "Valor Total: " + s.ValorTotal + ".",
                                    "Cadastra Serviço", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                else
                {
                    MessageBox.Show("Serviço não encerrado!", "Cadastra Serviço", MessageBoxButton.OK, MessageBoxImage.Error);
                }

                DesabilitarBotoes();
            }
            else
            {
                DesabilitarBotoes();
            }
        }
예제 #7
0
        private void Buscar(object sender, RoutedEventArgs e)
        {
            s = new Servico();
            Veiculo v = new Veiculo();

            v = VeiculoDAO.VerificarVeiculoPorPlaca((Veiculo)comboBoxPlaca.SelectedItem);


            if (v != null)
            {
                s = ServicoDAO.VerificarServicoAbertoPorPlacaVeiculo(v);

                if (s != null)
                {
                    lbCliente.Content = s.Cliente.Nome;
                    lbMarca.Content   = s.Veiculo.Modelo.Marca.Nome;
                    lbModelo.Content  = s.Veiculo.Modelo.Nome;
                    lbVaga.Content    = s.Vaga.Id + " - Referência: " + s.Vaga.Referencia;
                    lbDuracao.Content = Math.Round((DateTime.Now - s.DataInicio).TotalHours, 3);
                    HabilitarBotoes();
                }
                else
                {
                    MessageBox.Show("Placa não encontrada, para iniciar - pressione Iniciar Serviço!", "Cadastro de Serviço",
                                    MessageBoxButton.OK, MessageBoxImage.Information);
                }
            }
            else
            {
                MessageBox.Show("Favor preencher o campo da busca", "Cadastro de Serviço",
                                MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
예제 #8
0
        private void AtualizaValor()//ok
        {
            ServicoDAO sDAO = new ServicoDAO();

            sv = sDAO.GetById(Convert.ToInt32(cboServico.SelectedValue));
            if (sv != null)
            {
                obj.Idservico = sv.Idservico;
                if (obj.TipoVeiculo == 'C')
                {
                    txtValor.Text = sv.ValorCarro.ToString();
                }

                if (obj.TipoVeiculo == 'M')
                {
                    txtValor.Text = sv.ValorMoto.ToString();
                }

                if (obj.TipoVeiculo == 'O')
                {
                    txtValor.Text = sv.ValorOutros.ToString();
                }
            }
            MontaCupom();
        }
        public ActionResult Index()
        {
            var servicoDAO = new ServicoDAO();

            ModelState.Clear();
            return(View(servicoDAO.SelecionarServico()));
        }
예제 #10
0
        public Servico GetServico(int id)
        {
            oServico = new Servico();

            try
            {
                oServicoDAO = new ServicoDAO();
                dt          = oServicoDAO.GetServico(id);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                oServicoDAO = null;
            }

            if (dt.Rows.Count > 0)
            {
                oServico.ID        = int.Parse(dt.Rows[0]["id"].ToString());
                oServico.Descricao = dt.Rows[0]["descricao"].ToString();
                oServico.Valor     = decimal.Parse(dt.Rows[0]["valor"].ToString());
            }

            return(oServico);
        }
        public ActionResult Edit(int id, Servico servico)
        {
            if (string.IsNullOrWhiteSpace(servico.dsServico))
            {
                ModelState.AddModelError("", "Nome do serviço Nao pode ser em braco");
            }
            if (servico.vlServico == null)
            {
                ModelState.AddModelError("", "Valor de serviço do Produto não pode ser em braco");
            }
            try
            {
                if (ModelState.IsValid)
                {
                    var servicoDAO = new ServicoDAO();

                    servicoDAO.UpdateServico(servico);
                    this.AddFlashMessage("Alterado salvo com sucesso!");
                    return(RedirectToAction("Index"));
                }

                return(View());
            }
            catch
            {
                return(View());
            }
        }
예제 #12
0
        private void btnCadastrar_Click(object sender, RoutedEventArgs e)
        {
            if (CamposVazios())
            {
                return;
            }

            s = new Servico
            {
                Nome        = txtNome.Text,
                Descricao   = txtDescricao.Text,
                Duracao     = Convert.ToInt32(((string)cboDuracao.SelectedItem).Substring(0, 2)),
                TipoServico = (TipoServico)cboTipo.SelectedItem,
                Preco       = Convert.ToDouble(txtPreco.Text.Replace(',', '.'))
            };

            if (ServicoDAO.Cadastrar(s))
            {
                MessageBox.Show($"Serviço \"{s.Nome}\" Cadastrato Com Sucesso.", "Pet Shop", MessageBoxButton.OK, MessageBoxImage.Information);
                LimparFormulario();
                Buscar();//Refresh
            }
            else
            {
                MessageBox.Show($"Algo deu errado na hora de cadastrar o Serviço.", "Pet Shop", MessageBoxButton.OK, MessageBoxImage.Information);
            }
        }
예제 #13
0
        } //OK

        private void CarregaServico()
        {
            ServicoDAO sDAO = new ServicoDAO();

            cboServico.DataSource    = sDAO.BuscaPorCampo("ativo", "1");
            cboServico.ValueMember   = "ID";
            cboServico.DisplayMember = "Descrição";
        } //OK
예제 #14
0
        public void PopularGridServicos()
        {
            ServicoDAO osDao  = new ServicoDAO();
            DataTable  dTable = osDao.ListarTodos();

            gdvServico.DataSource = dTable;
            gdvServico.DataBind();
        }
예제 #15
0
        public void PopularGridCarrinho()
        {
            ServicoDAO osDao  = new ServicoDAO();
            DataTable  dTable = osDao.ListarCarrinho(os);

            gdvCarrinho.DataSource = dTable;
            gdvCarrinho.DataBind();
        }
예제 #16
0
        public void Editar(Servico servico)
        {
            ServicoDAO servicoDAO = new ServicoDAO();

            if (servico.Codservico != 0)
            {
                servicoDAO.Update(servico);
            }
        }
예제 #17
0
        public FormServico()
        {
            InitializeComponent();
            Carrinho(false);

            ServicoDAO s = new ServicoDAO();

            labalCodigo.Text = (s.BuscaCodigo() + 1).ToString();
        }
예제 #18
0
        public void Gravar(Servico servico)
        {
            ServicoDAO servicoDAO = new ServicoDAO();

            if ((servico.Valor != 0) && (servico.Tipo != ""))
            {
                servicoDAO.Insert(servico);
            }
        }
예제 #19
0
        // GET: Servico
        public ActionResult IndexServico()
        {
            ServicoDAO daoServico = new ServicoDAO();
            var        servicos   = daoServico.ListaServicos();

            ViewBag.Servico = servicos;

            return(View());
        }
예제 #20
0
        private ServPeca getDTOPecaServ()
        {
            ServicoDAO s  = new ServicoDAO();
            ServPeca   sv = new ServPeca();

            sv.CodPeca1   = int.Parse(dgvCarrinho.Rows[r].Cells[0].Value.ToString());
            sv.CodServ1   = s.BuscaCodigo();
            sv.Quantidade = int.Parse(dgvCarrinho.Rows[r].Cells[5].Value.ToString());
            return(sv);
        }
예제 #21
0
 public ReservaController(ReservaDAO reservaDAO,
                          QuartoDAO quartoDAO, PetDAO petDAO, ServicoDAO servicoDAO, ClienteDAO clienteDAO, ItemVendaDAO itemVendaDAO)
 {
     _reservaDAO   = reservaDAO;
     _quartoDAO    = quartoDAO;
     _petDAO       = petDAO;
     _servicoDAO   = servicoDAO;
     _clienteDAO   = clienteDAO;
     _itemVendaDAO = itemVendaDAO;
 }
예제 #22
0
        public frCadServico()
        {
            InitializeComponent();
            objetoDAO = new ServicoDAO();
            EspecialidadeDAO temp = new EspecialidadeDAO();

            cbxEspecialidade.DataSource    = temp.Listar();
            cbxEspecialidade.DisplayMember = "Nome";
            cbxEspecialidade.ValueMember   = "Id";
            cbxEspecialidade.SelectedIndex = -1;
        }
예제 #23
0
        public void CarregaServico(int id)
        {
            ServicoDAO sDAO = new ServicoDAO();
            Servicos   sObj = sDAO.GetById(id);

            txtIdServico.Text   = sObj.Idservico.ToString();
            txtNomeServico.Text = sObj.Descricao;
            txtVCarro.Text      = sObj.ValorCarro.ToString();
            txtVMoto.Text       = sObj.ValorMoto.ToString();
            txtVOutros.Text     = sObj.ValorOutros.ToString();
        }
예제 #24
0
        private void btExecutar_Click(object sender, EventArgs e)
        {
            if (txtCarro.Text != "")
            {
                if (MessageBox.Show("Executar o Serviço? ", "Mensagem do sistema ", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    ServicoDAO servicoDAO = new ServicoDAO();
                    Servico    servico    = getDTOServ();
                    servicoDAO.Salvar(servico);

                    StageDAO stageDAO = new StageDAO();
                    Stage    stage    = getDTO();
                    stageDAO.Salvar(stage);

                    for (int i = 0; i < dgvCarrinho.Rows.Count; i++)
                    {
                        ServPecaDAO servPecaDAO = new ServPecaDAO();
                        ServPeca    servPeca    = getDTOPecaServ();
                        servPecaDAO.Salvar(servPeca);
                        r++;
                    }

                    CarroDAO car = new CarroDAO();
                    Carro    c   = getDTOCar();
                    car.AtualizaSpecs(c);


                    NotaFiscal n = new NotaFiscal();
                    ServicoDAO s = new ServicoDAO();
                    n.mostra(s.BuscaCodigo().ToString());
                    n.ShowDialog(this);

                    //para chamar o splash
                    Thread t = new Thread((new ThreadStart(Loading)));
                    ////inicializar a thread
                    t.Start();
                    Thread.Sleep(1200);
                    t.Abort();


                    MessageBox.Show("Serviço encaminhado com sucesso!");
                }

                else
                {
                    MessageBox.Show("Serviço cancelado");
                }
            }
            else
            {
                MessageBox.Show("Preencha os campos para iniciar o serviço");
            }
        }
예제 #25
0
        public ActionResult AtualizarServico(string tipo, double valor, int Id)
        {
            ServicoDAO daoServico = new ServicoDAO();
            Servico    servicos   = daoServico.BuscarServicoId(Id);

            servicos.Tipo  = tipo;
            servicos.Valor = valor;

            daoServico.AtualizarServico(servicos);

            return(Json(true));
        }
예제 #26
0
        private void fillServico()
        {
            ServicoDAO     servicoDAO = new ServicoDAO();
            List <Servico> servicos;

            servicos = servicoDAO.Carregar();
            dgvServP.Rows.Clear();
            foreach (Servico s in servicos)
            {
                dgvServP.Rows.Add(s.Codigo, s.PlacaCarro1, s.CpfCliente1, s.CpfFuncionario1, s.ValorTotal);
            }
        }
예제 #27
0
        public IUServico(int id, Form lista, IUContrato contr, IUConfigMovimento config)
        {
            InitializeComponent();
            oDAO        = new ServicoDAO();
            obj         = new Servicos();
            this.lista  = lista;
            this.contr  = contr;
            this.config = config;

            cboTipoCobranca.SelectedIndex = 0;

            if (id != 0)
            {
                obj = oDAO.GetById(id);

                txtIdServico.Text   = obj.Idservico.ToString();
                txtDescricao.Text   = obj.Descricao;
                txtQuantidade.Value = obj.Quantidade;
                txtVCarro.Text      = obj.ValorCarro.ToString();
                txtVMoto.Text       = obj.ValorMoto.ToString();
                txtVOutros.Text     = obj.ValorOutros.ToString();

                chkAtivo.Checked = (obj.Ativo == 1) ? true : false;

                switch (obj.TipoCobranca)
                {
                case 'H':
                {
                    cboTipoCobranca.SelectedIndex = 0;
                    break;
                }

                case 'I':
                {
                    cboTipoCobranca.SelectedIndex = 1;
                    break;
                }

                case 'D':
                {
                    cboTipoCobranca.SelectedIndex = 2;
                    break;
                }

                case 'M':
                {
                    cboTipoCobranca.SelectedIndex = 3;
                    break;
                }
                }
                btnLimpar.Enabled = false;
            }
        }
예제 #28
0
        private void CarregaServico()
        {
            ServicoDAO sDAO = new ServicoDAO();

            cboServico.DataSource    = sDAO.BuscaPorCampo("ativo", "1");
            cboServico.ValueMember   = "ID";
            cboServico.DisplayMember = "Descrição";
            MontaCupom();

            cboServico.SelectedValue = config.CobrancaPadrao;
            sv = sDAO.GetById(Convert.ToInt32(cboServico.SelectedValue));
            AtualizaValor();
        }
        private IQueryable <dynamic> Find(int?IdServico, string dsServico)
        {
            var servicoDAO = new ServicoDAO();
            var list       = servicoDAO.SelectServico(IdServico, dsServico);
            var select     = list.Select(u => new
            {
                IdServico = u.IdServico,
                dsServico = u.dsServico,
                vlServico = u.vlServico
            }).OrderBy(u => u.dsServico).ToList();

            return(select.AsQueryable());
        }
        private void BuscarServico(int id)
        {
            Servico servico = new ServicoDAO().BuscarPorId(id);

            if (servico != null)
            {
                LoadService(servico);
            }
            else
            {
                //
            }
        }
예제 #31
0
	void Awake ()
	{
		initialized = false;
		System.DateTime time = System.DateTime.Now;
		instance = this;

		server = ServerHandler.server;

		if (!StaticData.OnlineVistoria) {
			vistoriaDAO = ServerHandler.vistoriaDAO;
			servicoDAO = ServerHandler.servicoDAO;
			ambienteDAO = ServerHandler.ambienteDAO;
			indicadorDAO = ServerHandler.indicadorDAO;
			imagemIndicadorDAO = ServerHandler.imagemIndicadorDAO;
			LoadOfflineData ();
		} else {
			LoadOnlineData ();
		}
	
	}