public ContatoCliente FazContato(Cliente cliente, Cobranca cobranca) { ContatoCliente contato = new ContatoCliente(cliente, cobranca); contato.Dispara(); return(contato); }
public async Task <ContatoCliente> CreateAsync(ContatoCliente contatoCliente) { this._logger.LogDebug("Starting CreateAsync"); var existContatoEmail = await _sqlService.ExistsAsync(ContatoClienteQuery.EXIST_CONTATOCLIENTE_EMAIL, new { EMAIL = contatoCliente.Email }); var existContatoTelefone = await _sqlService.ExistsAsync(ContatoClienteQuery.EXIST_CONTATOCLIENTE_TELEFONE, new { TELEFONE = contatoCliente.Email }); if (existContatoEmail && existContatoTelefone) { this._logger.LogDebug("Contato already exists, triggering 400"); this._validationService.Throw("Contato", "There is already another funcionario with that Email or Telefone", contatoCliente, Validation.ContatoExists); } this._logger.LogDebug("Inserting new Contato"); contatoCliente.ContatoCliId = await _sqlService.CreateAsync(ContatoClienteQuery.INSERT, new { CLIENTEID = contatoCliente.ClienteId, EMAIL = contatoCliente.Email, TELEFONE = contatoCliente.Telefone }); this._logger.LogDebug("Ending CreateAsync"); return(contatoCliente); }
public async Task <ActionResult> Put( [SwaggerParameter("contatoCli's Id")] int contatoCliId, [FromBody] ContatoCliente contatoCliente) { var edited = await _contatoClienteService.UpdateAsync(contatoCliId, contatoCliente); return(Ok(edited)); }
public ContatoCliente Atualizar(ContatoCliente contatoCliente) { if (!contatoCliente.EhValido()) { return(contatoCliente); } return(_contatoClienteRepositorio.Atualizar(contatoCliente)); }
public async Task <ContatoCliente> UpdateAsync(int id, ContatoCliente contatoCliente) { this._logger.LogDebug("Starting UpdateAsync"); var oldContato = await GetAsync(id); var existContatoEmail = await _sqlService.ExistsAsync(ContatoClienteQuery.EXIST_CONTATOCLIENTE_EMAIL, new { EMAIL = contatoCliente.Email }); var existContatoTelefone = await _sqlService.ExistsAsync(ContatoClienteQuery.EXIST_CONTATOCLIENTE_TELEFONE, new { TELEFONE = contatoCliente.Telefone }); if (existContatoEmail && existContatoTelefone) { this._logger.LogDebug("Contato already exists, triggering 400"); this._validationService.Throw("Contato", "There is already another funcionario with that Email or Telefone", contatoCliente, Validation.ContatoExists); } var existContato = await _sqlService.ExistsAsync(ContatoClienteQuery.EXIST_CONTATOCLIENTE_ID, new { Id = oldContato.ContatoCliId }); this._logger.LogDebug("Checking if that contato already exists"); if (!existContato) { this._logger.LogDebug("Contato already exists, triggering 400"); this._validationService.Throw("Contato", "There is already another user with that id", contatoCliente.ContatoCliId, Validation.ContatoNotExists); } this._logger.LogDebug("Updating contato"); await _sqlService.ExecuteAsync(ContatoClienteQuery.UPDATE, new { Id = id, CLIENTEID = contatoCliente.ClienteId, EMAIL = contatoCliente.Email, TELEFONE = contatoCliente.Telefone }); contatoCliente.ContatoCliId = oldContato.ContatoCliId; this._logger.LogDebug("Ending UpdateAsync"); return(contatoCliente); }
private void udgv_ClickCell(object sender, Infragistics.Win.UltraWinGrid.ClickCellEventArgs e) { //Enquanto o usuário não clicar sobre o hiperlink, eu não faço nada. if (e.Cell.Column.ToString().ToUpper() != "SELECIONAR") { return; } else { mContato = new ContatoCliente(); mContato.id = udgv.Rows[e.Cell.Row.Index].Cells["id"].OriginalValue.ToString(); mContato.Nome = udgv.Rows[e.Cell.Row.Index].Cells["Nome"].OriginalValue.ToString(); mContato.Cliente = udgv.Rows[e.Cell.Row.Index].Cells["Cliente"].OriginalValue.ToString(); mContato.Cidade = udgv.Rows[e.Cell.Row.Index].Cells["Cidade"].OriginalValue.ToString(); mContato.Estado = udgv.Rows[e.Cell.Row.Index].Cells["Estado"].OriginalValue.ToString(); mContato.Pais = udgv.Rows[e.Cell.Row.Index].Cells["País"].OriginalValue.ToString(); this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); GC.Collect(); } }
public bool AlterarContatoCliente(ContatoClienteEntity entity) { bool returnIncluirContatoCliente = false; try { ContatoCliente obj = new ContatoCliente() { idCliente = entity.idCliente, idContato = entity.idContato, idContatoCliente = entity.idContatoCliente }; returnIncluirContatoCliente = new ContatoClienteRepository().AtualizarContatoCliente(obj); } catch (Exception ex) { returnIncluirContatoCliente = false; throw ex; } return(returnIncluirContatoCliente); }
public async Task <ActionResult> Post([FromBody] ContatoCliente contatoCliente) { var created = await _contatoClienteService.CreateAsync(contatoCliente); return(CreatedAtAction(nameof(Post), new { id = contatoCliente.ContatoCliId }, created)); }