Exemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            string CurrentLoginID = User.Identity.GetUserId().ToString();
            var    usID101        = from s in db.agentsDbs where s.userID == CurrentLoginID select s.userType;
            int    usID102        = usID101.First();

            if (usID102 == 2)
            {
                agentsDb agentsDb = db.agentsDbs.Find(id);
                db.agentsDbs.Remove(agentsDb);
                db.SaveChanges();
                return(RedirectToAction("Index", "agents", new { projectID = 6, taskOrderID = 33, Int1 = 1 }));
            }
            else
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
        }
Exemplo n.º 2
0
        public ActionResult Edit([Bind(Include = "ID, agentID, agentDescription, userID, UserName, taskOrderID, createdDT, editedDT, createdByUserID, userType, agentName, orgStrL3ID, orgStrSubGrID, regid, divid, distid, acctid, titlid, workPhone, mobilePhone, DODID, a360, b360, orgStrL1ID, orgStrL2ID, passwordstring")] agentsDb agentsDb)
        {
            string CurrentLoginID = User.Identity.GetUserId().ToString();
            var    usID101        = from s in db.agentsDbs where s.userID == CurrentLoginID select s.userType;
            int    usID102        = usID101.First();

            if (usID102 == 2)
            {
                if (ModelState.IsValid)
                {
                    db.Entry(agentsDb).State = EntityState.Modified;
                    db.SaveChanges();
                    return(RedirectToAction("Index", "agents", new { projectID = 6, taskOrderID = 33, Int1 = 1 }));
                }
                return(View(agentsDb));
            }
            else
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
        }
Exemplo n.º 3
0
        // GET: agentsDbs/Delete/5
        public ActionResult Delete(int?id)
        {
            string CurrentLoginID = User.Identity.GetUserId().ToString();
            var    usID101        = from s in db.agentsDbs where s.userID == CurrentLoginID select s.userType;
            int    usID102        = usID101.First();

            if (usID102 == 2)
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }
                agentsDb agentsDb = db.agentsDbs.Find(id);
                if (agentsDb == null)
                {
                    return(HttpNotFound());
                }
                return(View(agentsDb));
            }
            else
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
        }
Exemplo n.º 4
0
        // GET: agentsDbs/Edit/5
        public ActionResult Edit(int?id)
        {
            string CurrentLoginID = User.Identity.GetUserId().ToString();
            var    usID101        = from s in db.agentsDbs where s.userID == CurrentLoginID select s.userType;
            int    usID102        = usID101.First();

            if (usID102 == 2)
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }

                agentsDb agentsDb = db.agentsDbs.Find(id);
                if (agentsDb == null)
                {
                    return(HttpNotFound());
                }

                ViewBag.taskOrdersDb102       = new SelectList(db.taskOrdersDbs, "ID", "taskOrder");
                ViewBag.userTypeDb102         = new SelectList(db.userTypeDbs, "ID", "userType");
                ViewBag.currentUserLoginID102 = User.Identity.GetUserId().ToString();
                ViewBag.currentTimeDate102    = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

                int ItR1 = dbv.agentsViewDbs.Where(s => s.ID == id).Select(s => s.orgStrL1ID).First();
                ViewBag.ItR1 = ItR1;

                var It02 = dbv.agentsViewDbs.Where(s => s.ID == id).Select(s => s.orgStrL3ID).First();

                int It03 = db.k2017orgStrL3Dbs.Where(s => s.ID == It02).Select(s => s.orgStrL2ID).First();
                ViewBag.ItR2 = It03;

                int It04 = db.k2017orgStrL2Dbs.Where(s => s.ID == It03).Select(s => s.orgStrL1ID).First();


                ViewBag.subg300 = new SelectList(db.k2017orgStrSubGrDbs.Where(s => s.ID == 1 || s.orgStrL2ID == It03)
                                                 .OrderBy(s => s.ID), "ID", "orgStrSubGr");

                ViewBag.titule2 = new SelectList(new[] {
                    new { Id = "0", Name = "-" },
                    new { Id = "1", Name = "DOD" },
                    new { Id = "2", Name = "OMD" },
                    new { Id = "3", Name = "OMH" }
                }, "Id", "Name");

                ViewBag.region2 = new SelectList(opb.dimRegionDbs.OrderBy(s => s.ID), "ID", "region").ToList();

                var        regid = db.agentsDbs.Where(s => s.ID == id).Select(s => s.regid).First();
                List <int> list1 = opa.DISTRICTSDbs.Where(s => s.regID == regid).Select(s => s.divID).Distinct().ToList();
                ViewBag.division2 = new SelectList(opb.dimDivisionDbs.Where(s => s.ID == 0 || list1.Contains(s.ID)).OrderBy(s => s.ID), "ID", "DivisionName").ToList();

                var divid = db.agentsDbs.Where(s => s.ID == id).Select(s => s.divid).First();
                ViewBag.district2 = new SelectList(opa.DISTRICTSDbs.Where(s => s.ID == 0 || s.divID == divid).Select(s => new { ID = s.ID, district = s.district }).OrderBy(s => s.ID), "ID", "district").ToList();

                ViewBag.stL1300 = new SelectList(db.k2017orgStrL1Dbs.OrderBy(s => s.ID), "ID", "orgStrL1").ToList();
                ViewBag.stL2300 = new SelectList(dbv.k2017orgStrL2ViewDbs.OrderBy(s => s.ID), "ID", "appDef").ToList();
                ViewBag.stL3300 = new SelectList(dbv.k2017orgStrL3ViewDbs.OrderBy(s => s.ID), "ID", "appDef").ToList();

                var distid              = db.agentsDbs.Where(s => s.ID == id).Select(s => s.distid).First();
                List <UHSACCTSDb> set1  = new List <UHSACCTSDb>();
                UHSACCTSDb        List1 = new UHSACCTSDb();
                List1.IDc   = 0;
                List1.CSTNM = "-";
                set1.Add(List1);

                var item2 = opa.UHSACCTSDbs.Where(s => s.DISTID == distid).OrderBy(s => s.ID).Select(s => new { IDc = s.IDc, CSTNM = s.CSTNM }).Distinct().ToList();
                foreach (var item in item2)
                {
                    UHSACCTSDb List2 = new UHSACCTSDb();
                    List2.IDc   = item.IDc;
                    List2.CSTNM = item.CSTNM;
                    set1.Add(List2);
                }
                ViewBag.account2 = new SelectList(set1.Select(s => new { ID = s.IDc, CSTNM = s.CSTNM }), "ID", "CSTNM").ToList();

                return(View(agentsDb));
            }
            else
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
        }