Exemple #1
0
        public async Task <IActionResult> UploadAll([FromBody] UploadForm1Info info)
        {
            try
            {
                var items = info.Items;

                foreach (var item in items)
                {
                    var frm = await _appDbContext.TCL_NEPIs.FirstOrDefaultAsync(p => p.TCL_NEPIId == item.TCL_NEPIId);

                    if (frm == null)
                    {
                        if (item.LastUploaded == null)
                        {
                            item.LastUploaded = DateTime.UtcNow;
                        }

                        _appDbContext.Add(item);
                    }
                    else
                    {
                        frm.Barangay     = item.Barangay;
                        frm.Municipality = item.Municipality;
                        frm.Province     = item.Province;
                        frm.Region       = item.Region;
                        frm.LastUploaded = DateTime.UtcNow;
                    }

                    foreach (var entry in item.Entries)
                    {
                        var foo = await _appDbContext.TCL_NEPI_Entries.FirstOrDefaultAsync(p => p.TCL_NEPI_EntryId == entry.TCL_NEPI_EntryId);

                        if (foo == null)
                        {
                            _appDbContext.Add(entry);
                        }
                        else
                        {
                            foo.Address = entry.Address;
                            foo.BCG     = entry.BCG;
                            foo.ChildExclusiveBreastFeed1 = entry.ChildExclusiveBreastFeed1;
                            foo.ChildExclusiveBreastFeed2 = entry.ChildExclusiveBreastFeed2;
                            foo.ChildExclusiveBreastFeed3 = entry.ChildExclusiveBreastFeed3;
                            foo.ChildExclusiveBreastFeed4 = entry.ChildExclusiveBreastFeed4;
                            foo.ChildExclusiveBreastFeed5 = entry.ChildExclusiveBreastFeed5;
                            foo.ChildExclusiveBreastFeed6 = entry.ChildExclusiveBreastFeed6;

                            foo.ComplimentaryFeeding6 = entry.ComplimentaryFeeding6;
                            foo.ComplimentaryFeeding7 = entry.ComplimentaryFeeding7;
                            foo.ComplimentaryFeeding8 = entry.ComplimentaryFeeding8;

                            foo.CPABTTAssessed = entry.CPABTTAssessed;
                            foo.CPABTTStatus   = entry.CPABTTStatus;

                            foo.DateFullyImmunizedChild      = entry.DateFullyImmunizedChild;
                            foo.DateNewbornScreeningDone     = entry.DateNewbornScreeningDone;
                            foo.DateNewbornScreeningReferral = entry.DateNewbornScreeningReferral;

                            foo.DateOfBirth        = entry.DateOfBirth;
                            foo.DateOfRegistration = entry.DateOfRegistration;
                            foo.Deworming          = entry.Deworming;
                            foo.FamilySerialNumber = entry.FamilySerialNumber;
                            foo.Gender             = entry.Gender;

                            foo.Height = entry.Height;
                            foo.HepaB1MoreThan24hrs = entry.HepaB1MoreThan24hrs;
                            foo.HepaB1Within24hrs   = entry.HepaB1Within24hrs;

                            foo.IPV    = entry.IPV;
                            foo.IronA1 = entry.IronA1;
                            foo.IronA2 = entry.IronA2;

                            foo.MCV1 = entry.MCV1;
                            foo.MCV2 = entry.MCV2;
                            foo.MNP1 = entry.MNP1;
                            foo.MNP2 = entry.MNP2;

                            foo.NameOfChild  = entry.NameOfChild;
                            foo.NameOfMother = entry.NameOfMother;

                            foo.NHTS = entry.NHTS;
                            foo.OPV1 = entry.OPV1;
                            foo.OPV2 = entry.OPV2;
                            foo.OPV3 = entry.OPV3;

                            foo.PCV1 = entry.PCV1;
                            foo.PCV2 = entry.PCV2;
                            foo.PCV3 = entry.PCV3;

                            foo.Pentavalent1 = entry.Pentavalent1;
                            foo.Pentavalent2 = entry.Pentavalent2;
                            foo.Pentavalent3 = entry.Pentavalent3;

                            foo.Remarks = entry.Remarks;

                            foo.RotaVirusVaccine1 = entry.RotaVirusVaccine1;
                            foo.RotaVirusVaccine2 = entry.RotaVirusVaccine2;

                            foo.VitaminA1 = entry.VitaminA1;
                            foo.VitaminA2 = entry.VitaminA2;
                            foo.VitaminA3 = entry.VitaminA3;

                            foo.Weight = entry.Weight;
                        }
                    }
                }

                await _appDbContext.SaveChangesAsync();

                return(Ok());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.ToString()));
            }
        }
