Esempio n. 1
0
        public ActionResult Guns(string first, string last)
        {
            List <gun> _list = TableUtils.queryToTable <gun>("SELECT * FROM shooters.Gun");
            Guns       model = new Guns();

            model._guns = _list;
            return(View(model));
            // return View();
        }
Esempio n. 2
0
        public ActionResult Shooter(string first, string last)
        {
            string       query     = "SELECT * FROM shooters.shooter";
            List <actor> _actors   = TableUtils.queryToTable <actor>(query);
            Shooters     _shooters = new Shooters();

            _shooters.Actors = _actors;
            return(View(_shooters));
        }
Esempio n. 3
0
        public ViewResult ShooterNoIncidents(int?page)
        {
            int pageSize   = 10;
            int pageNumber = (page ?? 1);

            string query     = "select * from shooters.shooter where first NOT IN (select first from shooters.incitingincident) AND last NOT IN (select last from shooters.incitingincident)";;
            var    _shooters = TableUtils.queryToTable <actor>(query);

            return(View(_shooters.ToPagedList(pageNumber, pageSize)));
        }
Esempio n. 4
0
        public ViewResult GunsNoType(int?page)
        {
            int pageSize   = 10;
            int pageNumber = (page ?? 1);

            string query = "select * from shooters.gun where gname NOT in (select gName from shooters.gun natural join shooters.gunTypeRel)";
            var    _guns = TableUtils.queryToTable <gun>(query);

            return(View(_guns.ToPagedList(pageNumber, pageSize)));
        }
Esempio n. 5
0
        public ActionResult ViewIncident(string first, string last)
        {
            List <incitingIncident> list = TableUtils.queryToTable <incitingIncident>("SELECT * FROM shooters.incitingIncident where first= '" + first + "' AND last = '" + last + "' order by iDate");
            var model = new Incidents()
            {
            };

            model._incidents = list;
            return(View(model));
        }
Esempio n. 6
0
        public ViewResult DeathRow(int?page)
        {
            int pageSize   = 10;
            int pageNumber = (page ?? 1);

            string query     = "select * from shooters.deathrowpop order by drState";
            var    _executed = TableUtils.queryToTable <deathrow>(query);

            return(View(_executed.ToPagedList(pageNumber, pageSize)));
        }
Esempio n. 7
0
        public ViewResult Executions(int?page)
        {
            int pageSize   = 6;
            int pageNumber = (page ?? 1);

            string query     = "select * from shooters.executed order by eDate";
            var    _executed = TableUtils.queryToTable <execution>(query);

            return(View(_executed.ToPagedList(pageNumber, pageSize)));
        }
Esempio n. 8
0
        public ViewResult MassShootings(int?page)
        {
            int pageSize   = 5;
            int pageNumber = (page ?? 1);

            string query          = "select * from shooters.massshootings order by mDate";
            var    _massShootings = TableUtils.queryToTable <massShooting>(query);

            return(View(_massShootings.ToPagedList(pageNumber, pageSize)));
        }
Esempio n. 9
0
        public ActionResult ViewShooterGuns(string first, string last)
        {
            actor _actor             = TableUtils.queryToObject <actor>("SELECT * FROM shooters.shooter where first= '" + first + "' AND last = '" + last + "'");
            List <gunPurchase> _list = TableUtils.queryToTable <gunPurchase>("SELECT * FROM shooters.gunPurchase where first= '" + first + "' AND last = '" + last + "'");

            ShooterGP model = new ShooterGP();

            model._actor = _actor;
            model._guns  = _list;
            return(View(model));
        }
Esempio n. 10
0
        public ViewResult GunPurchaseNoSeller(int?page)
        {
            int pageSize   = 10;
            int pageNumber = (page ?? 1);

            string query = "SELECT * FROM shooters.gunpurchase where sName is NULL";
            var    _gp   = TableUtils.queryToTable <gunPurchase>(query);

            // return View(_shooters);
            return(View(_gp.ToPagedList(pageNumber, pageSize)));
        }
Esempio n. 11
0
        public ActionResult EditGun(string gName)
        {
            gun     _gun = TableUtils.queryToObject <gun>("SELECT * FROM shooters.gun where gName= '" + gName + "'");
            GunSpec gs   = new GunSpec();

            gs._gun = _gun;
            List <gunType> _types = TableUtils.queryToTable <gunType>("SELECT * FROM shooters.gunTypeRel natural join shooters.gunType where gName= '" + gName + "'");

            gs._specs     = _types;
            ViewBag.gName = gName;
            return(View(gs));
        }
