Пример #1
0
        public ActionResult Edit([Bind(Include = "SinisterId,Clientid,SiteId,SinisterTypeId,ActivitySectorId,CountryId,DestructionLevelId,CurrencyId,LoBId,UserId,Consequence,FileOrigine,FileName,AggravatingFactor,Amount,CreateDate,EditDate,KeyWord,CreateUserId,EditUserId,DocumentId,SinisterStatusId,SinisterKeywords")] Sinisters sinisters)
        {
            if (ModelState.IsValid)
            {
                sinisters.SinisterId   = sinId;
                sinisters.CreateDate   = dt;
                sinisters.CreateUserId = uid;
                sinisters.EditDate     = DateTime.Now;
                sinisters.EditUserId   = 1;

                if (sinisters.SinisterStatusId == null)
                {
                    sinisters.SinisterStatusId = statusId;
                }

                db.Entry(sinisters).State = EntityState.Modified;
                db.SaveChanges();
                return(RedirectToAction("Edit"));
            }
            //ViewBag.ActivitySectorId = new SelectList(db.ActivitySectors, "ActivitySectorId", "Name", sinisters.ActivitySectorId);
            //ViewBag.Clientid = new SelectList(db.Clients, "ClientId", "Code", sinisters.Clientid);
            //ViewBag.CountryId = new SelectList(db.Countries, "CountryId", "Code", sinisters.CountryId);
            //ViewBag.CurrencyId = new SelectList(db.Currencies, "CurrencyId", "Name", sinisters.CurrencyId);
            //ViewBag.DestructionLevelId = new SelectList(db.DestructionLevels, "DestructionLevelId", "Name", sinisters.DestructionLevelId);
            //ViewBag.DocumentId = new SelectList(db.Documents, "DocumentId", "Name", sinisters.DocumentId);
            //ViewBag.SinisterStatusId = new SelectList(db.SinisterStatus, "SinisterStatusId", "Name", sinisters.SinisterStatusId);
            //ViewBag.SinisterTypeId = new SelectList(db.SinisterTypes, "SinisterTypeId", "Name", sinisters.SinisterTypeId);
            //ViewBag.SiteId = new SelectList(db.Sites, "SiteId", "Code", sinisters.SiteId);
            //ViewBag.UserId = new SelectList(db.Users, "Userid", "EmployeeID", sinisters.CreateUserId);
            return(View(sinisters));
        }
Пример #2
0
        // GET: Sinisters/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Sinisters sinisters = db.Sinisters.Find(id);

            var createUser = (from cu in db.Users
                              where cu.Userid == sinisters.CreateUserId
                              select cu).FirstOrDefault();


            var editUser = (from eu in db.Users
                            where eu.Userid == sinisters.EditUserId
                            select eu).FirstOrDefault();

            sinisters.CompleteUserNameForCreate = createUser.LastName + " " + createUser.FirstName + " : " + sinisters.CreateDate;
            sinisters.CompleteUserNameForEdit   = editUser.LastName + " " + editUser.FirstName + " : " + sinisters.EditDate;
            sinisters.LobName = GetLobName((int)sinisters.LoBId);
            if (sinisters == null)
            {
                return(HttpNotFound());
            }
            return(View(sinisters));
        }
Пример #3
0
        public ActionResult DeleteConfirmed(int id)
        {
            Sinisters sinisters = db.Sinisters.Find(id);

            db.Sinisters.Remove(sinisters);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Пример #4
0
        // GET: Sinisters/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Sinisters sinisters = db.Sinisters.Find(id);

            if (sinisters == null)
            {
                return(HttpNotFound());
            }
            return(View(sinisters));
        }
Пример #5
0
        public ActionResult Search()
        {
            var vm = new Sinisters();

            vm.ListClient           = GetAllClient();
            vm.ListSite             = GetAllSite();
            vm.ListCountries        = GetAllCountries();
            vm.ListActivitySector   = GetAllActivitySectors();
            vm.ListCurrency         = GetAllCurrencies();
            vm.ListLob              = GetAllLobs();
            vm.ListSinisterType     = GetAllSinisterType();
            vm.ListDestructionLevel = GetAllDestructionLevels();

            return(View(vm));
        }
