Exemplo n.º 1
0
        public ActionResult DeleteConfirmed(int id)
        {
            ADA aDA = db.ADAs.Find(id);

            db.ADAs.Remove(aDA);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
 public ActionResult Edit([Bind(Include = "adaid,adaname")] ADA aDA)
 {
     if (ModelState.IsValid)
     {
         db.Entry(aDA).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(aDA));
 }
Exemplo n.º 3
0
        public ActionResult Create([Bind(Include = "adaid,adaname")] ADA aDA)
        {
            if (ModelState.IsValid)
            {
                db.ADAs.Add(aDA);
                db.SaveChanges();
                return(RedirectToAction("Create"));
            }

            return(View(aDA));
        }
Exemplo n.º 4
0
        // GET: ADAs/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            ADA aDA = db.ADAs.Find(id);

            if (aDA == null)
            {
                return(HttpNotFound());
            }
            return(View(aDA));
        }
Exemplo n.º 5
0
        //
        // GET: /ERSEA/

        /*roleid=f87b4a71-f0a8-43c3-aea7-267e5e37a59d(Super Admin)
         * roleid=a65bb7c2-e320-42a2-aed4-409a321c08a5(GenesisEarth Administrator)
         * roleid=a31b1716-b042-46b7-acc0-95794e378b26(Health/Nurse)
         * roleid=2d9822cd-85a3-4269-9609-9aabb914d792(HR Manager)
         * roleid=94cdf8a2-8d81-4b80-a2c6-cdbdc5894b6d(Family Service Worker)
         * roleid=e4c80fc2-8b64-447a-99b4-95d1510b01e9(Home Visitor)
         * roleid=82b862e6-1a0f-46d2-aad4-34f89f72369a(teacher)
         * roleid=b4d86d72-0b86-41b2-adc4-5ccce7e9775b(CenterManager)
         * roleid=9ad1750e-2522-4717-a71b-5916a38730ed(Health Manager)
         */

        public ActionResult ERSEADashboard()
        {
            ERSEADashBoard obj = new ERSEADashBoard();

            try
            {
                //get the Json filepath
                //string file = Server.MapPath("~/Content/JSON/us_census_zipcode.json");
                //deserialize JSON from file
                //var Json = System.IO.File.ReadAllText(file);

                List <ApplicationEnrollment> lstApplication = new List <ApplicationEnrollment>();
                List <ADA>      lstADA      = new List <ADA>();
                List <CityName> lstCityName = new List <CityName>();
                new ERSEAData().GetApplicationEnrollmentBasedonZip(ref lstApplication, Session["AgencyID"].ToString());
                new ERSEAData().GetADABasedonCenter(ref lstADA, Session["AgencyID"].ToString());
                new ERSEAData().GetCityName(ref lstCityName);
                if (lstApplication.Count() > 0)
                {
                    foreach (ApplicationEnrollment objEnroll in lstApplication)
                    {
                        Object city        = lstCityName.Where(a => a.Zipcode.Contains(objEnroll.ZipCode)).Select(a => a.City).FirstOrDefault();
                        Object primarycity = lstCityName.Where(a => a.Zipcode.Contains(objEnroll.ZipCode)).Select(a => a.PrimaryCity).FirstOrDefault();
                        if (city != null || primarycity != null)
                        {
                            if (primarycity != null)
                            {
                                objEnroll.CityName = primarycity.ToString();
                            }
                            else
                            {
                                objEnroll.CityName = city.ToString();
                            }
                        }
                    }
                }
                obj.lstApplication = lstApplication;
                obj.listADA        = lstADA;
                ADA totalADA = new ADA();
                int count    = lstADA.Count() * 100;

                totalADA.Jan            = Math.Round((lstADA.Sum(a => a.Jan) / count) * 100, 0);
                totalADA.Feb            = Math.Round((lstADA.Sum(a => a.Feb) / count) * 100, 0);
                totalADA.Mar            = Math.Round((lstADA.Sum(a => a.Mar) / count) * 100, 0);
                totalADA.Apr            = Math.Round((lstADA.Sum(a => a.Apr) / count) * 100, 0);
                totalADA.May            = Math.Round((lstADA.Sum(a => a.May) / count) * 100, 0);
                totalADA.Jun            = Math.Round((lstADA.Sum(a => a.Jun) / count) * 100, 0);
                totalADA.Jul            = Math.Round((lstADA.Sum(a => a.Jul) / count) * 100, 0);
                totalADA.Aug            = Math.Round((lstADA.Sum(a => a.Aug) / count) * 100, 0);
                totalADA.Sep            = Math.Round((lstADA.Sum(a => a.Sep) / count) * 100, 0);
                totalADA.Oct            = Math.Round((lstADA.Sum(a => a.Oct) / count) * 100, 0);
                totalADA.Nov            = Math.Round((lstADA.Sum(a => a.Nov) / count) * 100, 0);
                totalADA.Dec            = Math.Round((lstADA.Sum(a => a.Dec) / count) * 100, 0);
                ViewBag.TotalPercentage = totalADA;
                decimal total = (totalADA.Jan + totalADA.Feb + totalADA.May + totalADA.Apr + totalADA.May + totalADA.Jun + totalADA.Jul + totalADA.Aug + totalADA.Sep + totalADA.Oct + totalADA.Nov + totalADA.Dec);
                //decimal total = (lstADA.Sum(a => a.Jan) + lstADA.Sum(a => a.Feb) + lstADA.Sum(a => a.Mar) + lstADA.Sum(a => a.Apr) + lstADA.Sum(a => a.May) + lstADA.Sum(a => a.Jun) + lstADA.Sum(a => a.Jul) + lstADA.Sum(a => a.Aug) + lstADA.Sum(a => a.Sep) + lstADA.Sum(a => a.Oct) + lstADA.Sum(a => a.Nov) + lstADA.Sum(a => a.Dec));
                ViewBag.OverAllPercentage  = Math.Round((total / (300)) * 100, 0);
                ViewBag.OverAllApplication = lstApplication.Sum(a => a.Application);
                ViewBag.OverAllEnroll      = lstApplication.Sum(a => a.Enrollment);
            }
            catch (Exception ex)
            {
                clsError.WriteException(ex);
            }
            return(View(obj));
        }