Esempio n. 12
0
        public ActionResult GunsAndSellers()
        {
            List <gun>       _list       = TableUtils.queryToTable <gun>("SELECT * FROM shooters.gun");
            List <gunSeller> _sellerList = TableUtils.queryToTable <gunSeller>("SELECT sName, count(sName) as sSold FROM shooters.gunSeller natural join shooters.gunPurchase group by sName");
            List <gunType>   _gunTypes   = TableUtils.queryToTable <gunType>("SELECT tId, tName, count(tName) as tNum FROM shooters.gunType natural join shooters.gunTypeRel group by tId, tName");
            GunsAndSellers   model       = new GunsAndSellers();

            model._guns    = _list;
            model._sellers = _sellerList;
            model._types   = _gunTypes;
            return(View(model));
        }
Esempio n. 13
0
        public ActionResult GunTypeAdd(string gName)
        {
            List <gunType> _curTypes = TableUtils.queryToTable <gunType>("SELECT * FROM shooters.gunType natural join shooters.gunTypeRel where gName = '" + gName + "'");
            List <gunType> _newTypes = TableUtils.queryToTable <gunType>("SELECT * FROM shooters.gunType");
            gun            _gun      = TableUtils.queryToObject <gun>("SELECT * FROM shooters.gun where gName = '" + gName + "'");
            GunTypeAdder   _tAdder   = new GunTypeAdder();

            _tAdder._currTypes = _curTypes;
            _tAdder._newTypes  = _newTypes;
            _tAdder._gun       = _gun;
            return(View(_tAdder));
        }
Esempio n. 14
0
        public ActionResult ViewRecord(string first, string last)
        {
            string query = "SELECT * FROM shooters.criminalRecord where first= '" + first + "' AND last = '" + last + "'";

            List <criminalRecord> _list   = TableUtils.queryToTable <criminalRecord>(query);
            CriminalRecords       records = new CriminalRecords();

            records._records = _list;
            records.first    = first;
            records.last     = last;
            return(View(records));
        }
Esempio n. 15
0
        public ViewResult ShooterWrongDates(int?page)
        {
            int pageSize   = 10;
            int pageNumber = (page ?? 1);

            string query = "SELECT * from shooters.shooter natural join shooters.massshootingrel natural join shooters.massshootings " +
                           "where (birth - death >= 0 OR birth is NULL or death is NULL) " +
                           "AND (last NOT IN (select last from shooters.deathrowpoprel) AND first NOT IN (select first from shooters.deathrowpoprel)) " +
                           "order by mdate asc";
            var _shooters = TableUtils.queryToTable <actorWithDate>(query);

            return(View(_shooters.ToPagedList(pageNumber, pageSize)));
        }
Esempio n. 16
0
        public ActionResult AddGunsToShooter(ShooterGuns _shooterGuns)
        {
            int              pageSize   = 10;
            int              pageNumber = 1;
            PagedList <gun>  _list      = new PagedList <gun>(TableUtils.queryToTable <gun>("SELECT * FROM shooters.gun where gDesc LIKE '%" + _shooterGuns._search + "%'"), pageNumber, pageSize);
            List <gunsOwned> _owned     = TableUtils.queryToTable <gunsOwned>("SELECT gName, gDesc, count(gName) as owned FROM shooters.gun natural join shooters.gunPurchase where first = '" + _shooterGuns._actorFirst + "' AND last = '" + _shooterGuns._actorLast + "' group by gName, gDesc");
            actor            _actor     = TableUtils.queryToObject <actor>("SELECT * FROM shooters.shooter where first= '" + _shooterGuns._actorFirst + "' AND last = '" + _shooterGuns._actorLast + "'");
            massShooting     ms         = TableUtils.queryToObject <massShooting>("select * from shooters.massshootings natural join shooters.massshootingrel where first = '" + _shooterGuns._actorFirst + "' AND last = '" + _shooterGuns._actorLast + "'");

            _shooterGuns._massShooting = ms;
            _shooterGuns._guns         = _list;
            _shooterGuns._gunsOwned    = _owned;
            _shooterGuns._actor        = _actor;
            return(View(_shooterGuns));
        }
