Exemplo n.º 1
0
        public async Task <IActionResult> Edit(int id, [Bind("AgencyTypeId,AgencyType1")] AgencyType agencyType)
        {
            if (id != agencyType.AgencyTypeId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(agencyType);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AgencyTypeExists(agencyType.AgencyTypeId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(agencyType));
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(Guid id, [Bind("AgencyTypeId,AgencyName,Comment,AuthorizationId,GbvCaseId,Islessthan18,IsSigned,UserName,LastUpdate,InsertDate")] Authorization authorization)
        {
            if (id != authorization.GbvCaseId)
            {
                return(NotFound());
            }
            var item = await _context.Authorization.Include(m => m.GbvCase).AsNoTracking()
                       .SingleOrDefaultAsync(m => m.GbvCase.GbvCaseId == id && m.GbvCase.UserName.Equals(User.Identity.Name));

            if (item == null)
            {
                return(NotFound());
            }
            if (ModelState.IsValid)
            {
                try
                {
                    var sub = _context.AuthorizationSub.SingleOrDefault(m => m.AuthorizationId == item.AuthorizationId);
                    if (sub == null)
                    {
                        var newSub = new AuthorizationSub();
                        newSub.AgencyTypeId    = authorization.AgencyTypeId;
                        newSub.AgencyName      = authorization.AgencyName;
                        newSub.Comment         = authorization.Comment;
                        newSub.AuthorizationId = authorization.AuthorizationId;
                        _context.AuthorizationSub.Add(newSub);
                        await _context.SaveChangesAsync();
                    }
                    else
                    {
                        sub.AgencyTypeId = authorization.AgencyTypeId;
                        sub.AgencyName   = authorization.AgencyName;
                        sub.Comment      = authorization.Comment;
                    }
                    item.GbvCase.LastUpdate = DateTime.Now;
                    _context.Update(authorization);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!AuthorizationExists(authorization.AuthorizationId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("edit", authorization.GbvCaseId));
            }
            return(View(authorization));
        }
Exemplo n.º 3
0
        public async Task <IActionResult> Edit(string id, [Bind("Id,Name")] Tenant item)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(item);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    throw;
                }
                return(RedirectToAction("Index"));
            }

            return(View(item));
        }
