public bool CadastrarManobrista(ManobristaDTO manobrista) { using (var manobr = new Manobrista()) { return manobr.CadastrarManobrista(manobrista); } }
public static bool CadastrarManobrista(ManobristaDTO manobrista) { using (var client = new LRBusiness()) { return client.CadastrarManobrista(manobrista); } }
public static LR_MANOBRISTA DtoToEntity(ManobristaDTO empresa) { return new LR_MANOBRISTA { ID_MANOBRISTA = empresa.idManobrista, NM_MANOBRISTA = empresa.nmManobrista, ID_LOJA = empresa.idLoja }; }
public bool CadastrarManobrista(ManobristaDTO empresa) { try { context.LR_MANOBRISTA.Add(ManobristaDTO.DtoToEntity(empresa)); context.SaveChanges(); } catch (Exception ex) { throw ex; } return true; }
private void btnNovoManobrista_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtNovoManobrista.Text.Trim())) { errorProvider1.SetError(txtNovoManobrista, "Campo obrigatório"); return; } else { var manobrista = new ManobristaDTO { nmManobrista = txtNovoManobrista.Text.Trim().ToUpper(), idLoja = this.idLoja }; if (Manobrista.CadastrarManobrista(manobrista)) { this.Close(); } } }