public async Task <string> GetOrphanSummary(int Oid)
        {
            var orp = _SourceOrphans.FirstOrDefault(o => o.Id == Oid);

            if (orp == null)
            {
                return(string.Empty);
            }
            var brothersTask = _apiClient.Orphans_GetBrothersAsync(Oid);
            Task <OrphanageDataModel.FinancialData.Bail> bailTask       = null;
            Task <OrphanageDataModel.FinancialData.Bail> FamilyBailTask = null;

            if (orp.IsBailed)
            {
                bailTask = _apiClient.Bails_GetAsync(orp.BailId.Value);
            }
            if (orp.Family.IsBailed)
            {
                FamilyBailTask = _apiClient.Bails_GetAsync(orp.Family.BailId.Value);
            }
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendLine(Properties.Resources.FatherName + ": " + orp.Family.Father.Name.FullName());
            stringBuilder.AppendLine(Properties.Resources.FatherDeathDate + ": " + _dataFormatterService.GetFormattedDate(orp.Family.Father.DateOfDeath));
            stringBuilder.AppendLine(Properties.Resources.MotherFirstName + ": " + orp.Family.Mother.Name.FullName());
            stringBuilder.AppendLine(Properties.Resources.MotherIsDead + ": " + _translateService.BooleanToString(orp.Family.Mother.IsDead));
            if (orp.Family.Mother.IsDead && orp.Family.Mother.DateOfDeath.HasValue)
            {
                stringBuilder.AppendLine(Properties.Resources.MotherDeathDate + ": " + _dataFormatterService.GetFormattedDate(orp.Family.Mother.DateOfDeath.Value));
            }
            stringBuilder.AppendLine(Properties.Resources.MotherIsMarried + ": " + _translateService.BooleanToString(orp.Family.Mother.IsMarried));
            if (orp.Family.Mother.IsMarried && orp.Family.Mother.HusbandName != null && orp.Family.Mother.HusbandName.Length > 0)
            {
                stringBuilder.AppendLine(Properties.Resources.MotherHusbandName + ": " + orp.Family.Mother.HusbandName);
            }
            if (orp.Age.HasValue)
            {
                stringBuilder.AppendLine(Properties.Resources.Age + ": " + _translateService.DateToString(orp.Birthday));
            }
            var brothers = await brothersTask;

            if (brothers != null)
            {
                int boys  = brothers.Count(o => _translateService.IsBoy(o.Gender));
                int girls = brothers.Count(o => !_translateService.IsBoy(o.Gender));
                stringBuilder.AppendLine(Properties.Resources.BrothersCountString + ": " + boys + " " + Properties.Resources.MalesString + ", " + girls + " " + Properties.Resources.FemalesString);
            }
            else
            {
                stringBuilder.AppendLine(Properties.Resources.BrothersCountString + ": 0 " + Properties.Resources.MalesString + ", 0 " + Properties.Resources.FemalesString);
            }
            if (bailTask != null || FamilyBailTask != null)
            {
                stringBuilder.AppendLine(Properties.Resources.IsBailed + ": " + Properties.Resources.BooleanTrue);
                OrphanageDataModel.FinancialData.Bail orpBail = null;
                if (bailTask != null)
                {
                    orpBail = await bailTask;
                }
                if (FamilyBailTask != null)
                {
                    orpBail = await FamilyBailTask;
                }
                if (orpBail != null)
                {
                    stringBuilder.AppendLine(Properties.Resources.GuarantorName + ": " + orpBail?.Guarantor?.Name.FullName());
                    stringBuilder.AppendLine(Properties.Resources.BailIsFamily + ": " + _translateService.BooleanToString(orpBail.IsFamilyBail));
                    stringBuilder.AppendLine(Properties.Resources.BailAmount + ": " + orpBail.Amount.ToString() + " " + orpBail?.Account.CurrencyShortcut);
                    stringBuilder.AppendLine(Properties.Resources.BailIsMonthly + ": " + _translateService.BooleanToString(orpBail.IsMonthlyBail));
                    stringBuilder.AppendLine(Properties.Resources.BailIsEnded + ": " + _translateService.BooleanToString(orpBail.IsExpired));
                }
            }
            else
            {
                stringBuilder.AppendLine(Properties.Resources.IsBailed + ": " + Properties.Resources.BooleanFalse);
            }

            if (orp.EducationId.HasValue && orp.Education != null)
            {
                if (orp.Education.Stage.Contains(Properties.Resources.EducationNonStudyKeyword))
                {
                    stringBuilder.AppendLine(Properties.Resources.IsStudying + ": " + Properties.Resources.BooleanFalse);
                    if (orp.Education.Reasons != null && orp.Education.Reasons.Length > 0)
                    {
                        stringBuilder.AppendLine(Properties.Resources.EducationNonStudyingReasons + ": " + orp.Education.Reasons);
                    }
                }
                else
                {
                    stringBuilder.AppendLine(Properties.Resources.IsStudying + ": " + Properties.Resources.BooleanTrue);
                    if (orp.Education.Stage != null && orp.Education.Stage.Length > 0)
                    {
                        stringBuilder.AppendLine(Properties.Resources.EducationStage + ": " + orp.Education.Stage);
                    }
                    if (orp.Education.DegreesRate.HasValue)
                    {
                        stringBuilder.AppendLine(Properties.Resources.EducationAvaregeGrade + ": " + orp.Education.DegreesRate.Value + "%");
                    }
                    if (orp.Education.School != null && orp.Education.School.Length > 0)
                    {
                        stringBuilder.AppendLine(Properties.Resources.EducationSchoolName + ": " + orp.Education.School);
                    }
                }
            }
            else
            {
                stringBuilder.AppendLine(Properties.Resources.IsStudying + ": " + Properties.Resources.BooleanFalse);
            }
            if (orp.HealthId.HasValue && orp.HealthStatus != null)
            {
                stringBuilder.AppendLine(Properties.Resources.IsSick + ": " + Properties.Resources.BooleanTrue);
                if (orp.HealthStatus.SicknessName != null && orp.HealthStatus.SicknessName.Length > 0)
                {
                    stringBuilder.AppendLine(Properties.Resources.HealthSicknessName + ": " + orp.HealthStatus.SicknessName);
                }
                if (orp.HealthStatus.Medicine != null && orp.HealthStatus.Medicine.Length > 0)
                {
                    stringBuilder.AppendLine(Properties.Resources.HealthMedicen + ": " + orp.HealthStatus.Medicine);
                }
                if (orp.HealthStatus.Cost.HasValue)
                {
                    stringBuilder.AppendLine(Properties.Resources.Cost + ": " + orp.HealthStatus.Cost.Value);
                }
            }
            else
            {
                stringBuilder.AppendLine(Properties.Resources.IsSick + ": " + Properties.Resources.BooleanFalse);
            }
            return(stringBuilder.ToString());
        }
