Exemple #1
0
        public async Task <IActionResult> Create([Bind("Sfpid,Active,AgeGroup")] TlkpSfp tlkpSfp)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tlkpSfp);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(tlkpSfp));
        }
        public async Task <IActionResult> Create([Bind("HfactiveStatusId,HfstatusDescription")] LkpHfstatus lkpHfstatus)
        {
            if (ModelState.IsValid)
            {
                _context.Add(lkpHfstatus);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(lkpHfstatus));
        }
        public async Task <IActionResult> Create([Bind("FacTypeCode,FacType,FacTypeCatCode,FacTypeDari,FacTypePashto,TypeAbbrv")] FacilityTypes facilityTypes)
        {
            if (ModelState.IsValid)
            {
                _context.Add(facilityTypes);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(facilityTypes));
        }
Exemple #4
0
        public async Task <IActionResult> Create([Bind("StockId,Active,DistAmountKg,Item,Buffer,Zarib")] TlkpFstock tlkpFstock)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tlkpFstock);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(tlkpFstock));
        }
        public async Task <IActionResult> Create([Bind("Mnid,Active,Mnitems")] TlkpMn tlkpMn)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tlkpMn);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(tlkpMn));
        }
Exemple #6
0
        public async Task <IActionResult> Create([Bind("Iycfid,Active,CauseConsultation,CauseShortName")] TlkpIycf tlkpIycf)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tlkpIycf);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(tlkpIycf));
        }
Exemple #7
0
        public async Task <IActionResult> Create([Bind("SstockId,Active,Item,Persachet,Buffer,IPDSAMZarib,OPDSAMZarib")] TlkpSstock tlkpSstock)
        {
            if (ModelState.IsValid)
            {
                _context.Add(tlkpSstock);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(tlkpSstock));
        }
Exemple #8
0
        public async Task <IActionResult> Create([Bind("ProvCode,CreatedDate,ProvName,ProveNameDari,ProveNamePashto,AGHCHOCode,AIMSCode")] Provinces provience)
        {
            if (ModelState.IsValid)
            {
                provience.CreatedDate = DateTime.Now;
                _context.Add(provience);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(provience));
        }
 public async Task <IActionResult> Create([Bind("ImpCode,AfghanistanAddress,ImpAcronym,ImpName,ImpNameDari,ImpNamePashto,ImpStatus,OtherAddress,RegistrationDate")] Implementers implementers)
 {
     if (ModelState.IsValid)
     {
         _context.Add(implementers);
         try
         {
             await _context.SaveChangesAsync();
         }
         catch (DbUpdateException)
         {
             ModelState.AddModelError(String.Empty, "Something went wrong maybe this id already exists.");
             return(View(implementers));
         }
         return(RedirectToAction("Index"));
     }
     return(View(implementers));
 }
        public async Task <IActionResult> Create([Bind("Nmrid,Message")] Feedback item)
        {
            if (ModelState.IsValid)
            {
                var user = User.Identity.Name;
                item.CommentedBy = user;
                item.CommentDate = DateTime.Now;
                _context.Add(item);
                await _context.SaveChangesAsync();

                if (User.IsInRole("administrator"))
                {
                    return(RedirectToAction("adminnmr", "nmr", new { nmrid = item.Nmrid }));
                }
                return(RedirectToAction("Index", new { nmrid = item.Nmrid }));
            }
            return(View());
        }
Exemple #11
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"));
            }
            var items = _context.Provinces.Select(s => new
            {
                ProvCode    = s.ProvCode,
                description = string.Format("{0} - {1}", s.ProvCode, s.ProvName)
            });

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

                return(RedirectToAction("Index"));
            }
            var items = _context.FacilityTypes.Select(s => new
            {
                FacTypeCode = s.FacTypeCode,
                description = string.Format("{0} - {1}", s.FacTypeCatCode, s.FacType)
            });
            var imps = _context.Implementers.ToList();

            ViewData["fac"]       = new SelectList(items, "FacTypeCode", "description");
            ViewData["imps"]      = new SelectList(imps, "ImpAcronym", "ImpAcronym");
            ViewData["Districts"] = new SelectList(_context.Districts, "DistCode", "DistName");
            return(View(facilityInfo));
        }
Exemple #13
0
        public async Task <IActionResult> Create([Bind("Nmrid,Commen,FacilityId,Flanumber,HfactiveStatusId,Month,OpeningDate,PreparedBy,UpdateDate,UserName,Year,isHumanitarian,mYear,mMonth,FacilityType")] Nmr nmr)
        {
            var FacType = (from f in _context.FacilityInfo
                           where f.FacilityId == nmr.FacilityId
                           select f).FirstOrDefault();
            var fac = _context.FacilityInfo.Where(m => m.FacilityId.Equals(nmr.FacilityId)).SingleOrDefault();
            List <Provinces> provinces = new List <Provinces>();

            if (ModelState.IsValid)
            {
                var user = await _userManager.FindByNameAsync(User.Identity.Name);

                nmr.OpeningDate = DateTime.Now;
                nmr.Nmrid       = String.Format("{0}-{1}-{2}", nmr.FacilityId, nmr.Year, nmr.Month);
                nmr.UserName    = User.Identity.Name;
                nmr.Implementer = fac.Implementer;
                nmr.StatusId    = 1;
                nmr.Tenant      = user.TenantId;
                if (nmr.Month < 10)
                {
                    nmr.mYear  = (nmr.Year + 621);
                    nmr.mMonth = (nmr.Month + 3);
                }
                else if (nmr.Month > 9)
                {
                    nmr.mYear  = (nmr.Year + 622);
                    nmr.mMonth = (nmr.Month - 9);
                }
                nmr.FacilityType = FacType.FacilityType;
                _context.Add(nmr);
                try
                {
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateException)
                {
                    ModelState.AddModelError(String.Empty, "Only one report per month is allowed.");
                    provinces = (from prov in _context.Provinces select prov).ToList();
                    provinces.Insert(0, new Provinces {
                        ProvCode = "0", ProvName = "select"
                    });
                    ViewData["ProvList"]         = new SelectList(provinces, "ProvCode", "ProvName");
                    ViewData["FacilityId"]       = new SelectList(_context.FacilityInfo, "FacilityId", "FacilityName");
                    ViewData["HfactiveStatusId"] = new SelectList(_context.LkpHfstatus, "HfactiveStatusId", "HfstatusDescription");
                    return(View(nmr));
                }

                return(RedirectToAction("questions", new { id = nmr.Nmrid }));
            }
            provinces = (from prov in _context.Provinces select prov).ToList();
            provinces.Insert(0, new Provinces {
                ProvCode = "0", ProvName = "select"
            });
            ViewData["ProvList"]   = new SelectList(provinces, "ProvCode", "ProvName");
            ViewData["FacilityId"] = new SelectList(_context.FacilityInfo, "FacilityId", "FacilityId", nmr.FacilityId);
            var implementers = (from imp in _context.Implementers select imp).ToList();

            implementers.Insert(0, new Implementers {
                ImpAcronym = " ", ImpName = "select"
            });
            ViewData["Implementers"]     = new SelectList(implementers, "ImpAcronym", "ImpAcronym");
            ViewData["HfactiveStatusId"] = new SelectList(_context.LkpHfstatus, "HfactiveStatusId", "HfactiveStatusId", nmr.HfactiveStatusId);
            return(View(nmr));
        }