public static void DataInForStudent(string[] arg)//добавление { Dek TB = DataLoadSave.LoadXML(FilePath); //var student = TB.Students.First(x => x.ID == ID); StudentsTable StudentBlok = new StudentsTable ( arg[1] != "" ? GetGroupeIDByGroupeName(TB, arg[1]) : -1, arg[2] != "" ? GetRoomIdByRoomNumber(TB, arg[2]) : -1, arg[3], arg[4], arg[5], arg[6], arg[7], arg[8], arg[9], arg[10] != null ? arg[10] : null ); //StudentBlok.ID = TB.StudID++; TB.Students.Add(StudentBlok); Save(TB); //StudentsInGroupeCount(); //StudentsInRoomCount(); }
void SaveScoreData() { for (int i = 0; i < scoreList.Count; i++) { DataLoadSave.SetInt("Score " + i.ToString(), scoreList[i]); } }
public void ShowTutorial(bool isCheck) { if (gameMgr == null) { gameMgr = GameObject.FindObjectOfType <GameManager>(); } if (!isTutorialEnd) { return; } if (isCheck) { bool isPlayed = false; if (DataLoadSave.HasKey("Tutorial")) { isPlayed = true; } if (isPlayed) { return; } } DataLoadSave.SetInt("Tutorial", 0); StartCoroutine(TutorialStart()); }
public static DataTable DataOutPut(For @for) { Dek TB; if (FileEx(FilePath)) { TB = DataLoadSave.LoadXML(FilePath); DataSet Ds = new DataSet("Students"); //DataTable DekDataTable = new DataTable("DekDataTable"); DataTable StudentT = InitealDTStudent(); DataTable GroupeT = InitealDTSGrope(); DataTable RoomT = InitealDTRoom(); DataTable HostelT = InitealDTSHostel(); Ds.Tables.Add(StudentT); Ds.Tables.Add(GroupeT); Ds.Tables.Add(RoomT); Ds.Tables.Add(HostelT); switch (@for) { case For.Student: foreach (StudentsTable S in TB.Students) { StudentT.Rows.Add(new object[] { S.ID, S.ThirdName_1 + " " + S.Name_2 + " " + S.SurnameName_3, GetGroupeNameByID(TB, S.GroupeID), GetRoomNumberByRoomID(TB, S.RoomID), S.TicetNumber, S.FormStudy, S.ContractBudget, S.Description }); } return(StudentT); case For.Groupe: foreach (GroupeTable G in TB.Groupes) { GroupeT.Rows.Add(new object[] { G.ID, G.GroupeNumber, G.StudentsInGroupe, G.Description }); } return(GroupeT); case For.Room: foreach (RoomTable R in TB.Roomes) { RoomT.Rows.Add(new object[] { R.ID, GetHostelNameByID(TB, R.HostelID), R.RoomNumber, R.AllPlace, R.FreePlase, R.Description }); } return(RoomT); case For.Hostel: foreach (HostelNewTable H in TB.HostelsN) { HostelT.Rows.Add(new object[] { H.ID, H.Frame, H.RoomsCount, H.Decription }); } return(HostelT); default: return(null); } } else { return(null); } }
void Start() { if (DataLoadSave.HasKey("Language")) { Language lang = DataLoadSave.GetString("Language") == "Korean" ? Language.Korean : Language.English; languageMgr.ChangeLanguage(lang); ChangeLanguageSprite(); } }
void Awake() { for (int i = 0; i < 10; i++) { if (DataLoadSave.HasKey("Score " + i.ToString())) { scoreList.Add(DataLoadSave.GetInt("Score " + i.ToString())); } } DontDestroyOnLoad(this.gameObject); }
public static string ReturnPicture(int ID) { Dek TB = DataLoadSave.LoadXML(FilePath); var student = TB.Students.First(x => x.ID == ID); if (student.ImagePath != "") { return(student.ImagePath); } return(null); }
public static void DataInForStudent(string[] arg, int ID)//редактирование за айдишником дата грида { Dek TB = DataLoadSave.LoadXML(); int i = GetTrueItemID(TB, ID, For.Student); StudentsTable StudentBlok = new StudentsTable ( arg[1] != "" ? GetGroupeIDByGroupeName(TB, arg[1]) : -1, arg[2] != "" ? GetRoomIdByRoomNumber(TB, arg[2]) : -1, arg[3], arg[4], arg[5], arg[6], arg[7], arg[8], arg[9], arg[10] != null ? arg[10] : null ); StudentBlok.ID = TB.Students[i].ID; TB.Students[i] = StudentBlok; Save(TB); //Dek TB; //if (FileEx(FilePath)) // TB = DataLoadSave.LoadXML(FilePath); //else TB = new Dek(); //int i = GetTrueItemID(TB, ID, For.Student); //StudentsTable StudentBlok = new StudentsTable //{ // GroupeID = arg[1] != "" ? GetGroupeIDByGroupeName(TB, arg[1]) : -1, // RoomID = arg[2] != "" ? GetRoomIdByRoomNumber(TB, arg[2]) : -1, // ThirdName_1 = arg[3], // Name_2 = arg[4], // SurnameName_3 = arg[5], // TicetNumber = arg[6], // FormStudy = arg[7], // ContractBudget = arg[8], // Description = arg[9], // Bin = arg[10] != null ? File.ReadAllBytes(arg[10]) : TB.Students[i].Bin //}; //StudentBlok.ID = TB.Students[i].ID; //TB.Students[i] = StudentBlok; //Save(TB); //StudentsInGroupeCount(); //StudentsInRoomCount(); }
public void ChangeLanguage(Language language) { switch (language) { case Language.Korean: currLanguage = Language.Korean; break; case Language.English: currLanguage = Language.English; break; } DataLoadSave.SetString("Language", language == Language.Korean ? "Korean" : "English"); PlayerPrefs.Save(); }
}//удаление за айдишником дата грида(уже нет) //удаление за полем айди в елементе //public static void StudentsInGroupeCount()//инициализировать при добавлении каждого студента и редактировании //{ // Dek TB = DataLoadSave.LoadXML(FilePath); // foreach (var item in TB.Groupes) // { // item.StudentsInGroupe = 0; // } // foreach (var Gitem in TB.Groupes) // { // foreach (var Sitem in TB.Students) // { // if (Gitem.ID == Sitem.GroupeID) // { // Gitem.StudentsInGroupe++; // } // } // } // DataLoadSave.SaveXML(FilePath, TB); //} public static void DataInForGroupes(string[] arg) { Dek TB; if (FileEx(FilePath)) { TB = DataLoadSave.LoadXML(FilePath); } else { TB = new Dek(); } GroupeTable GroupeBlok = new GroupeTable(arg[1], arg[3]); TB.Groupes.Add(GroupeBlok); Save(TB); }
public static bool DataDeleteStudent(int ID) { Dek TB; if (FileEx(FilePath)) { TB = DataLoadSave.LoadXML(FilePath); TB.Students.RemoveAt(GetTrueItemID(TB, ID, For.Student)); //TB.Students.RemoveAt(ID); DataLoadSave.SaveXML(FilePath, TB); return(true); } else { return(false); } }//удаление за айдишником дата грида(уже нет)
public static void DataInForGroupes(string[] arg, int ID) { Dek TB; if (FileEx(FilePath)) { TB = DataLoadSave.LoadXML(FilePath); } else { TB = new Dek(); } int i = GetTrueItemID(TB, ID, For.Groupe); GroupeTable GroupeBlok = new GroupeTable(arg[1], arg[3]); GroupeBlok.ID = TB.Students[i].ID; TB.Groupes[i] = GroupeBlok; Save(TB); }
public static void RoomsInHostelCount()//вызывать при добавлении и редакт комнаты { Dek TB = DataLoadSave.LoadXML(FilePath); foreach (var item in TB.HostelsN) { item.RoomsCount = 0; } foreach (var Hitem in TB.HostelsN) { foreach (var Ritem in TB.Roomes) { if (Hitem.ID == Ritem.HostelID) { Hitem.RoomsCount++; } } } DataLoadSave.SaveXML(FilePath, TB); }
public static bool DataDeleteGroupe(int ID) { Dek TB; if (FileEx(FilePath)) { TB = DataLoadSave.LoadXML(FilePath); int i = GetTrueItemID(TB, ID, For.Groupe); if (TB.Groupes[i].StudentsInGroupe > 0) { return(false); } TB.Groupes.RemoveAt(i); DataLoadSave.SaveXML(FilePath, TB); return(true); } else { return(false); } }
public static DataTable OpenDataForEdit(For @for, int ID) { Dek TB = DataLoadSave.LoadXML(FilePath); DataSet Ds = new DataSet("Students"); DataTable StudentTable = InitealDTStudentForEdit(); DataTable GroupesTable = InitealDTSGrope(); DataTable RoomTable = InitealDTRoom(); DataTable HostTable = InitealDTSHostel(); Ds.Tables.Add(StudentTable); Ds.Tables.Add(GroupesTable); Ds.Tables.Add(RoomTable); Ds.Tables.Add(HostTable); if (@for == For.Student) { int SitemID = GetTrueItemID(TB, ID, @for); //if (SitemID < TB.StudID) if (SitemID != -1) { StudentsTable StudentBlok = TB.Students[SitemID]; StudentTable.Rows.Add(new object[] { StudentBlok.ID, GetGroupeNameByID(TB, StudentBlok.GroupeID), GetRoomNumberByRoomID(TB, StudentBlok.RoomID), StudentBlok.ThirdName_1, StudentBlok.Name_2, StudentBlok.SurnameName_3, StudentBlok.TicetNumber, StudentBlok.FormStudy, StudentBlok.ContractBudget, StudentBlok.Description }); return(StudentTable); } } else if (@for == For.Groupe) { int GitemID = GetTrueItemID(TB, ID, @for); if (GitemID != -1) { GroupeTable GroupeBlok = TB.Groupes[GitemID]; GroupesTable.Rows.Add(new object[] { GroupeBlok.ID, GroupeBlok.GroupeNumber, GroupeBlok.StudentsInGroupe, GroupeBlok.Description }); return(GroupesTable); } } else if (@for == For.Room) { int RitemID = GetTrueItemID(TB, ID, @for); if (RitemID != -1) { RoomTable RoomBlok = TB.Roomes[RitemID]; RoomTable.Rows.Add(new object[] { RoomBlok.ID, GetHostelNameByID(TB, RoomBlok.HostelID), RoomBlok.RoomNumber, RoomBlok.AllPlace, RoomBlok.FreePlase, RoomBlok.Description }); return(RoomTable); } } else if (@for == For.Hostel) { int HitemID = GetTrueItemID(TB, ID, @for); if (HitemID != -1) { HostelNewTable HostelBlok = TB.HostelsN[HitemID]; HostTable.Rows.Add(new object[] { HostelBlok.ID, HostelBlok.Frame, HostelBlok.RoomsCount, HostelBlok.Decription }); return(HostTable); } } return(null); }
public static void Save(object Blok) { DataLoadSave.SaveXML(FilePath, Blok); }
public static DataTable SearchInStudents(string name1, string name2, string name3, string groupe, For @for) { Dek TB; if (FileEx(FilePath)) { TB = DataLoadSave.LoadXML(FilePath); DataSet Ds = new DataSet("Students"); //DataTable DekDataTable = new DataTable("DekDataTable"); DataTable StudentTable = InitealDTStudent(); DataTable GroupesTable = InitealDTSGrope(); DataTable RoomTable = InitealDTRoom(); Ds.Tables.Add(StudentTable); Ds.Tables.Add(GroupesTable); Ds.Tables.Add(RoomTable); foreach (StudentsTable S in TB.Students) { bool[] arg = new bool[4]; arg[0] = S.ThirdName_1.Contains(name1) || S.ThirdName_1 == "" ? true : false; arg[1] = S.Name_2.Contains(name2) || S.Name_2 == "" ? true : false; arg[2] = S.SurnameName_3.Contains(name3) || S.SurnameName_3 == "" ? true : false; arg[3] = GetGroupeNameByID(TB, S.GroupeID).Contains(groupe) || GetGroupeNameByID(TB, S.GroupeID) == "" ? true : false; if (CompareBoolArg(arg)) { StudentTable.Rows.Add(new object[] { S.ID, S.ThirdName_1 + " " + S.Name_2 + " " + S.SurnameName_3, GetGroupeNameByID(TB, S.GroupeID), GetRoomNumberByRoomID(TB, S.RoomID), S.TicetNumber, S.FormStudy, S.ContractBudget, S.Description }); } } return(StudentTable); /* * foreach (GroupeTable G in TB.Groupes) * { * GroupesTable.Rows.Add(new object[] { G.GroupeNumber, G.StudentsInGroupe, G.Description }); * } * * foreach (RoomTable R in TB.Roomes) * { * RoomTable.Rows.Add(new object[] { R.RoomNumber, R.AllPlace, R.FreePlase, R.Description }); * } * * switch (@for) * { * case For.Student: return StudentTable; * case For.Groupe: return GroupesTable; * case For.Room: return RoomTable; * default: return null; * } * //arg[4] = GetHostelIDByRoomID(TB, GetRoomIdByRoomNumber(TB,Room), GetHostelIdByName(TB, hostel)) || hostel == "" ? true : false; * //arg[5] = GetRoomNumberByRoomID(TB, S.RoomID).Contains(Room) || GetRoomNumberByRoomID(TB, S.RoomID) == "" ? true : false; */ } else { return(null); } }