private void btnSalvar_Click(object sender, EventArgs e) { try { string desc = txtDesc.Text; desc = desc.Trim(); int qtd = desc.Count(); if (qtd > 200) { throw new Exception("O campo 'Descrição' não pode passar de 200 caracteres"); } ClienteDTO cliente = cboCliente.SelectedItem as ClienteDTO; OrcamentoDTO orcamento = cboOrcamento.SelectedItem as OrcamentoDTO; ServicoDTO dto = new ServicoDTO(); dto.ClienteId = cliente.Id; dto.OrcamentoId = orcamento.Id; dto.Data = mkbData.Text; dto.Descricao = txtDesc.Text; ServicoBusiness buss = new ServicoBusiness(); buss.Salvar(dto); MessageBox.Show("Serviço salvo com sucesso!", "SIGMA", MessageBoxButtons.OK); } catch (Exception ex) { MessageBox.Show(ex.Message, "SIGMA", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
void AutoCarregarGrid() { ServicoBusiness buss = new ServicoBusiness(); List <ServicoView> lista = buss.Listar(); dgvServicos.AutoGenerateColumns = false; dgvServicos.DataSource = lista; }
void CarregarGrid() { string animal = txtAnimal.Text; string data = txtData.Text; ServicoBusiness buss = new ServicoBusiness(); List <ServicoView> lista = buss.Consultar(animal, data); dgvServicos.AutoGenerateColumns = false; dgvServicos.DataSource = lista; }
private void btnSalvar_Click(object sender, EventArgs e) { try { AnimalDTO animal = cboAnimal.SelectedItem as AnimalDTO; ServicoDTO dto = new ServicoDTO(); dto.IdAnimal = animal.Id; dto.Data = mkbData.Text; dto.Servico = txtDescricao.Text; dto.Valor = nudValor.Value; ServicoBusiness buss = new ServicoBusiness(); int pk = buss.Salvar(dto, itemAdd.ToList()); string msg = "Serviço salvo concluido com sucesso!"; frmMessage tela = new frmMessage(); tela.LoadScreen(msg); tela.ShowDialog(); } catch (ValidacaoException vex) { frmAlert tela = new frmAlert(); tela.LoadScreen(vex.Message); tela.ShowDialog(); } catch (Exception ex) { string msg = "Ocorreu um erro: " + ex.Message; frmException tela = new frmException(); tela.LoadScreen(msg); tela.ShowDialog(); } }
public JsonResult <Servico> Get(int servico_id) { ServicoBusiness servico_business = new ServicoBusiness(); return(Json(servico_business.GetServico(servico_id))); }
public JsonResult <List <Servico> > GetAll() { ServicoBusiness servico_business = new ServicoBusiness(); return(Json(servico_business.GetAllServicos())); }
public JsonResult <bool> Cadastrar(ViewModelCadastroServico vm_cadastro_servico) { ServicoBusiness servico_business = new ServicoBusiness(); return(Json(servico_business.CadastrarServico(vm_cadastro_servico))); }