예제 #1
0
        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);
        }
예제 #2
0
        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);
            }
        }
예제 #3
0
 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));
     }
 }
예제 #6
0
        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);
        }