Exemple #2
0
        public async Task <IActionResult> UploadAll([FromBody] UploadForm1Info info)
        {
            try
            {
                var items = info.Items;

                foreach (var item in items)
                {
                    var frm = await _appDbContext.TCL_PNCs.FirstOrDefaultAsync(p => p.TCL_PNCId == item.TCL_PNCId);

                    if (frm == null)
                    {
                        if (item.LastUploaded == null)
                        {
                            item.LastUploaded = DateTime.UtcNow;
                        }

                        _appDbContext.Add(item);
                    }
                    else
                    {
                        frm.Barangay     = item.Barangay;
                        frm.Municipality = item.Municipality;
                        frm.Province     = item.Province;
                        frm.Region       = item.Region;
                        frm.LastUploaded = DateTime.UtcNow;
                    }

                    foreach (var entry in item.Entries)
                    {
                        var foo = await _appDbContext.TCL_PNC_Entries.FirstOrDefaultAsync(p => p.TCL_PNC_EntryId == entry.TCL_PNC_EntryId);

                        if (foo == null)
                        {
                            _appDbContext.Add(entry);
                        }
                        else
                        {
                            foo.DateOfRegistration = entry.DateOfRegistration;
                            foo.FamilySerialNumber = entry.FamilySerialNumber;
                            foo.Name    = entry.Name;
                            foo.Address = entry.Address;
                            foo.Age     = entry.Age;
                            foo.LMPDate = entry.LMPDate;
                            foo.LMPGP   = entry.LMPGP;
                            foo.EDC     = entry.EDC;

                            foo.PrenatalVisitTrimester1 = entry.PrenatalVisitTrimester1;
                            foo.PrenatalVisitTrimester2 = entry.PrenatalVisitTrimester2;
                            foo.PrenatalVisitTrimester3 = entry.PrenatalVisitTrimester3;

                            foo.TetanusStatus = entry.TetanusStatus;

                            foo.DateTetanusToxiodVaccine1 = entry.DateTetanusToxiodVaccine1;
                            foo.DateTetanusToxiodVaccine2 = entry.DateTetanusToxiodVaccine2;
                            foo.DateTetanusToxiodVaccine3 = entry.DateTetanusToxiodVaccine3;
                            foo.DateTetanusToxiodVaccine4 = entry.DateTetanusToxiodVaccine4;
                            foo.DateTetanusToxiodVaccine5 = entry.DateTetanusToxiodVaccine5;

                            foo.IronWithFolicDateGiven1   = entry.IronWithFolicDateGiven1;
                            foo.IronWithFolicNumberGiven1 = entry.IronWithFolicNumberGiven1;

                            foo.IronWithFolicDateGiven2   = entry.IronWithFolicDateGiven2;
                            foo.IronWithFolicNumberGiven2 = entry.IronWithFolicNumberGiven2;

                            foo.IronWithFolicDateGiven3   = entry.IronWithFolicDateGiven3;
                            foo.IronWithFolicNumberGiven3 = entry.IronWithFolicNumberGiven3;

                            foo.IronWithFolicDateGiven4   = entry.IronWithFolicDateGiven4;
                            foo.IronWithFolicNumberGiven4 = entry.IronWithFolicNumberGiven4;

                            foo.IronWithFolicDateGiven5   = entry.IronWithFolicDateGiven5;
                            foo.IronWithFolicNumberGiven5 = entry.IronWithFolicNumberGiven5;

                            foo.IronWithFolicDateGiven6   = entry.IronWithFolicDateGiven6;
                            foo.IronWithFolicNumberGiven6 = entry.IronWithFolicNumberGiven6;

                            foo.DateSTITested     = entry.DateSTITested;
                            foo.DateSTIResult     = entry.DateSTIResult;
                            foo.DateSTIPenicillin = entry.DateSTIPenicillin;

                            foo.PregnancyDateTerminated = entry.PregnancyDateTerminated;
                            foo.PregnancyOutcome        = entry.PregnancyOutcome;
                            foo.PregnancyGender         = entry.PregnancyGender;

                            foo.BirthWeight           = entry.BirthWeight;
                            foo.PlaceOfHealthFacility = entry.PlaceOfHealthFacility;
                            foo.PlaceOfNIO            = entry.PlaceOfNIO;
                            foo.AttendedBy            = entry.AttendedBy;

                            foo.Remarks = entry.Remarks;
                        }
                    }
                }

                await _appDbContext.SaveChangesAsync();

                return(Ok());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.ToString()));
            }
        }
