예제 #1
0
        public async Task Create(HealthInsuranceDataModel request)
        {
            var hasHealthInsurance = await _healthInsuranceRepository.GetAsync(request.Name);

            if (hasHealthInsurance is not null)
            {
                Notify("Já existe um convênio cadastrado com este nome informado.");
                return;
            }

            var healthInsurance = new HealthInsurance(request.Name, request.Type);

            if (healthInsurance.IsValid())
            {
                await _healthInsuranceRepository.AddAsync(healthInsurance);
            }
            else
            {
                Notify(healthInsurance.ValidationResult);
                return;
            }

            if (await CommitAsync() is false)
            {
                Notify("Erro ao salvar dados.");
            }
        }
        public ActionResult Edit(HealthInsuranceViewModel formModel)
        {
            if (this.ModelState.IsValid)
            {
                HealthInsurance healthInsurance;
                if (formModel.Id != null)
                {
                    healthInsurance = this.db.HealthInsurances.First(m => m.Id == formModel.Id);
                }
                else
                {
                    healthInsurance = new HealthInsurance();
                    this.db.HealthInsurances.AddObject(healthInsurance);
                    healthInsurance.DoctorId   = this.Doctor.Id;
                    healthInsurance.PracticeId = this.Doctor.PracticeId;
                }

                healthInsurance.Name = formModel.Name;
                healthInsurance.NewAppointmentValue    = formModel.NewAppointmentValue;
                healthInsurance.ReturnAppointmentValue = formModel.ReturnAppointmentValue;
                healthInsurance.ReturnTimeInterval     = formModel.ReturnDaysInterval;
                healthInsurance.IsActive     = formModel.IsActive;
                healthInsurance.IsParticular = formModel.IsParticular;

                this.db.SaveChanges();

                return(this.Redirect(this.Url.Action("Details", new { id = healthInsurance.Id })));
            }

            return(this.View("Edit", formModel));
        }
        public void PrintDetailsOnScreen()
        {
            var sb = new StringBuilder();

            sb.AppendLine("Employee for PORTUGAL");

            sb.Append("Gross salary: EUR ");
            sb.AppendLine(GrossAumont.ToString());

            sb.AppendLine();
            sb.AppendLine("CalculateDeductions details");
            sb.AppendLine("---------------------------------------");

            sb.Append("Revenue: EUR ");
            sb.AppendLine(Revenue.ToString());

            sb.Append("Pension: EUR ");
            sb.AppendLine(Pension.ToString());

            sb.Append("Health Insurance: EUR ");
            sb.AppendLine(HealthInsurance.ToString());
            sb.AppendLine("---------------------------------------");

            sb.Append("Net salary: EUR ");
            sb.AppendLine(NetAumont.ToString());

            Console.WriteLine(sb.ToString());
        }
        private void DeleteHealthInsurance()
        {
            if (SelectedHealthInsurance == null)
            {
                return;
            }

            if (SelectedHealthInsurance.HealthInsuranceId == 0)
            {
                HealthInsuranceList.Remove(SelectedHealthInsurance);
                SelectedHealthInsurance = null;
                return;
            }

            HealthInsurances.Delete(SelectedHealthInsurance.HealthInsuranceId);
            HealthInsuranceList.Remove(SelectedHealthInsurance);
            SelectedHealthInsurance = null;
        }
예제 #5
0
 public static bool Update(HealthInsurance HealthInsurance)
 {
     return(WebApi <bool> .PutAsync(controllerName, HealthInsurance, "Put").Result);
 }
예제 #6
0
 public static int Insert(HealthInsurance HealthInsurance)
 {
     return(WebApi <int> .PostAsync(controllerName, HealthInsurance, "SinglePost").Result);
 }
 private void NewHealthInsurance()
 {
     SelectedHealthInsurance = new HealthInsurance();
     HealthInsuranceList.Add(SelectedHealthInsurance);
 }
예제 #8
0
 public void InitObjects()
 {
     customer        = new Customer("Prashant", 33, true);
     healthInsurance = new HealthInsurance();
 }
예제 #9
0
 public void Update(HealthInsurance healthInsurance)
 {
     _db.Update(healthInsurance);
 }
예제 #10
0
 public async Task AddAsync(HealthInsurance healthInsurance)
 {
     await _healthInsurances
         .AddAsync(healthInsurance);
 }