Esempio n. 17
0
        public ActionResult AddGunsToShooter(string first, string last, int?page)
        {
            int              pageSize   = 10;
            int              pageNumber = page ?? 1;
            massShooting     ms         = TableUtils.queryToObject <massShooting>("select * from shooters.massshootings natural join shooters.massshootingrel where first = '" + first + "' AND last = '" + last + "'");
            PagedList <gun>  _list      = new PagedList <gun>(TableUtils.queryToTable <gun>("SELECT * FROM shooters.gun"), pageNumber, pageSize);
            List <gunsOwned> _owned     = TableUtils.queryToTable <gunsOwned>("SELECT gName, gDesc, count(gName) as owned FROM shooters.gun natural join shooters.gunPurchase where first = '" + first + "' AND last = '" + last + "' group by gName, gDesc");
            actor            _actor     = TableUtils.queryToObject <actor>("SELECT * FROM shooters.shooter where first= '" + first + "' AND last = '" + last + "'");
            ShooterGuns      model      = new ShooterGuns();

            model._actorFirst   = first;
            model._actorLast    = last;
            model._massShooting = ms;
            model._guns         = _list;
            model._gunsOwned    = _owned;
            model._actor        = _actor;
            return(View(model));
        }
Esempio n. 18
0
        public ActionResult CommitIncident(incitingIncident ii)
        {
            int uniqueKey = 0;

            List <incitingIncident> _list = TableUtils.queryToTable <incitingIncident>("SELECT * FROM shooters.IncitingIncident");
            Boolean uniqueI = false;

            while (uniqueI != true)
            {
                uniqueI = true;
                uniqueKey++;
                for (int k = 0; k < (_list.Count); k++)
                {
                    if (uniqueKey == _list[k].iKey)
                    {
                        uniqueI = false;
                    }
                }
            }

            ii.iKey = uniqueKey;

            NpgsqlConnection connection = new NpgsqlConnection(RouteConfig.connectString);

            connection.Open();

            NpgsqlCommand command = new NpgsqlCommand("Insert Into shooters.IncitingIncident (First, Last, iDate, iDescription, iKey) values('" + ii.first + "','" + ii.last + "','" + ii.iDate + "', @iDescription,'" + ii.iKey + "')", connection);

            command.Parameters.AddWithValue("@iDescription", ii.iDescription);
            int num = command.ExecuteNonQuery();

            connection.Close();
            if (num > 0)
            {
                ViewBag.Message = "Query Succesful : " + num + " rows created";
            }
            else
            {
                ViewBag.Message = "Query Unsucessful: ";
            }
            return(RedirectToAction("EditShooter", new { first = ii.first, last = ii.last }));
        }
Esempio n. 19
0
        public ActionResult ShooterCommitGun(string first, string last, string gunName)
        {
            int uniqueKey = 0;

            List <gunPurchase> _list   = TableUtils.queryToTable <gunPurchase>("SELECT * FROM shooters.gunPurchase");
            Boolean            uniqueI = false;

            while (uniqueI != true)
            {
                uniqueI = true;
                uniqueKey++;
                for (int k = 0; k < (_list.Count); k++)
                {
                    if (uniqueKey == _list[k].gpId)
                    {
                        uniqueI = false;
                    }
                }
            }
            string query = "insert into shooters.gunPurchase (first, last, gpId, gName) values ('" + first + "','" + last + "','" + uniqueKey + "','" + gunName + "')";

            setSuccess(QueryUtils.query(query));
            return(RedirectToAction("ViewShooterGuns", "Guns", new { first = first, last = last }));
        }
Esempio n. 20
0
        public ActionResult CommitNewSpec(NewSpec gt)
        {
            int uniqueKey = 0;

            List <gunType> _list   = TableUtils.queryToTable <gunType>("SELECT * FROM shooters.gunType");
            Boolean        uniqueI = false;

            while (uniqueI != true)
            {
                uniqueI = true;
                uniqueKey++;
                for (int k = 0; k < (_list.Count); k++)
                {
                    if (uniqueKey == _list[k].tId)
                    {
                        uniqueI = false;
                    }
                }
            }

            setSuccess(QueryUtils.query("insert into shooters.gunType (tName, tDesc, tId) values ('" + gt.tName + "','" + gt.tDesc + "','" + uniqueKey + "')"));
            setSuccess(QueryUtils.query("insert into shooters.gunTypeRel (gName, tId) values ('" + gt.gName + "','" + uniqueKey + "')"));
            return(RedirectToAction("EditGun", "Guns", new { gName = gt.gName }));
        }
Esempio n. 21
0
        public ActionResult SearchResults(string search)
        {
            List <actor> _actors = TableUtils.queryToTable <actor>(search);

            return(View(_actors));
        }