public static StudentJson[] LoadFromJson(string path)
 {
     StudentJson[] array = new StudentJson[101];
     for (int i = 0; i < array.Length; i++)
     {
         array[i] = new StudentJson();
     }
     foreach (Dictionary <string, object> dictionary in JsonData.Deserialize(path))
     {
         int num = TFUtils.LoadInt(dictionary, "ID");
         if (num == 0)
         {
             break;
         }
         StudentJson studentJson = array[num];
         studentJson.name       = TFUtils.LoadString(dictionary, "Name");
         studentJson.realname   = TFUtils.LoadString(dictionary, "RealName");
         studentJson.gender     = TFUtils.LoadInt(dictionary, "Gender");
         studentJson.classID    = TFUtils.LoadInt(dictionary, "Class");
         studentJson.seat       = TFUtils.LoadInt(dictionary, "Seat");
         studentJson.club       = (ClubType)TFUtils.LoadInt(dictionary, "Club");
         studentJson.persona    = (PersonaType)TFUtils.LoadInt(dictionary, "Persona");
         studentJson.crush      = TFUtils.LoadInt(dictionary, "Crush");
         studentJson.breastSize = TFUtils.LoadFloat(dictionary, "BreastSize");
         studentJson.strength   = TFUtils.LoadInt(dictionary, "Strength");
         studentJson.hairstyle  = TFUtils.LoadString(dictionary, "Hairstyle");
         studentJson.color      = TFUtils.LoadString(dictionary, "Color");
         studentJson.eyes       = TFUtils.LoadString(dictionary, "Eyes");
         studentJson.eyeType    = TFUtils.LoadString(dictionary, "EyeType");
         studentJson.stockings  = TFUtils.LoadString(dictionary, "Stockings");
         studentJson.accessory  = TFUtils.LoadString(dictionary, "Accessory");
         studentJson.info       = TFUtils.LoadString(dictionary, "Info");
         if (GameGlobals.LoveSick)
         {
             studentJson.name     = studentJson.realname;
             studentJson.realname = "";
         }
         if (OptionGlobals.HighPopulation && studentJson.name == "Unknown")
         {
             studentJson.name = "Random";
         }
         float[]  array3 = StudentJson.ConstructTempFloatArray(TFUtils.LoadString(dictionary, "ScheduleTime"));
         string[] array4 = StudentJson.ConstructTempStringArray(TFUtils.LoadString(dictionary, "ScheduleDestination"));
         string[] array5 = StudentJson.ConstructTempStringArray(TFUtils.LoadString(dictionary, "ScheduleAction"));
         studentJson.scheduleBlocks = new ScheduleBlock[array3.Length];
         for (int k = 0; k < studentJson.scheduleBlocks.Length; k++)
         {
             studentJson.scheduleBlocks[k] = new ScheduleBlock(array3[k], array4[k], array5[k]);
         }
         if (num == 10 || num == 11)
         {
             for (int l = 0; l < studentJson.scheduleBlocks.Length; l++)
             {
                 studentJson.scheduleBlocks[l] = null;
             }
         }
         studentJson.success = true;
     }
     return(array);
 }
        public void Load()
        {
            Log.Debug("");
            var Js = new StudentJson <T>();

            students = Js.ReadAll();
        }
示例#3
0
 public Form1()
 {
     try
     {
         Alumno al = new Alumno
         {
             Dni        = "234234234",
             Nombre     = "Daniel",
             Apellidos  = "Madirfal",
             Edad       = 28,
             Guid       = Guid.NewGuid(),
             Nacieminto = DateTime.Parse("14/11/1990"),
             Registro   = DateTime.Now,
         };
         StudentJson <Alumno> stu = new StudentJson <Alumno>();
         IStudentBL           bl  = new StudentBL(stu);
         bl.Add(al);
     }
     catch (Exception ex)
     {
         Log.Error(ex);
         throw;
     }
     InitializeComponent();
 }