Exemple #3
0
        public async Task <IActionResult> UploadAll([FromBody] UploadForm1Info info)
        {
            try
            {
                var items = info.Items;

                foreach (var item in items)
                {
                    var frm = await _appDbContext.TCL_FPs.FirstOrDefaultAsync(p => p.TCL_FPId == item.TCL_FPId);

                    if (frm == null)
                    {
                        if (item.LastUploaded == null)
                        {
                            item.LastUploaded = DateTime.UtcNow;
                        }

                        _appDbContext.Add(item);
                    }
                    else
                    {
                        frm.Barangay     = item.Barangay;
                        frm.Municipality = item.Municipality;
                        frm.Province     = item.Province;
                        frm.Region       = item.Region;
                        frm.LastUploaded = DateTime.UtcNow;
                    }

                    foreach (var entry in item.Entries)
                    {
                        var foo = await _appDbContext.TCL_FP_Entries.FirstOrDefaultAsync(p => p.TCL_FP_EntryId == entry.TCL_FP_EntryId);

                        if (foo == null)
                        {
                            _appDbContext.Add(entry);
                        }
                        else
                        {
                            foo.DateOfRegistration = entry.DateOfRegistration;
                            foo.FamilySerialNumber = entry.FamilySerialNumber;
                            foo.Name    = entry.Name;
                            foo.Address = entry.Address;

                            foo.BirthDate = entry.BirthDate;

                            foo.TypeOfClient = entry.TypeOfClient;

                            foo.PresentMethod  = entry.PresentMethod;
                            foo.PreviousMethod = entry.PreviousMethod;

                            foo.DateNextService1         = entry.DateNextService1;
                            foo.DateAccomplishedService1 = entry.DateAccomplishedService1;

                            foo.DateNextService2         = entry.DateNextService2;
                            foo.DateAccomplishedService2 = entry.DateAccomplishedService2;

                            foo.DateNextService3         = entry.DateNextService3;
                            foo.DateAccomplishedService3 = entry.DateAccomplishedService3;

                            foo.DateNextService4         = entry.DateNextService4;
                            foo.DateAccomplishedService4 = entry.DateAccomplishedService4;

                            foo.DateNextService5         = entry.DateNextService5;
                            foo.DateAccomplishedService5 = entry.DateAccomplishedService5;

                            foo.DateNextService6         = entry.DateNextService6;
                            foo.DateAccomplishedService6 = entry.DateAccomplishedService6;

                            foo.DateNextService7         = entry.DateNextService7;
                            foo.DateAccomplishedService7 = entry.DateAccomplishedService7;

                            foo.DateNextService8         = entry.DateNextService8;
                            foo.DateAccomplishedService8 = entry.DateAccomplishedService8;

                            foo.DateNextService9         = entry.DateNextService9;
                            foo.DateAccomplishedService9 = entry.DateAccomplishedService9;

                            foo.DateNextService10         = entry.DateNextService10;
                            foo.DateAccomplishedService10 = entry.DateAccomplishedService10;

                            foo.DateNextService11         = entry.DateNextService11;
                            foo.DateAccomplishedService11 = entry.DateAccomplishedService11;

                            foo.DateNextService12         = entry.DateNextService12;
                            foo.DateAccomplishedService12 = entry.DateAccomplishedService12;

                            foo.DropoutDate   = entry.DropoutDate;
                            foo.DropoutReason = entry.DropoutReason;

                            foo.Remarks = entry.Remarks;
                        }
                    }
                }

                await _appDbContext.SaveChangesAsync();

                return(Ok());
            }
            catch (Exception ex)
            {
                return(BadRequest(ex.ToString()));
            }
        }