Exemplo n.º 6
0
    IEnumerator Start2()
    {
//		if (!Input.location.isEnabledByUser) {
//			yield break;
//
//		}


        // Start service before querying location
        Input.location.Start();

        // Wait until service initializes
        int maxWait = 20;

        while (Input.location.status == LocationServiceStatus.Initializing && maxWait > 0)
        {
            yield return(new WaitForSeconds(1));

            maxWait--;
        }

        // Service didn't initialize in 20 seconds
        if (maxWait < 1)
        {
            Debug.Log("Timed out");
            yield break;
        }

        // Connection has failed
        if (Input.location.status == LocationServiceStatus.Failed)
        {
            nomap.text = "Unable to determine device location";
            Debug.Log("Unable to determine device location");
            Hantu.SetActive(false);
            ADA.SetActive(false);
            yield break;
        }
        else
        {
            nomap.text = "";
            StopCoroutine(findPeople());
            // Access granted and location value could be retrieved
            //Debug.Log("Location: " + Input.location.lastData.latitude + " " + Input.location.lastData.longitude + " " + Input.location.lastData.altitude + " " + Input.location.lastData.horizontalAccuracy + " " + Input.location.lastData.timestamp);
            //lat.text = Input.location.lastData.latitude.ToString();
            if (PlayerPrefs.GetString("PLAY_TUTORIAL") == "TRUE")
            {
                PlayerPrefs.SetString(Link.LAT, "-6.244553565979");
                PlayerPrefs.SetString(Link.LOT, "106.892440795898");
            }
            else
            {
                PlayerPrefs.SetString(Link.LAT, map.GetComponent <LocationManager>().lat.ToString());
                PlayerPrefs.SetString(Link.LOT, map.GetComponent <LocationManager>().lon.ToString());
            }


//			PlayerPrefs.SetString (Link.LAT,Input.location.lastData.latitude.ToString());
//			PlayerPrefs.SetString (Link.LOT,Input.location.lastData.longitude.ToString());

            StartCoroutine(findPeople());
        }


        // Stop service if there is no need to query location updates continuously
        Input.location.Stop();
    }
