public void saveChild() { if (fio.text.Length == 0) { nameError.active = true; } else if (login.text.Length == 0) { loginError.active = true; } else if (DBWorker.loginConsists(login.text, (editingChild == null ? null : editingChild.getChild().Id.ToString()))) { loginConsistsError.active = true; } else { string date = (day.value + 1 < 10 ? "0" : "") + (day.value + 1).ToString(); date += "." + (month.value + 1 < 10 ? "0" : "") + (month.value + 1).ToString(); date += "." + year.options.ToArray() [year.value].text; if (editingChild == null) { User child = new User(false, -1, login.text, pwd.text, fio.text, date); child.Id = DBWorker.saveChild(child); ChildNote childNote = (ChildNote)Instantiate(childNotePrefab, childrenLayout); childNote.transform.localScale = new Vector3(1, 1, 1); childNote.setChild(child); showAddChild(false); } else { User c = editingChild.getChild(); c.FIO = fio.text; c.Login = login.text; c.Password = pwd.text; c.BirthDate = date; DBWorker.saveChild(c); editingChild.setChild(c); showAddChild(false); editingChild = null; } } }
public void editChild() { if (currentChild != null) { pall.active = true; addChildMenu.active = true; editingChild = currentChild; fio.text = editingChild.getChild().FIO; pwd.text = editingChild.getChild().Password; login.text = editingChild.getChild().Login; char[] separators = { '.' }; string[] date = editingChild.getChild().BirthDate.Split(separators, 3); day.value = int.Parse(date [0]) - 1; month.value = int.Parse(date [1]) - 1; year.value = int.Parse(date [2]) - int.Parse(year.options.ToArray() [year.value].text); } }
public void remomeChild() { if (currentChild != null) { DBWorker.removeChild(currentChild.getChild()); Destroy(currentChild.gameObject); currentChild = null; } }
public void setTasks(ChildNote child) { if (currentChild != null) { currentChild.setCurrent(false); } currentChild = child; currentChild.setCurrent(); int [] ct = child.getChild().currentTasks.ToArray(); List <Task> tl = new List <Task> (); for (int i = 0; i < ct.Length; i++) { for (int j = 0; j < taskList.Length; j++) { if (taskList [j].DBId == ct [i]) { tl.Add(taskList [j]); } } } setTaskList(tl.ToArray()); }