コード例 #1
0
ファイル: HomeController.cs プロジェクト: cruzmv/petgree
        //public Util.Config config = new Util.Config();
        public ActionResult Index()
        {
            //List<Cats> gatos = listCats();
            //ViewBag.lastCats = gatos;

            List <Cats> cats = new List <Cats>();
            pgsql       conn = new pgsql();

            conn.host     = "localhost";
            conn.userName = "******";
            conn.password = "******";
            conn.database = "petgree";
            if (conn.open())
            {
                cats = conn.sqlListCats("limit 5");
            }

            ViewBag.lastCats = cats;
            //config.SetConfig();

            List <Person> contacts = new List <Person>();

            conn.host     = "localhost";
            conn.userName = "******";
            conn.password = "******";
            conn.database = "petgree";
            if (conn.open())
            {
                contacts = conn.sqlListPerson("limit 5");
            }


            ViewBag.lastPeoples = contacts;

            /*
             * var resxFile = @"C:\Onys\Petgree\lab\template\sbadmin\sb-admin-2-bootstrap-template-asp-mvc\sb-admin-2.Web\Resources\petgree.resx";
             * using (ResXResourceReader resxReader = new ResXResourceReader(resxFile))
             * {
             *  foreach (DictionaryEntry entry in resxReader)
             *  {
             *      Console.WriteLine( (string)entry.Key );
             *      //if (((string)entry.Key).StartsWith("EarlyAuto"))
             *      //    autos.Add((Automobile)entry.Value);
             *      //else if (((string)entry.Key).StartsWith("Header"))
             *      //    headers.Add((string)entry.Key, (string)entry.Value);
             *  }
             * }
             */



            return(View());
        }
コード例 #2
0
        public JsonResult delProperties(string key, int id)
        {
            bool  ret  = false;
            pgsql conn = new pgsql();

            if (conn.open())
            {
                ret = conn.sqlDeleteProperties(key, id);
            }

            return(Json(ret));
        }
コード例 #3
0
        public JsonResult listProperties(string key)
        {
            List <cat_general_sigla> props = new List <cat_general_sigla>();
            pgsql conn = new pgsql();

            if (conn.open())
            {
                props = conn.sqlListProperties(key);
            }

            return(Json(props));
        }
コード例 #4
0
        public JsonResult listRace()
        {
            List <cat_general_sigla> races = new List <cat_general_sigla>();
            pgsql conn = new pgsql();

            if (conn.open())
            {
                races = conn.sqlListRace();
            }

            return(Json(races));
        }
コード例 #5
0
        public JsonResult pedigree(int id)
        {
            Pedigree pedigree = new Pedigree();
            pgsql    conn     = new pgsql();

            if (conn.open())
            {
                pedigree = conn.sqlPedigree(id);
            }

            return(Json(pedigree));
        }
コード例 #6
0
        public JsonResult saveCat(Cats cat)
        {
            bool  catSaved = false;
            pgsql conn     = new pgsql();

            if (conn.open())
            {
                catSaved = conn.sqlSaveCat(cat);
            }

            return(Json(catSaved));
        }
コード例 #7
0
        public JsonResult peopleProfile(int id)
        {
            Person contact = new Person();
            pgsql  conn    = new pgsql();

            if (conn.open())
            {
                contact = conn.sqlPersonProfile(id);
            }

            return(Json(contact));
        }
コード例 #8
0
        public JsonResult listContacts(string key)
        {
            List <Person> contacts = new List <Person>();
            pgsql         conn     = new pgsql();

            if (conn.open())
            {
                contacts = conn.sqlListPerson(key);
            }

            return(Json(contacts));
        }
コード例 #9
0
        public JsonResult saveProperties(string key, int id, string description, string sigla, bool edit)
        {
            bool  ret  = false;
            pgsql conn = new pgsql();

            if (conn.open())
            {
                ret = conn.sqlSaveProperties(key, id, description, sigla, edit);
            }

            return(Json(ret));
        }
コード例 #10
0
        public JsonResult savePerson(Person person)
        {
            bool  ret  = false;
            pgsql conn = new pgsql();

            if (conn.open())
            {
                ret = conn.savePerson(person);
            }

            return(Json(ret));
        }
コード例 #11
0
        /*
         * public ActionResult CatCard(int id)
         * {
         *
         *  ViewBag.Catcard_id = id;
         *  return View();
         *
         * }
         */

        private Cats findACatById(int id)
        {
            Cats  cat  = null;
            pgsql conn = new pgsql();

            if (conn.open())
            {
                cat = conn.sqlCat(id);
            }


            return(cat);
        }
コード例 #12
0
        public string listCats()
        {
            List <Cats> cats = new List <Cats>();
            pgsql       conn = new pgsql();

            if (conn.open())
            {
                cats = conn.sqlListCats("");
            }

            var serializer = new JavaScriptSerializer();

            serializer.MaxJsonLength = Int32.MaxValue;
            return(serializer.Serialize(cats));;
        }
コード例 #13
0
        // GET: Pedigree
        public ActionResult Index(int id)
        {
            Pedigree pedigree = new Pedigree();
            pgsql    conn     = new pgsql();

            if (conn.open())
            {
                pedigree = conn.sqlPedigree(id);
            }
            ViewBag.pedigree = pedigree;

            //return Json(pedigree);

            return(View());
        }