Exemplo n.º 4
0
        public async Task <IActionResult> Edit(int id, [Bind("FacilityId,User,ActiveStatus,DateEstablished,DistCode,FacilityName,FacilityNameDari,FacilityNamePashto,FacilityType,Gpslattitude,Gpslongtitude,Implementer,Lat,Location,LocationDari,LocationPashto,Lon,SubImplementer,ViliCode")] FacilityInfo facilityInfo)
        {
            if (id != facilityInfo.FacilityId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(facilityInfo);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FacilityInfoExists(facilityInfo.FacilityId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }

            var users = _db.Users.Where(m => m.Active.Equals(true)).Select(m => new ApplicationUser()
            {
                FirstName = m.FirstName + " " + m.LastName + "-" + m.UserName,
                UserName  = m.UserName,
            }).ToList();

            ViewData["User"] = new SelectList(users, "UserName", "FirstName", facilityInfo.User);

            ViewData["DistCode"] = new SelectList(_context.Districts, "DistCode", "DistName", facilityInfo.DistCode);
            return(View(facilityInfo));
        }
Exemplo n.º 5
0
        public async Task <IActionResult> Edit(Guid?id, [Bind("RegistrationId,GbvCaseId,RptYear,RptMonth,IsIdp,TypeOfViolence,GbvHistory,RefIn,RefOut,ServiceMedical,ServicePsycho,ServiceRefLegal,ServiceRefSafeHouse,Remarks")] Registration registration)
        {
            if (id != registration.GbvCaseId)
            {
                return(NotFound());
            }

            var item = await _context.Registration.Include(m => m.GbvCase).AsNoTracking().SingleOrDefaultAsync(m => m.GbvCaseId == id && m.GbvCase.UserName.Equals(User.Identity.Name));

            if (item == null)
            {
                return(NotFound());
            }
            if (ModelState.IsValid)
            {
                try
                {
                    item.GbvCase.LastUpdate = DateTime.Now;
                    _context.Update(registration);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!RegistrationExists(registration.RegistrationId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("edit", new { Guid = registration.GbvCaseId }));
            }
            return(View(registration));
        }
Exemplo n.º 6
0
        public async Task <IActionResult> Edit(Guid?id, [Bind("ConsentId,GbvCaseId,PhysicalExams,PelvicExams,SpeculumExams,OtherExams,BloodExams,ProvisionOfInfo")] Consent consent)
        {
            if (id != consent.GbvCaseId)
            {
                return(NotFound());
            }
            var item = await _context.Consent.Include(m => m.GbvCase).AsNoTracking().SingleOrDefaultAsync(m => m.GbvCaseId == id && m.GbvCase.UserName.Equals(User.Identity.Name));

            if (item == null)
            {
                return(NotFound());
            }
            if (ModelState.IsValid)
            {
                try
                {
                    item.GbvCase.LastUpdate = DateTime.Now;
                    _context.Update(consent);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ConsentExists(consent.ConsentId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Edit", new { Guid = consent.GbvCaseId }));
            }
            ViewData["GbvCaseId"] = new SelectList(_context.GbvCase, "GbvCaseId", "GbvCaseId", consent.GbvCaseId);
            return(View(consent));
        }
Exemplo n.º 7
0
        public async Task <IActionResult> Edit(Guid id, [Bind("formtype,IntakeInfoId,GbvCaseId,ReferredBy,RefOther,ExamDate,ExamTime,IncDate,IncTime,IncLocation,IncLocationOther,IncType,IncReportToOther,Relationship,NoOfPerpetrators,PerpetratorOccupation,OccupationOther,AgeGroup,StiStatus,HcvHbs,EvidenceOfPregnancy,PregnancyWeeks,Results,ResultsOther,PsychologicalStatus,ExaminedForAids,SstPrevenMed,MedForInjuries,VacForTreat,ReferToPsychosocial,ReferToHigherMedical,YesBetterFacilities,YesFpservices,YesVaccination,YesConsulation,YesVct,YesPregnancyTest,YesOther,NoServiceProvided,NoServiceAccepted,NoServiceAvailable,RefFpcenter,Mowadowa,Aihrc,SafeHouse,BackHome,Other,OtherSpecify,RefNotAvailable,RefNotAccepted,IsSurvivorWilling,EvidenceCollected,MedicalCertificate,Appointment,MedExamProcedure,ConsentTaken,SpreadInfo")] IntakeInfo info)
        {
            if (id != info.GbvCaseId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                var item = _context.IntakeInfo.Where(m => m.GbvCaseId.Equals(info.GbvCaseId)).Include(m => m.GbvCase).AsNoTracking().SingleOrDefault();
                if (!item.GbvCase.UserName.Equals(User.Identity.Name))
                {
                    return(NotFound());
                }
                if (info.formtype == 1)
                {
                    item.ReferredBy = info.ReferredBy;
                    item.RefOther   = info.RefOther;
                    item.ExamDate   = info.ExamDate;
                    item.ExamTime   = info.ExamTime;
                }
                if (info.formtype == 2)
                {
                    item.IncLocation      = info.IncLocation;
                    item.IncType          = info.IncType;
                    item.IncLocationOther = info.IncLocationOther;
                    item.IncReportToOther = info.IncReportToOther;
                    item.IncDate          = info.IncDate;
                    item.IncTime          = info.IncTime;
                }
                if (info.formtype == 3)
                {
                    item.Relationship          = info.Relationship;
                    item.NoOfPerpetrators      = info.NoOfPerpetrators;
                    item.PerpetratorOccupation = info.PerpetratorOccupation;
                    item.OccupationOther       = info.OccupationOther;
                }
                if (info.formtype == 4)
                {
                    item.AgeGroup            = info.AgeGroup;
                    item.StiStatus           = info.StiStatus;
                    item.HcvHbs              = info.HcvHbs;
                    item.EvidenceOfPregnancy = info.EvidenceOfPregnancy;
                    item.PregnancyWeeks      = info.PregnancyWeeks;
                    item.Results             = info.Results;
                    item.ResultsOther        = info.ResultsOther;
                    item.PsychologicalStatus = info.PsychologicalStatus;
                    item.ExaminedForAids     = info.ExaminedForAids;
                }
                if (info.formtype == 5)
                {
                    item.SstPrevenMed   = info.SstPrevenMed;
                    item.MedForInjuries = info.MedForInjuries;
                    item.VacForTreat    = info.VacForTreat;
                }
                if (info.formtype == 6)
                {
                    item.ReferToPsychosocial  = info.ReferToPsychosocial;
                    item.ReferToHigherMedical = info.ReferToHigherMedical;
                    item.YesBetterFacilities  = info.YesBetterFacilities;
                    item.YesFpservices        = info.YesFpservices;
                    item.YesVaccination       = info.YesVaccination;
                    item.YesConsulation       = info.YesConsulation;
                    item.YesVct             = info.YesVct;
                    item.YesPregnancyTest   = info.YesPregnancyTest;
                    item.YesOther           = info.YesOther;
                    item.NoServiceProvided  = info.NoServiceProvided;
                    item.NoServiceAvailable = info.NoServiceAvailable;
                    item.NoServiceAccepted  = info.NoServiceAccepted;
                }
                if (info.formtype == 7)
                {
                    item.RefFpcenter        = info.RefFpcenter;
                    item.Mowadowa           = info.Mowadowa;
                    item.Aihrc              = info.Aihrc;
                    item.SafeHouse          = info.SafeHouse;
                    item.BackHome           = info.BackHome;
                    item.Other              = info.Other;
                    item.RefNotAvailable    = info.RefNotAvailable;
                    item.RefNotAccepted     = info.RefNotAccepted;
                    item.OtherSpecify       = info.OtherSpecify;
                    item.IsSurvivorWilling  = info.IsSurvivorWilling;
                    item.EvidenceCollected  = info.EvidenceCollected;
                    item.MedicalCertificate = info.MedicalCertificate;
                    item.Appointment        = info.Appointment;
                    item.MedExamProcedure   = info.MedExamProcedure;
                    item.ConsentTaken       = info.ConsentTaken;
                    item.SpreadInfo         = info.SpreadInfo;
                }
                try
                {
                    item.GbvCase.LastUpdate = DateTime.Now;
                    _context.Update(item);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!IntakeInfoExists(info.IntakeInfoId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(Ok("success"));
            }
            return(View(info));
        }