//[AllowAnonymous]
        public async Task <IActionResult> SaveGDManInformation([FromBody] GDManInformationViewModel model)
        {
            //return Ok("Success");
            try
            {
                var user = await _userManager.FindByNameAsync(model.userName);

                string        gdNumber      = RandomString(6);
                GDInformation gDInformation = new GDInformation
                {
                    ApplicationUserId   = user.Id,
                    gdFor               = model.gdFor,
                    gdDate              = DateTime.Now,
                    gdNumber            = gdNumber,
                    gDTypeId            = model.gDTypeId,
                    productTypeId       = model.productTypeId,
                    documentTypeId      = model.documentTypeId == 0 ? null : model.documentTypeId,
                    documentDescription = model.documentDescription,
                    statusId            = 1
                };

                int gdId = await lostAndFoundService.SaveGDInformation(gDInformation);


                ManInformation manInformation = new ManInformation
                {
                    gDInformationId        = gdId,
                    relationTypeId         = model.relationTypeId,
                    name                   = model.name,
                    aproxAge               = model.aproxAge,
                    agePeriodId            = model.agePeriodId,
                    genderId               = model.genderId,
                    isHealthDisabled       = model.isHealthDisabled,
                    fatherName             = model.fatherName,
                    motherName             = model.motherName,
                    spouseName             = model.spouseName,
                    nationalIdentityTypeId = model.manNationalIdentityTypeId,
                    identityNo             = model.identityNo,
                    numberTypeId           = model.numberTypeId,
                    number                 = model.number
                };

                int manid = await lostAndFoundService.SaveManInformation(manInformation);

                if (model.gdFor == "OTHERS")
                {
                    OtherPersonInformation otherPerson = new OtherPersonInformation
                    {
                        gDInformationId        = gdId,
                        nationalIdentityTypeId = model.nationalIdentityTypeId == 0 ? null : model.nationalIdentityTypeId,
                        identityNo             = model.identityNo,
                        mobileNo = model.mobileNo
                    };
                    int opi = await lostAndFoundService.SaveOtherPersonInformation(otherPerson);
                }

                IndentifyInfo indentifyInfo = new IndentifyInfo
                {
                    gDInformationId           = gdId,
                    colorsId                  = model.colorsId,
                    identifySign              = model.identifySign,
                    descriptionCircumcisionId = model.descriptionCircumcisionId,
                    religionId                = model.religionId,
                    bloodGroup                = model.bloodGroup,
                    occupationId              = model.occupationId,
                    maritalStatusId           = model.maritalStatusId
                };
                int identityid = await lostAndFoundService.SaveIndentifyInfo(indentifyInfo);

                AddressInformation addressInformation = new AddressInformation
                {
                    districtId     = model.manDistrictId,
                    thanaId        = model.thanaId,
                    houseVillage   = model.postOffice,
                    addressDetails = model.addressDetails,
                    type           = model.addressType,
                    oneLineAddress = model.oneLineAddress,
                };
                int addressId = await addressInformationService.SaveAddressInformation(addressInformation);

                PhysicalDescription physical = new PhysicalDescription
                {
                    manInformationId                   = manid,
                    eyeTypeId                          = model.eyeTypeId,
                    noseTypeId                         = model.noseTypeId,
                    hairTypeId                         = model.hairTypeId,
                    foreHeadTypeId                     = model.foreHeadTypeId,
                    beardTypeId                        = model.beardTypeId,
                    weight                             = model.weight,
                    bodyStructureId                    = model.bodyStructureId,
                    faceShapeTypeId                    = model.faceShapeTypeId,
                    bodyChinTypeId                     = model.bodyChinTypeId,
                    bodyColorId                        = model.bodyColorId,
                    moustacheTypeId                    = model.moustacheTypeId,
                    earTypeId                          = model.earTypeId,
                    neckTypeId                         = model.neckTypeId,
                    heightFeet                         = model.heightFeet,
                    heightInch                         = model.heightInch,
                    specialBirthMarkTypeId             = model.specialBirthMarkTypeId,
                    specialBirthMarkBodyPartId         = model.specialBirthMarkBodyPartId,
                    specialBirthMarkBodyPartPositionId = model.specialBirthMarkBodyPartPositionId,
                    visibleTatto                       = model.visibleTatto,
                    otherIdentityfyMark                = model.otherIdentityfyMark,
                    teethTypeId                        = model.teethTypeId,
                    specialBodyConditionId             = model.specialBodyConditionId,
                };
                int phyId = await lostAndFoundService.SavePhysicalDescription(physical);

                DressDescription dress = new DressDescription
                {
                    manInformationId   = manid,
                    inTheHeadId        = model.inTheHeadId,
                    inTheHeadColorId   = model.inTheHeadColorId,
                    inTheBodyId        = model.inTheBodyId,
                    inTheBodyColorId   = model.inTheBodyColorId,
                    inTheThroatId      = model.inTheThroatId,
                    inTheThroatColorId = model.inTheThroatColorId,
                    inTheWaistId       = model.inTheWaistId,
                    inTheWaistColorId  = model.inTheWaistColorId,
                    inTheLegsId        = model.inTheLegsId,
                    inTheLegsColorId   = model.inTheLegsColorId,
                    inTheEyeId         = model.inTheEyeId,
                    inTheEyeColorId    = model.inTheEyeColorId,
                    shoesSize          = model.shoesSize,
                    shoesSizeType      = model.shoesSizeType,
                };
                int dressId = await lostAndFoundService.SaveDressDescription(dress);

                SpaceAndTime spaceAndTime = new SpaceAndTime
                {
                    gDInformationId = gdId,
                    placeDetails    = model.placeDetails,
                    lafDate         = model.lafDate,
                    lafTime         = model.lafTime,
                    postOfficeId    = model.postOfficeId,
                    thanaId         = model.thanaId,
                    districtId      = model.districtId,
                    divisionId      = model.divisionId
                };
                int sdid = await lostAndFoundService.SaveSpaceAndTime(spaceAndTime);


                if (model.dNAProfileViewModels != null)
                {
                    List <DNAProfileDetails> lstDNAProfile = new List <DNAProfileDetails>();
                    foreach (var item in model.dNAProfileViewModels)
                    {
                        DNAProfileDetails dNAProfileDetails = new DNAProfileDetails
                        {
                            manInformationId = manid,
                            locous           = item.locous,
                            genotype1        = item.genotype1,
                            genotype2        = item.genotype2
                        };
                        lstDNAProfile.Add(dNAProfileDetails);
                    }

                    int dnaId = await lostAndFoundService.SaveDNAProfileDetails(lstDNAProfile);
                }

                return(Ok(gdNumber));
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
0
        public async Task <IEnumerable <GDInformation> > GetMenInformationBySearching(GDManInformationViewModel model)
        {
            var result = await(from m in _context.ManInformation
                               join g in _context.GDInformation on m.gDInformationId equals g.Id
                               join py in _context.PhysicalDescriptions on m.Id equals py.manInformationId into pyy
                               from p in pyy.DefaultIfEmpty()
                               join gnr in _context.Genders on m.genderId equals gnr.Id into gg
                               from gr in gg.DefaultIfEmpty()
                               join ind in _context.IndentifyInfos on g.Id equals ind.gDInformationId into inn
                               from id in inn.DefaultIfEmpty()
                               join stt in _context.SpaceAndTimes on g.Id equals stt.gDInformationId into sttt
                               from st in sttt.DefaultIfEmpty()

                               join d in _context.DressDescriptions on m.Id equals d.manInformationId into ds
                               from dd in ds.DefaultIfEmpty()

                               where p.eyeTypeId == (model.eyeTypeId == null ? p.eyeTypeId : model.eyeTypeId) &&
                               p.noseTypeId == (model.noseTypeId == null ? p.noseTypeId : model.noseTypeId) &&
                               p.hairTypeId == (model.hairTypeId == null ? p.hairTypeId : model.hairTypeId) &&
                               p.foreHeadTypeId == (model.foreHeadTypeId == null ? p.foreHeadTypeId : model.foreHeadTypeId) &&
                               p.beardTypeId == (model.beardTypeId == null ? p.beardTypeId : model.beardTypeId) &&
                               p.bodyStructureId == (model.bodyStructureId == null ? p.bodyStructureId : model.bodyStructureId) &&
                               p.faceShapeTypeId == (model.faceShapeTypeId == null ? p.faceShapeTypeId : model.faceShapeTypeId) &&
                               p.bodyChinTypeId == (model.bodyChinTypeId == null ? p.bodyChinTypeId : model.bodyChinTypeId) &&
                               p.bodyColorId == (model.bodyColorId == null ? p.bodyColorId : model.bodyColorId) &&
                               p.moustacheTypeId == (model.moustacheTypeId == null ? p.moustacheTypeId : model.moustacheTypeId) &&
                               p.earTypeId == (model.earTypeId == null ? p.earTypeId : model.earTypeId) &&
                               p.neckTypeId == (model.neckTypeId == null ? p.neckTypeId : model.neckTypeId) &&
                               p.teethTypeId == (model.teethTypeId == null ? p.teethTypeId : model.teethTypeId) &&
                               p.specialBodyConditionId == (model.specialBodyConditionId == null ? p.specialBodyConditionId : model.specialBodyConditionId) &&
                               p.specialBirthMarkTypeId == (model.specialBirthMarkTypeId == null ? p.specialBirthMarkTypeId : model.specialBirthMarkTypeId) &&
                               p.specialBirthMarkBodyPartId == (model.specialBirthMarkBodyPartId == null ? p.specialBirthMarkBodyPartId : model.specialBirthMarkBodyPartId) &&
                               p.specialBirthMarkBodyPartPositionId == (model.specialBirthMarkBodyPartPositionId == null ? p.specialBirthMarkBodyPartPositionId : model.specialBirthMarkBodyPartPositionId) &&
                               p.weight == (model.weight == null ? p.weight : model.weight) &&
                               p.heightFeet == (model.heightFeet == null ? p.heightFeet : model.heightFeet) &&
                               p.heightInch == (model.heightInch == null ? p.heightInch : model.heightInch) &&
                               p.visibleTatto == (model.visibleTatto == string.Empty ? p.visibleTatto : model.visibleTatto) &&
                               p.otherIdentityfyMark == (model.otherIdentityfyMark == string.Empty ? p.otherIdentityfyMark : model.otherIdentityfyMark)

                               && dd.inTheHeadId == (model.inTheHeadId == null ? dd.inTheHeadId : model.inTheHeadId) &&
                               dd.inTheHeadColorId == (model.inTheHeadColorId == null ? dd.inTheHeadColorId : model.inTheHeadColorId) &&
                               dd.inTheEyeId == (model.inTheEyeId == null ? dd.inTheEyeId : model.inTheEyeId) &&
                               dd.inTheEyeColorId == (model.inTheEyeColorId == null ? dd.inTheEyeColorId : model.inTheEyeColorId) &&
                               dd.inTheThroatId == (model.inTheThroatId == null ? dd.inTheThroatId : model.inTheThroatId) &&
                               dd.inTheThroatColorId == (model.inTheThroatColorId == null ? dd.inTheThroatColorId : model.inTheThroatColorId) &&
                               dd.inTheBodyId == (model.inTheBodyId == null ? dd.inTheBodyId : model.inTheBodyId) &&
                               dd.inTheBodyColorId == (model.inTheBodyColorId == null ? dd.inTheBodyColorId : model.inTheBodyColorId) &&
                               dd.inTheWaistId == (model.inTheWaistId == null ? dd.inTheWaistId : model.inTheWaistId) &&
                               dd.inTheWaistColorId == (model.inTheWaistColorId == null ? dd.inTheWaistColorId : model.inTheWaistColorId) &&
                               dd.inTheLegsId == (model.inTheLegsId == null ? dd.inTheLegsId : model.inTheLegsId) &&
                               dd.inTheLegsColorId == (model.inTheLegsColorId == null ? dd.inTheLegsColorId : model.inTheLegsColorId) &&
                               dd.shoesSize == (model.shoesSize == null ? dd.shoesSize : model.shoesSize) &&
                               dd.shoesSizeType == (model.shoesSizeType == string.Empty ? dd.shoesSizeType : model.shoesSizeType)
                               //&& g.Id==model.gDInformationId
                               //g.ApplicationUserId == (userId == "5eeaabd4-0abc-4836-aa58-e1de72a626a8" ? g.ApplicationUserId : userId)
                               //&& g.statusId == 1
                               select new GDInformation
            {
                Id             = g.Id,
                gdFor          = g.gdFor,
                productTypeId  = g.productTypeId,
                gDTypeId       = g.gDTypeId,
                documentTypeId = g.documentTypeId,
                gdNumber       = g.gdNumber,
                gdDate         = g.gdDate,
                date           = Convert.ToDateTime(g.gdDate).ToString("dd-MM-yyyy"),
                statusId       = g.statusId,
                status         = g.statusId == 1 ? "Allegation" : g.statusId == 2 ? "Investigation" : g.statusId == 3 ? "Disposal" : "Cancel"
            }).ToListAsync();

            return(result);
        }
        public async Task <IEnumerable <GDInformation> > GetMenGDInformationBySearching([FromBody] GDManInformationViewModel model)
        {
            var result = await lostAndFoundService.GetMenInformationBySearching(model);

            return(result);
        }