Exemplo n.º 7
0
    private IEnumerator findPeople()
    {
        //yield return new WaitForSeconds(2f);
        string  url  = Link.url + "findmylocation";
        WWWForm form = new WWWForm();

        form.AddField(Link.ID, PlayerPrefs.GetString(Link.ID));
        form.AddField(Link.LAT, PlayerPrefs.GetString(Link.LAT));
        form.AddField(Link.LOT, PlayerPrefs.GetString(Link.LOT));
        //  form.AddField("DID", PlayerPrefs.GetString(Link.DEVICE_ID));
        form.AddField("FROM", "REAL_TIME");
        //	form.AddField (Link.FCM_ID, id);

        WWW www = new WWW(url, form);

        yield return(www);

        if (www.error == null)
        {
            var jsonString = JSON.Parse(www.text);
            if (int.Parse(jsonString ["code"]) > 0)
            {
                PlayerPrefs.SetString("kodetempat", jsonString ["data"] ["kodetempat"]);
                PlayerPrefs.SetString("kodehantu", jsonString ["data"] ["kodehantu"]);
                PlayerPrefs.SetString("ID_bermain", jsonString["data"]["ID"]);

                PlayerPrefs.SetString(Link.BURU_FILE, jsonString ["kodehantus"] ["name_file"]);
                PlayerPrefs.SetString(Link.BURU_ATTACK, jsonString ["kodehantus"] ["ATTACK"]);
                PlayerPrefs.SetString(Link.BURU_DEFENSE, jsonString ["kodehantus"] ["DEFEND"]);
                PlayerPrefs.SetString(Link.BURU_HP, jsonString ["kodehantus"] ["HP"]);
                PlayerPrefs.SetString(Link.BURU_MODE, jsonString ["kodehantus"] ["type"]);
                int grade = int.Parse(jsonString ["kodehantus"] ["grade"]);
                if (grade == 5)
                {
                    berburu.TimeShiftDecrease = 2;
                }
                else if (grade >= 3 && grade < 5)
                {
                    berburu.TimeShiftDecrease = 1.5f;
                }
                else
                {
                    berburu.TimeShiftDecrease = 1f;
                }
                Hantu.SetActive(true);
                ADA.SetActive(true);
                StopCoroutine(onCoroutine());
                StopCoroutine(findPeople());
                StopCoroutine(Start2());
                join = false;
            }
            else
            {
                Debug.Log("Udah Abis Jatah tempat ini");
                if (int.Parse(PlayerPrefs.GetString(Link.IBURU)) >= 2)
                {
                    abisjatah.transform.FindChild("Background").transform.FindChild("panel").transform.FindChild("Text").GetComponent <Text>().text = "Your Quota for Hunting was reached for today, try again tommorrow";
                    abisjatah.transform.FindChild("Background").transform.FindChild("panel").transform.FindChild("PlayButton").gameObject.SetActive(false);
                    abisjatah.transform.FindChild("Background").transform.FindChild("panel").transform.FindChild("NoButton").transform.FindChild("Text").GetComponent <Text>().text = "Back";
                    abisjatah.SetActive(true);
                    Hantu.SetActive(false);
                    ADA.SetActive(false);
                }
                else
                {
                    ADA.SetActive(true);
                    abisjatah.SetActive(true);
                }
            }
        }
        Debug.Log(PlayerPrefs.GetString(Link.ID));
        Debug.Log(PlayerPrefs.GetString(Link.LAT));
        Debug.Log(PlayerPrefs.GetString(Link.LOT));
        Debug.Log(www.text);
    }