public void ResultsToBase() { NPNAnswers Answers = tkf.ktl.Answers; XmlSerializer mySerializer = new XmlSerializer(typeof(NPNAnswers)); StringWriter myWriter = new StringWriter(); mySerializer.Serialize(myWriter, Answers); testresult t = testresult.Createtestresult(0, _humanid, DateTime.Now, (int)EnumPTests.NPNA, myWriter.ToString(), "auto"); _fe.testresults.AddObject(t); _fe.SaveChanges(); myWriter.Close(); }
public void ResultsToBase() { KettellAnswers Answers = tkf.ktl.Answers; XmlSerializer mySerializer = new XmlSerializer(typeof(KettellAnswers)); StringWriter myWriter = new StringWriter(); mySerializer.Serialize(myWriter, Answers); human h = _fe.humans.First(hh => hh.idh == _humanid); h.testresults.Load(); testresult t = testresult.Createtestresult(0, _humanid, DateTime.Now, (int)EnumPTests.KettellA, myWriter.ToString(), "auto"); _fe.testresults.AddObject(t); _fe.SaveChanges(); myWriter.Close(); }
public void AddHuman() { if (this.FindHuman() != true) { if (_fe != null) { human h = human.Createhuman(0, this.SecondName); h.firstname = this.FirstName; h.lastname = this.LastName; h.birthday = this.BirthDay; h.additinfo = this.AdditionalInfo; h.educationid = this.EducationID; h.genderid = this.GenderID; h.departmentid = this.DepartmentID; _fe.humans.AddObject(h); _fe.SaveChanges(); } } else { MessageBox.Show("Похоже, что такой человек с такой фамилией, именем, отчеством и днем рождения есть в базе"); } }
private void btn_add_Click(object sender, EventArgs e) { if (IsExist(this.txt_dep.Text) == false & this.txt_dep.Text.Trim() != "") { department d = department.Createdepartment(0, this.txt_dep.Text.Trim().ToUpper()); _fe.departments.AddObject(d); _fe.SaveChanges(); LoadDepsInList(); } else { MessageBox.Show("Такое подразделение уже в базе"); } }
private void DelHuman(int idh) { if (_fe.humans.Count(h => h.idh == idh) != 0) { human dh = _fe.humans.First(h => h.idh == idh); _fe.humans.DeleteObject(dh); _fe.SaveChanges(); if (_fe.humans.Count() == 0) { _currenthumanid = 0; } this.LoadTestresults(); this.FillReferences(); } }