Beispiel #1
0
        public async Task <IActionResult> Create([Bind("ItrCode,HospitalId,RegNo,PatientName,PatientFatherName,Age,Sex,Address,MaritalStatus,RefDate,RefTime")] GbvCase gbvCase)
        {
            if (ModelState.IsValid)
            {
                gbvCase.PatientName       = _crypto.Encrypt(gbvCase.PatientName);
                gbvCase.PatientFatherName = _crypto.Encrypt(gbvCase.PatientFatherName);
                gbvCase.GbvCaseId         = Guid.NewGuid();
                gbvCase.UserName          = User.Identity.Name;
                gbvCase.IncCode           = String.Format("{0}-{1}", gbvCase.HospitalId, gbvCase.RegNo);
                gbvCase.InsertDate        = DateTime.Now;
                gbvCase.LastUpdate        = DateTime.Now;
                _context.Add(gbvCase);
                var consent = new Consent();
                consent.GbvCaseId = gbvCase.GbvCaseId;
                _context.Add(consent);
                var reg = new Registration();
                reg.GbvCaseId = gbvCase.GbvCaseId;
                _context.Add(reg);
                var intake = new IntakeInfo();
                intake.GbvCaseId = gbvCase.GbvCaseId;
                _context.Add(intake);
                var auth = new Authorization();
                auth.GbvCaseId = gbvCase.GbvCaseId;
                _context.Add(auth);
                await _context.SaveChangesAsync();

                return(RedirectToAction("edit", "consents", new { id = gbvCase.GbvCaseId }));
            }
            var facilities = _context.FacilityInfo.Where(m => m.User.Equals(User.Identity.Name)).ToList();

            ViewData["HospitalId"] = new SelectList(facilities, "FacilityId", "FacilityName", gbvCase.HospitalId);
            return(View(gbvCase));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("AgencyTypeId,AgencyType1")] AgencyType agencyType)
        {
            if (ModelState.IsValid)
            {
                _context.Add(agencyType);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(agencyType));
        }
Beispiel #3
0
        public async Task <IActionResult> Create([Bind("ProvCode,Aghchocode,Aimscode,ProvName,ProveNameDari,ProveNamePashto")] Provinces province)
        {
            if (ModelState.IsValid)
            {
                province.CreatedDate = DateTime.Now;
                _context.Add(province);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(province));
        }
Beispiel #4
0
        public async Task <IActionResult> Create([Bind("DistCode,DistName,DistNameDari,DistNamePashto,ProvCode")] Districts districts)
        {
            if (ModelState.IsValid)
            {
                districts.CreatedDate = DateTime.Now;
                _context.Add(districts);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            ViewData["ProvCode"] = new SelectList(_context.Provinces, "ProvCode", "ProvName", districts.ProvCode);
            return(View(districts));
        }
Beispiel #5
0
        public async Task <IActionResult> Create([Bind("User,FacilityId,ActiveStatus,DateEstablished,DistCode,FacilityName,FacilityNameDari,FacilityNamePashto,FacilityType,Gpslattitude,Gpslongtitude,Implementer,Lat,Location,LocationDari,LocationPashto,Lon,SubImplementer,ViliCode")] FacilityInfo facilityInfo)
        {
            if (ModelState.IsValid)
            {
                _context.Add(facilityInfo);
                await _context.SaveChangesAsync();

                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));
        }