示例#4
0
 public void DataInJsonToStudent(StudentJson studentfileData)
 {
     studentName     = studentfileData.nombre;
     studentLastName = studentfileData.apellido;
     studentAge      = studentfileData.edad;
     studentID       = studentfileData.codigo;
     studentEmail    = studentfileData.correo;
     studentGrade    = studentfileData.nota;
     status          = Status.Unselected;
 }
        private async void RegBTN_Click(object sender, EventArgs e)
        {
            if (RegCB.Checked)
            {
                if (PasswordTB.Text != CPasswordTB.Text)
                {
                    MessageBox.Show("Не совпадают введенные пароли!", "Ошибка регистрации.");
                    return;
                }
                if ((BookNumberTB.Text == "") || (PhoneNumberTB.Text == "") || (EmailAddressTB.Text == "") || (PasswordTB.Text == "") || (CPasswordTB.Text == ""))
                {
                    MessageBox.Show("Все поля должны быть заполнены.", "Ошибка регистрации.");
                    return;
                }
                StudentJson Student = new StudentJson();
                Student.BookNumber   = BookNumberTB.Text;
                Student.PhoneNumber  = PhoneNumberTB.Text;
                Student.EmailAddress = EmailAddressTB.Text;
                Student.Password     = PasswordTB.Text;
                Student.Group        = GroupCB.SelectedItem.ToString();
                string s      = JsonConvert.SerializeObject(Student);
                string answer = null;
                try
                {
                    answer = await Server.GetResponseAsync("http://localhost:57755/Account/AddStudent?Student=" + s);
                }
                catch (System.Net.WebException)
                {
                    MessageBox.Show("Удаленный сервер не отвечает. Регистрация временно невозможна.", "Ошибка регистрации.");
                }
                switch (Convert.ToInt32(answer))
                {
                case -1:
                    MessageBox.Show("Пользователь с таким номером зачетной книги уже существует.", "Ошибка регистрации.");
                    break;

                case -2:
                    MessageBox.Show("Пользователь с таким Email адресом уже существует.", "Ошибка регистрации.");
                    break;

                case -3:
                    MessageBox.Show("Пользователь с таким номером телефона уже существует.", "Ошибка регистрации.");
                    break;

                case 1:
                    ClearFields();
                    MessageBox.Show("Поздравляем! Регистрация прошла успешно!.", "Регистрация студента.");
                    break;
                }
            }
            else
            {
                MessageBox.Show("Для регистрации вам необходимо ввести свои данные и дать согласие на их обработку.", "Ошибка регистрации.");
            }
        }
示例#6
0
 // Token: 0x06000579 RID: 1401 RVA: 0x0004B1A0 File Offset: 0x000495A0
 private void Start()
 {
     this.students = StudentJson.LoadFromJson(StudentJson.FilePath);
     if (SceneManager.GetActiveScene().name == "SchoolScene")
     {
         this.topics = TopicJson.LoadFromJson(TopicJson.FilePath);
         StudentManagerScript studentManagerScript = UnityEngine.Object.FindObjectOfType <StudentManagerScript>();
         this.ReplaceDeadTeachers(studentManagerScript.FirstNames, studentManagerScript.LastNames);
     }
     else if (SceneManager.GetActiveScene().name == "CreditsScene")
     {
         this.credits = CreditJson.LoadFromJson(CreditJson.FilePath);
     }
 }
