private bool SaveContractData() { bool result; PutInfoControlsToContract(); try{ string message; var usecase = ContractUseCase.CreateUseCase(Profile.ProfileId, Profile.SingleProfileName); if (IsNewRecord) { usecase.NewContract(contract); message = $"El contrato de {Profile.ProfileName} ha sido almacenado correctamente."; MessageBox.Show(message, "Atención", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { usecase.EditContract(contract); message = $"El contrato de {Profile.ProfileName} ha sido actualizado correctamente."; MessageBox.Show(message, "Atención", MessageBoxButtons.OK, MessageBoxIcon.Information); } result = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "Atención", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); result = false; } return(result); }
private void LoadUsers(int filterType) { try{ var useCase = ContractUseCase.CreateUseCase(profile.ProfileId, profile.SingleProfileName); var data = new DataTable(); ListDataGridView.DataSource = null; switch (filterType) { case 0: data = useCase.FindAll(); break; case 1: data = useCase.FindValidContract(); break; case 2: data = useCase.FindInvalidContracts(); break; } ListDataGridView.DataSource = data; HideColumns(); DisplayCounts(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Atención", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
private void LoadContractInfo() { try{ var usecase = ContractUseCase.CreateUseCase(Profile.ProfileId, Profile.SingleProfileName); contract = usecase.FindOneContractByID(IdSelected); } catch (Exception ex) { MessageBox.Show(ex.Message, "Atención", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); Close(); } }
public IHttpActionResult PatchRefuse(RequestContractModel model) { if (model == null) { return(BadRequest("Parámetros inválidos, los parámetros enviados no corresponden.")); } try{ var usecase = ContractUseCase.CreateUseCase(model.ProfileId); usecase.ContractRefuse(model.ContractId, model.ClientId, model.CustomerObservation); return(Ok("Contrato procesado correctamente.")); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
public IHttpActionResult GetByClientID(int profileId, string clientId) { if (string.IsNullOrEmpty(clientId) || profileId <= 0) { return(BadRequest("Parámetros inválidos, el identificador del cliente es incorrecto.")); } try{ var usecase = ContractUseCase.CreateUseCase(profileId); var contractList = usecase.GetContractByCustomerId(clientId); if (contractList == null) { return(NotFound()); } return(Ok(contractList)); } catch (Exception ex) { return(BadRequest(ex.Message)); } }
private bool DeleteContract() { bool deleteStatus; var message = "¿Esta seguro de eliminar el contrato?"; var result = MessageBox.Show(message, "Atención!", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result.Equals(DialogResult.No)) { return(false); } var usecase = ContractUseCase.CreateUseCase(Profile.ProfileId, Profile.ProfileName); try{ usecase.DeleteContract(IdSelected); message = "El contrato ha sido eliminado correctamente."; MessageBox.Show(message, "Atención!", MessageBoxButtons.OK, MessageBoxIcon.Information); deleteStatus = true; } catch { deleteStatus = false; } return(deleteStatus); }