Пример #6
0
        public ActionResult Create([Bind(Include = "SinisterId,Clientid,SiteId,CountryId,LobId,SinisterTypeId,ActivitySectorId,DestructionLevelId,AggravatingFactor,CurrencyId,Amount,Consequence,FileOrigine,FileName,SinisterKeywords")] Sinisters s)
        //public ActionResult Create([Bind(Include = "ListClient")] SinisterViewModel sinisterVm)
        {
            if (ModelState.IsValid)
            {
                s.SinisterStatusId = 2;
                s.CreateDate       = DateTime.Now;
                s.CreateUserId     = 1;

                db.Sinisters.Add(s);
                db.SaveChanges();
                return(RedirectToAction("Create"));
            }
            return(RedirectToAction("Create"));
            //return View();
        }
Пример #7
0
        // GET: Sinisters/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Sinisters sinisters = db.Sinisters.Find(id);

            if (sinisters == null)
            {
                return(HttpNotFound());
            }

            sinId    = sinisters.SinisterId;
            dt       = (DateTime)sinisters.CreateDate;
            uid      = (int)sinisters.CreateUserId;
            statusId = (int)sinisters.SinisterStatusId;

            ViewBag.Clid                   = sinisters.Clientid;
            ViewBag.Sid                    = sinisters.SiteId;
            ViewBag.Crid                   = sinisters.CountryId;
            ViewBag.Lobid                  = sinisters.LoBId;
            ViewBag.Sntid                  = sinisters.SinisterTypeId;
            ViewBag.Actsectid              = sinisters.ActivitySectorId;
            ViewBag.Dlevelid               = sinisters.DestructionLevelId;
            ViewBag.consequence            = sinisters.Consequence;
            ViewBag.Aggrfactor             = sinisters.AggravatingFactor;
            ViewBag.Amt                    = sinisters.Amount.ToString();
            ViewBag.Filename               = sinisters.FileName;
            ViewBag.Fileorigine            = sinisters.FileOrigine;
            ViewBag.Statusid               = sinisters.SinisterStatusId;
            sinisters.ListClient           = GetAllClient();
            sinisters.ListSite             = GetAllSiteByClientId(sinisters.Clientid);
            sinisters.ListCountries        = GetCountriesByClientId(sinisters.Clientid);
            sinisters.ListActivitySector   = GetAllActivitySectors();
            sinisters.ListCurrency         = GetAllCurrencies();
            sinisters.ListLob              = GetAllLobs();
            sinisters.ListSinisterType     = GetAllSinisterTypeByLobId(sinisters.LoBId);
            sinisters.ListDestructionLevel = GetAllDestructionLevels();
            sinisters.ListSinisterStatus   = GetAllStatus();

            return(View(sinisters));
        }
Пример #8
0
        public ActionResult Search([Bind(Include = "Clientid,SiteId,SinisterTypeId,ActivitySectorId,CountryId,DestructionLevelId,CurrencyId,LoBId,SinisterStatusId,DateStart,DateEnd")] Sinisters sinisters)
        {
            DateTime dateStart = new DateTime();
            DateTime dateEnd   = new DateTime();
            int      cid       = 0;
            int      sid       = 0;
            int      crid      = 0;
            int      lid       = 0;
            int      stid      = 0;
            int      aid       = 0;
            int      did       = 0;

            if (ModelState.IsValid)
            {
                if (sinisters.Clientid != null)
                {
                    cid = (int)sinisters.Clientid;
                }
                if (sinisters.SiteId != null)
                {
                    sid = (int)sinisters.SiteId;
                }
                if (sinisters.CountryId != null)
                {
                    crid = (int)sinisters.CountryId;
                }
                if (sinisters.LoBId != null)
                {
                    lid = (int)sinisters.LoBId;
                }
                if (sinisters.SinisterTypeId != null)
                {
                    stid = (int)sinisters.SinisterTypeId;
                }
                if (sinisters.ActivitySectorId != null)
                {
                    aid = (int)sinisters.ActivitySectorId;
                }
                if (sinisters.DestructionLevelId != null)
                {
                    did = (int)sinisters.DestructionLevelId;
                }

                if (sinisters.DateStart != null)
                {
                    dateStart = (DateTime)sinisters.DateStart;
                }

                if (sinisters.DateEnd != null)
                {
                    dateEnd = (DateTime)sinisters.DateEnd;
                }


                listSinisters = GetSinistersSearch(cid, sid, crid, lid, stid, aid, did, dateStart.ToString(), dateEnd.ToString());

                TempData["listSinisters"] = listSinisters;
                return(RedirectToAction("SearchResult", "Sinisters"));
            }
            return(RedirectToAction("Search"));
        }