示例#7
0
        public int AddStudent(string Student)
        {
            StudentJson student = JsonConvert.DeserializeObject <StudentJson>(Student);

            db.Faculties.ToArray();
            db.Departments.ToArray();
            db.Groups.ToArray();
            var     g    = db.Groups.Where(p => p.Name == student.Group).ToArray();
            Student NewS = new Student
            {
                BookNumber   = student.BookNumber,
                PhoneNumber  = student.PhoneNumber,
                EmailAddress = student.EmailAddress,
                Password     = student.Password,
                Courseumber  = Convert.ToInt32(student.Group.ElementAt(student.Group.Length - 2).ToString()),
                Group        = g[0],
                GroupId      = g[0].Id
            };

            if (((db.Students.FirstOrDefault(p => p.BookNumber == NewS.BookNumber)) == null))
            {
                if (db.Students.FirstOrDefault(p => p.EmailAddress == NewS.EmailAddress) == null)
                {
                    if (db.Students.FirstOrDefault(p => p.PhoneNumber == NewS.PhoneNumber) == null)
                    {
                        db.Students.Add(NewS);
                        g[0].Students.Add(NewS);
                        db.SaveChanges();
                        return(1);
                    }
                    else
                    {
                        return(-3);
                    }
                }
                else
                {
                    return(-2);
                }
            }
            else
            {
                return(-1);
            }
        }
