// Start is called before the first frame update void Start() { vacation_buttons = new List <Button>(); vacation_buttons_Select = new List <bool>(); RestClient.Get <vacapply>("https://fir-unity-6f472.firebaseio.com/vacapply.json").Then(response => { vacapply v = new vacapply(); v = response; string[] peopleAr = v.people.Split(','); string[] departAr = v.depart.Split(','); string[] arriveAr = v.arrive.Split(','); string[] vackindAr = v.vackind.Split(','); string[] vacapplykindAr = v.vacapplykind.Split(','); string formatString = "yyyy##MM##dd"; //date convert DateTime[] deprt = new DateTime[departAr.Length], arv = new DateTime[departAr.Length]; for (int i = 0; i < departAr.Length; i++) { if (departAr[i] != "" || arriveAr[i] != "") { deprt[i] = DateTime.ParseExact(departAr[i], formatString, null); arv[i] = DateTime.ParseExact(arriveAr[i], formatString, null); } } Debug.Log(deprt[0]); //buttonCreate2(10); buttonCreate(peopleAr, deprt, arv, vackindAr, vacapplykindAr); }); checked_num_Text.text = checkedNum.ToString(); }
public void pushApply() { List <TempVacation> list = new List <TempVacation>(); String _soldierName; int _vacaKind; DateTime _departTime; DateTime _arriveTime; int _usedCheck = 0; String _vacaName; RestClient.Get <vacapply>("https://fir-unity-6f472.firebaseio.com/vacapply.json").Then(response => { vacapply v = new vacapply(); v = response; string sn = "", vk = "", dt = "", at = ""; for (int i = 0; i < tableList.Count; i++) { _soldierName = sdm.soldier.name; SoldierScreen2_table s2table = tableList[i].GetComponent <SoldierScreen2_table>(); Debug.Log("555"); _vacaKind = s2table.GetvacaKind(); Debug.Log("555"); _departTime = s2table.GetDepartDate(); Debug.Log("555"); _arriveTime = s2table.GetArriveDate(); Debug.Log("555"); //_vacaName = s2table.GetvacaName(); Debug.Log("555"); Debug.Log("$$$$" + peoplist); if (v.people.Equals("")) { v.people = _soldierName; v.vackind = _vacaKind.ToString(); v.depart = _departTime.ToString("yyyy##MM##dd"); v.arrive = _arriveTime.ToString("yyyy##MM##dd"); v.vacapplykind = v.vacapplykind + "0"; } else { v.people = v.people + "," + _soldierName; v.vackind = v.vackind + "," + _vacaKind.ToString(); v.depart = v.depart + "," + _departTime.ToString("yyyy##MM##dd"); v.arrive = v.arrive + "," + _arriveTime.ToString("yyyy##MM##dd"); v.vacapplykind = v.vacapplykind + "0"; } Debug.Log("$$$$" + peoplist); RestClient.Put("https://fir-unity-6f472.firebaseio.com/vacapply.json", v); list.Add(new TempVacation(_soldierName, _vacaKind, _departTime, _arriveTime, _usedCheck, "vacname"));//add vacation print(list[i]); } }); }
public void acceptClick() { Debug.Log("-" + vacation_buttons_Select[0]); RestClient.Get <vacapply>("https://fir-unity-6f472.firebaseio.com/vacapply.json").Then(response => { vacapply v2 = new vacapply(); v2 = response; string[] peopleAr = v2.people.Split(','); string[] departAr = v2.depart.Split(','); string[] arriveAr = v2.arrive.Split(','); string[] vackindAr = v2.vackind.Split(','); string[] vacapplykindAr = v2.vacapplykind.Split(','); string peoplestr = "", depstr = "", arrstr = "", vk = "", vak = ""; string Rpeoplestr = "", Rdepstr = "", Rarrstr = ""; string acceptedstr = ""; for (int i = 0; i < peopleAr.Length; i++) { if (vacation_buttons_Select[i]) { acceptedstr = acceptedstr + "&" + peopleAr[i] + ";" + departAr[i] + ";" + arriveAr[i]; //Debug.Log(vacation_buttons[i]); deleteSelectedButton(); Debug.Log(acceptedstr); // Destroy(vacation_buttons[i]); } //if you run the below code then it will delete from the server just try to figure out how to delete from UI if (!vacation_buttons_Select[i]) { peoplestr = peoplestr + peopleAr[i] + ","; depstr = depstr + departAr[i] + ","; arrstr = arrstr + arriveAr[i] + ","; vk = vk + vackindAr[i] + ","; vak = vak + vacapplykindAr[i] + ","; } Debug.Log(acceptedstr); } /**/ Debug.Log("-0-" + peoplestr); RestClient.Get <accRejVacations>("https://fir-unity-6f472.firebaseio.com/accRejVacations/.json").Then(response2 => { accRejVacations ar2 = new accRejVacations(); ar2 = response2; Debug.Log(acceptedstr); accvac = ar2.accepted + acceptedstr; Debug.Log(accvac); accRejVacations ar = new accRejVacations(); RestClient.Put("https://fir-unity-6f472.firebaseio.com/accRejVacations/.json", ar); vacapply v3 = new vacapply(); v3.people = peoplestr; v3.depart = depstr; v3.arrive = arrstr; v3.vacapplykind = vak; v3.vackind = vk; RestClient.Put("https://fir-unity-6f472.firebaseio.com/vacapply.json", v3); }); }); }