Example #2
0
        private void SetValues()
        {
            setImageControlsHanlder(false);
            if (_CurrentOrphan == null)
            {
                return;
            }
            orphanBindingSource.DataSource = _CurrentOrphan;
            RadPageView1.SelectedPage      = pgeBasic;
            var ageString = _TranslateService.DateToString(_CurrentOrphan.Birthday);

            txtOAge.Text = ageString;
            PicBody.SetImageByBytes(_CurrentOrphan.FullPhotoData);
            picFace.SetImageByBytes(_CurrentOrphan.FacePhotoData);
            RadPageView1.SelectedPage = pgeOthers;
            picObirthCertificate.SetImageByBytes(_CurrentOrphan.BirthCertificatePhotoData);
            picOFamilyCardPhoto.SetImageByBytes(_CurrentOrphan.FamilyCardPagePhotoData);
            //Health
            RadPageView1.SelectedPage = pgeHealth;
            if (_CurrentOrphan.HealthId.HasValue)
            {
                EnabledDisHealthControls(true);
                txtHDoctorName.Text = _CurrentOrphan.HealthStatus.SupervisorDoctor;
                if (_CurrentOrphan.HealthStatus.Medicine != null)
                {
                    txtHMedicen.Text  = _CurrentOrphan.HealthStatus.Medicine.Replace(";", "+");
                    txtHMedicen.Text += "+";
                }
                if (_CurrentOrphan.HealthStatus.SicknessName != null)
                {
                    txtHSicknessName.Text  = _CurrentOrphan.HealthStatus.SicknessName.Replace(";", "+");
                    txtHSicknessName.Text += "+";
                }
                txtHNote.Text = _CurrentOrphan.HealthStatus.Note;
                if (_CurrentOrphan.HealthStatus.Cost.HasValue)
                {
                    numHCost.Value = (decimal)_CurrentOrphan.HealthStatus.Cost.Value;
                }
                picHReportPhoto.SetImageByBytes(_CurrentOrphan.HealthStatus.ReporteFileData);
            }
            else
            {
                EnabledDisHealthControls(false);
            }
            //Education
            RadPageView1.SelectedPage = pgeEducation;
            if (_CurrentOrphan.EducationId.HasValue)
            {
                if (_CurrentOrphan.Education.Stage.Contains(Properties.Resources.EducationNonStudyKeyword))
                {
                    EnabledDisEducationControls(false);
                }
                else
                {
                    EnabledDisEducationControls(true);
                    txtSNote.Text       = _CurrentOrphan.Education.Note;
                    txtSschoolNAme.Text = _CurrentOrphan.Education.School;
                    if (_CurrentOrphan.Education.DegreesRate.HasValue)
                    {
                        numSDegreesRate.Value = (decimal)_CurrentOrphan.Education.DegreesRate.Value;
                    }
                    if (_CurrentOrphan.Education.MonthlyCost.HasValue)
                    {
                        numSMonthlyCost.Value = (decimal)(_CurrentOrphan.Education.MonthlyCost.Value);
                    }
                    picSStarter.SetImageByBytes(_CurrentOrphan.Education.CertificatePhotoFront);
                    PicSstudyCerti.SetImageByBytes(_CurrentOrphan.Education.CertificatePhotoBack);
                }
                txtSStudyStage.Text = _CurrentOrphan.Education.Stage;
                txtSReason.Text     = _CurrentOrphan.Education.Reasons;
            }
            else
            {
                EnabledDisEducationControls(false);
            }
            RadPageView1.SelectedPage = pgeBasic;

            _CertificatePhotoChanged  = false;
            _CertificatePhoto2Changed = false;
            _HealthPhotoChanged       = false;
            picFace.HideLoadingGif();
            PicBody.HideLoadingGif();
            picObirthCertificate.HideLoadingGif();
            picOFamilyCardPhoto.HideLoadingGif();
            picHReportPhoto.HideLoadingGif();
            picSStarter.HideLoadingGif();
            PicSstudyCerti.HideLoadingGif();
            setImageControlsHanlder(true);
        }