示例#8
0
 // Token: 0x060017C0 RID: 6080 RVA: 0x000CFE48 File Offset: 0x000CE048
 private void ReplaceDeadTeachers(string[] firstNames, string[] lastNames)
 {
     for (int i = 90; i < 101; i++)
     {
         if (StudentGlobals.GetStudentDead(i))
         {
             StudentGlobals.SetStudentReplaced(i, true);
             StudentGlobals.SetStudentDead(i, false);
             string value = firstNames[UnityEngine.Random.Range(0, firstNames.Length)] + " " + lastNames[UnityEngine.Random.Range(0, lastNames.Length)];
             StudentGlobals.SetStudentName(i, value);
             StudentGlobals.SetStudentBustSize(i, UnityEngine.Random.Range(1f, 1.5f));
             StudentGlobals.SetStudentHairstyle(i, UnityEngine.Random.Range(1, 8).ToString());
             float r = UnityEngine.Random.Range(0f, 1f);
             float g = UnityEngine.Random.Range(0f, 1f);
             float b = UnityEngine.Random.Range(0f, 1f);
             StudentGlobals.SetStudentColor(i, new Color(r, g, b));
             r = UnityEngine.Random.Range(0f, 1f);
             g = UnityEngine.Random.Range(0f, 1f);
             b = UnityEngine.Random.Range(0f, 1f);
             StudentGlobals.SetStudentEyeColor(i, new Color(r, g, b));
             StudentGlobals.SetStudentAccessory(i, UnityEngine.Random.Range(1, 7).ToString());
         }
     }
     for (int j = 90; j < 101; j++)
     {
         if (StudentGlobals.GetStudentReplaced(j))
         {
             StudentJson studentJson = this.students[j];
             studentJson.Name       = StudentGlobals.GetStudentName(j);
             studentJson.BreastSize = StudentGlobals.GetStudentBustSize(j);
             studentJson.Hairstyle  = StudentGlobals.GetStudentHairstyle(j);
             studentJson.Accessory  = StudentGlobals.GetStudentAccessory(j);
             if (j == 97)
             {
                 studentJson.Accessory = "7";
             }
             if (j == 90)
             {
                 studentJson.Accessory = "8";
             }
         }
     }
 }
    public void UpdateInfo(int ID)
    {
        StudentJson studentJson = this.JSON.Students[ID];

        if (studentJson.RealName == "")
        {
            this.NameLabel.transform.localPosition = new Vector3(-228f, 195f, 0f);
            this.RealNameLabel.text = "";
        }
        else
        {
            this.NameLabel.transform.localPosition = new Vector3(-228f, 210f, 0f);
            this.RealNameLabel.text = "Real Name: " + studentJson.RealName;
        }
        this.NameLabel.text = studentJson.Name;
        string text = string.Concat(studentJson.Class);

        text = text.Insert(1, "-");
        this.ClassLabel.text = "Class " + text;
        if (ID == 90 || ID > 96)
        {
            this.ClassLabel.text = "";
        }
        if (StudentGlobals.GetStudentReputation(ID) < 0)
        {
            this.ReputationLabel.text = StudentGlobals.GetStudentReputation(ID).ToString();
        }
        else if (StudentGlobals.GetStudentReputation(ID) > 0)
        {
            this.ReputationLabel.text = "+" + StudentGlobals.GetStudentReputation(ID).ToString();
        }
        else
        {
            this.ReputationLabel.text = "0";
        }
        this.ReputationBar.localPosition = new Vector3((float)StudentGlobals.GetStudentReputation(ID) * 0.96f, this.ReputationBar.localPosition.y, this.ReputationBar.localPosition.z);
        if (this.ReputationBar.localPosition.x > 96f)
        {
            this.ReputationBar.localPosition = new Vector3(96f, this.ReputationBar.localPosition.y, this.ReputationBar.localPosition.z);
        }
        if (this.ReputationBar.localPosition.x < -96f)
        {
            this.ReputationBar.localPosition = new Vector3(-96f, this.ReputationBar.localPosition.y, this.ReputationBar.localPosition.z);
        }
        this.PersonaLabel.text = Persona.PersonaNames[studentJson.Persona];
        if (studentJson.Persona == PersonaType.Strict && studentJson.Club == ClubType.GymTeacher && !StudentGlobals.GetStudentReplaced(ID))
        {
            this.PersonaLabel.text = "Friendly but Strict";
        }
        if (studentJson.Crush == 0)
        {
            this.CrushLabel.text = "None";
        }
        else if (studentJson.Crush == 99)
        {
            this.CrushLabel.text = "?????";
        }
        else
        {
            this.CrushLabel.text = this.JSON.Students[studentJson.Crush].Name;
        }
        if (studentJson.Club < ClubType.Teacher)
        {
            this.OccupationLabel.text = "Club";
        }
        else
        {
            this.OccupationLabel.text = "Occupation";
        }
        if (studentJson.Club < ClubType.Teacher)
        {
            this.ClubLabel.text = Club.ClubNames[studentJson.Club];
        }
        else
        {
            this.ClubLabel.text = Club.TeacherClubNames[studentJson.Class];
        }
        if (ClubGlobals.GetClubClosed(studentJson.Club))
        {
            this.ClubLabel.text = "No Club";
        }
        this.StrengthLabel.text = StudentInfoScript.StrengthStrings[studentJson.Strength];
        AudioSource component = base.GetComponent <AudioSource>();

        component.enabled = false;
        this.Static.SetActive(false);
        component.volume = 0f;
        component.Stop();
        if (ID < 12 || (ID > 20 && ID < 98))
        {
            WWW www = new WWW(string.Concat(new string[]
            {
                "file:///",
                Application.streamingAssetsPath,
                "/Portraits/Student_",
                ID.ToString(),
                ".png"
            }));
            if (!StudentGlobals.GetStudentReplaced(ID))
            {
                this.Portrait.mainTexture = www.texture;
            }
            else
            {
                this.Portrait.mainTexture = this.BlankPortrait;
            }
        }
        else if (ID == 98)
        {
            this.Portrait.mainTexture = this.GuidanceCounselor;
        }
        else if (ID == 99)
        {
            this.Portrait.mainTexture = this.Headmaster;
        }
        else if (ID == 100)
        {
            this.Portrait.mainTexture = this.InfoChan;
            this.Static.SetActive(true);
            if (!this.StudentInfoMenu.Gossiping && !this.StudentInfoMenu.Distracting && !this.StudentInfoMenu.CyberBullying && !this.StudentInfoMenu.CyberStalking)
            {
                component.enabled = true;
                component.volume  = 1f;
                component.Play();
            }
        }
        else
        {
            this.Portrait.mainTexture = this.StudentInfoMenu.RivalPortraits[ID];
        }
        this.UpdateAdditionalInfo(ID);
        this.CurrentStudent = ID;
        this.UpdateRepChart();
    }