private void PrintReference() { human _human = _fe.humans.FirstOrDefault(id => id.idh == _humanid); if (_reference != EnumPReferences.NoReference) { ReferenceFactory refsfactory = new ReferenceFactory(_human, _ge, _fe); try { refsfactory.GetReference(new List <int> { _testresult.idtr }, _reference).Print(true); } catch (Exception ex) { MessageBox.Show(ex.Message); } } else { try{ ReportFactory.CreateReport(_test, _human, _testresult, _ge, _fe, false).Print(true); } catch (Exception ex) { MessageBox.Show(ex.Message); } } }
static void Main(string[] args) { Console.WriteLine("Zadanie 1"); Console.ReadLine(); Pegas pegas = new Pegas(); Console.ReadLine(); Console.WriteLine("Zadanie 2"); Cat cat = new Cat(); cat.CatInformation(); Console.ReadLine(); Dog dog = new Dog(); dog.DogInformation(); Console.ReadLine(); Console.WriteLine("Zadanie 3"); human chel = new human(); chel.fishInfo(); chel.aniamalInfo(); chel.apeInfo(); chel.humanInfo(); Console.ReadLine(); Console.WriteLine("Zadanie 4"); Cat cat1 = new Cat(); Console.WriteLine($"Возраст кота: {cat1.CatAge}, вес кота: {cat1.CatWeight}"); Console.WriteLine("Кот имеет " + cat1.PoluchenieDannih()); Console.ReadLine(); }
static void Main(string[] args) { // xml human czlowiek = new human("Bartosz", "Medycki", 22); StreamWriter wr = new StreamWriter("plikXmlTest.xml"); XmlSerializer xml = new XmlSerializer(typeof(human)); xml.Serialize(wr, czlowiek); wr.Flush(); wr.Close(); StreamReader read = new StreamReader("plikXmlTest.xml"); human c = (human)xml.Deserialize(read); Console.WriteLine("XML : " + c); // json string test = JsonConvert.SerializeObject(czlowiek); File.WriteAllText(@"C:\Users\barme\OneDrive\Pulpit\Nowy folder\TestyXmliJson", test); string testRead = File.ReadAllText(@"C:\Users\barme\OneDrive\Pulpit\Nowy folder\TestyXmliJson"); human SerializedHuman = JsonConvert.DeserializeObject <human>(testRead); Console.WriteLine("Json : " + SerializedHuman); Console.ReadLine(); }
public DTestReport(human human, testresult testresult, pBaseEntities ge, fBaseEntities fe, bool WithResult) { _testresult = testresult; _human = human; _ge = ge; _fe = fe; _withresult = WithResult; _listscales = new List <IScale>(); // 1 level _listscales.Add(new DScaleL(GetAnswersFromBase(), _ge)); _listscales.Add(new DScaleF(GetAnswersFromBase(), _ge)); _listscales.Add(new DScaleK(GetAnswersFromBase(), _ge)); _listscales.Add(new DScaleHS(GetAnswersFromBase(), _ge, new DScaleK(GetAnswersFromBase(), _ge))); _listscales.Add(new DScaleD(GetAnswersFromBase(), _ge)); _listscales.Add(new DScaleHY(GetAnswersFromBase(), _ge)); _listscales.Add(new DScalePD(GetAnswersFromBase(), _ge, new DScaleK(GetAnswersFromBase(), _ge))); _listscales.Add(new DScaleMF(GetAnswersFromBase(), _ge)); _listscales.Add(new DScalePA(GetAnswersFromBase(), _ge)); _listscales.Add(new DScalePT(GetAnswersFromBase(), _ge, new DScaleK(GetAnswersFromBase(), _ge))); _listscales.Add(new DScaleSC(GetAnswersFromBase(), _ge, new DScaleK(GetAnswersFromBase(), _ge))); _listscales.Add(new DScaleMA(GetAnswersFromBase(), _ge, new DScaleK(GetAnswersFromBase(), _ge))); _listscales.Add(new DScaleSI(GetAnswersFromBase(), _ge)); //2 level _listscales.Add(new DScaleAC(GetAnswersFromBase(), _ge)); _listscales.Add(new DScalePC(GetAnswersFromBase(), _ge)); _listscales.Add(new DScaleDAN(GetAnswersFromBase(), _ge)); //3 level _listscales.Add(new DScaleDS(GetAnswersFromBase(), _ge)); _listscales.Add(new DScaleNPU(GetAnswersFromBase(), _ge)); _listscales.Add(new DScaleCS(GetAnswersFromBase(), _ge)); _listscales.Add(new DScaleMN(GetAnswersFromBase(), _ge)); //4 level _listscales.Add(new DScaleLAP(GetAnswersFromBase(), _ge)); // _listscales.Add(new DScaleKL(GetAnswersFromBase(),_human, _ge)); }
void Start() { List <human> myList = new List <human>(); //使用Add添加成员,不能添加不同类型的成员 myList.Add(new human("Tom")); myList.Add(new human("Mary")); //myList.Add(new animal()); //使用Insert添加成员 myList.Insert(1, new human("Jane")); //取列表中成员总数 print("Total Number of members: " + myList.Count); //使用IndexOf和LastIndexOf获取成员编号 human targetHuman = new human("X"); myList.Insert(2, targetHuman); myList.Add(targetHuman); print("Index of targetHuman: " + myList.IndexOf(targetHuman)); print("Last index of targetHuman: " + myList.LastIndexOf(targetHuman)); //访问成员 myList[2].name = "Y"; print("Now, changed to: " + myList[myList.LastIndexOf(targetHuman)].name); //foreach循环 foreach (human iterator in myList) { print(iterator.name); } }
private void LoadTestresults() { dg_testresults.Rows.Clear(); if (_currenthumanid != 0) { human h = _fe.humans.First(hh => hh.idh == _currenthumanid); h.testresults.Load(); IEnumerable <testresult> query = h.testresults.OrderBy(tst => tst.testdate); foreach (testresult tr in query) { string[] row = { tr.idtr.ToString(), tr.testid.ToString(), false.ToString(), tr.testdate.ToString(), _ge.testsparams.First(tp => tp.idt == tr.testid).description.ToString(), tr.mode }; dg_testresults.Rows.Add(row); } } }
private void btn_show_answers_Click(object sender, EventArgs e) { List <int> _listidtr = new List <int>(); foreach (DataGridViewRow r in dg_testresults.Rows) { if (Convert.ToBoolean(r.Cells[2].Value) == true) { _listidtr.Add(Convert.ToInt16(r.Cells[0].Value)); } } if (_listidtr.Count() != 0) { foreach (int i in _listidtr) { human h = _fe.humans.First(hh => hh.idh == _currenthumanid); testresult t = _fe.testresults.First(tr => tr.idtr == i); if (_ge.testsparams.First(tp => tp.idt == t.testid).answerscount != 0) { TestResultForm testform = new TestResultForm(t, h.idh, _ge, _fe); testform.Height = System.Windows.Forms.Screen.PrimaryScreen.WorkingArea.Height; testform.ShowDialog(); } } } else { MessageBox.Show("Нужно выбрать хоть один тест"); } }
public KettellATestReport(human human, testresult testresult, pBaseEntities ge, fBaseEntities fe, bool WithResult) { _testresult = testresult; _human = human; _ge = ge; _fe = fe; _withresult = WithResult; _listscales = new List <IScale>(); _listscales.Add(new KettellScaleA(this.GetAnswersFromBase(), _ge, EnumKettellType.AForm)); _listscales.Add(new KettellScaleB(this.GetAnswersFromBase(), _ge, EnumKettellType.AForm)); _listscales.Add(new KettellScaleC(this.GetAnswersFromBase(), _ge, EnumKettellType.AForm)); _listscales.Add(new KettellScaleE(this.GetAnswersFromBase(), _ge, EnumKettellType.AForm)); _listscales.Add(new KettellScaleF(this.GetAnswersFromBase(), _ge, EnumKettellType.AForm)); _listscales.Add(new KettellScaleG(this.GetAnswersFromBase(), _ge, EnumKettellType.AForm)); _listscales.Add(new KettellScaleH(this.GetAnswersFromBase(), _ge, EnumKettellType.AForm)); _listscales.Add(new KettellScaleI(this.GetAnswersFromBase(), _ge, EnumKettellType.AForm)); _listscales.Add(new KettellScaleL(this.GetAnswersFromBase(), _ge, EnumKettellType.AForm)); _listscales.Add(new KettellScaleM(this.GetAnswersFromBase(), _ge, EnumKettellType.AForm)); _listscales.Add(new KettellScaleN(this.GetAnswersFromBase(), _ge, EnumKettellType.AForm)); _listscales.Add(new KettellScaleO(this.GetAnswersFromBase(), _ge, EnumKettellType.AForm)); _listscales.Add(new KettellScaleQ1(this.GetAnswersFromBase(), _ge, EnumKettellType.AForm)); _listscales.Add(new KettellScaleQ2(this.GetAnswersFromBase(), _ge, EnumKettellType.AForm)); _listscales.Add(new KettellScaleQ3(this.GetAnswersFromBase(), _ge, EnumKettellType.AForm)); _listscales.Add(new KettellScaleQ4(this.GetAnswersFromBase(), _ge, EnumKettellType.AForm)); }
private void btn_printresult_Click(object sender, EventArgs e) { List <int> _listidtr = new List <int>(); foreach (DataGridViewRow r in dg_testresults.Rows) { if (Convert.ToBoolean(r.Cells[2].Value) == true) { _listidtr.Add(Convert.ToInt16(r.Cells[0].Value)); } } if (_listidtr.Count() != 0) { foreach (int i in _listidtr) { human h = _fe.humans.First(hh => hh.idh == _currenthumanid); testresult t = _fe.testresults.First(tr => tr.idtr == i); ITestReport rep = ReportFactory.CreateReport((EnumPTests)t.testid, h, t, _ge, _fe, false); rep.Print(); } } else { MessageBox.Show("Нужно выбрать хоть один тест"); } }
public MDTestReport(human human, testresult testresult, pBaseEntities ge, fBaseEntities fe, bool WithResult) { _testresult = testresult; _human = human; _ge = ge; _fe = fe; _withresult = WithResult; _listscales = new List <IScale>(); int ages = (_testresult.testdate.Date - _human.birthday.Value.Date).Days / 365; MDAnswers _answers = GetAnswersFromBase(); MDScaleAnamnes _anamnes = new MDScaleAnamnes(_answers, _ge); MDScaleLie _lie = new MDScaleLie(_answers, _ge); MDScaleM1_1 _m1_1 = new MDScaleM1_1(_answers, _ge); MDScaleM1_2 _m1_2 = new MDScaleM1_2(_answers, _ge); MDScaleM1 _m1 = new MDScaleM1(_answers, _ge, _m1_1, _m1_2); MDScaleM2 _m2 = new MDScaleM2(_answers, _ge); MDScaleM2_1 _m2_1 = new MDScaleM2_1(_answers, _ge); MDScaleM2_2 _m2_2 = new MDScaleM2_2(_answers, _ge); MDScaleM2_3 _m2_3 = new MDScaleM2_3(_answers, _ge); MDScaleM3 _m3 = new MDScaleM3(_answers, _ge); MDScaleM3_1 _m3_1 = new MDScaleM3_1(_answers, _ge); MDScaleM3_2 _m3_2 = new MDScaleM3_2(_answers, _ge); MDScaleM3_3 _m3_3 = new MDScaleM3_3(_answers, _ge); MDScaleM3_4 _m3_4 = new MDScaleM3_4(_answers, _ge); MDScaleM3_5 _m3_5 = new MDScaleM3_5(_answers, _ge); MDScaleM3_6 _m3_6 = new MDScaleM3_6(_answers, _ge); MDScaleIntegral _integral = new MDScaleIntegral(_anamnes, _lie, _m1, _m2, _m3); _listscales.Add(_lie); _listscales.Add(_anamnes); _listscales.Add(_m1); if (_withresult == true) { _listscales.Add(_m1_1); _listscales.Add(_m1_2); } _listscales.Add(_m2); if (_withresult == true) { _listscales.Add(_m2_1); _listscales.Add(_m2_2); _listscales.Add(_m2_3); } _listscales.Add(_m3); if (_withresult == true) { _listscales.Add(_m3_1); _listscales.Add(_m3_2); _listscales.Add(_m3_3); _listscales.Add(_m3_4); _listscales.Add(_m3_5); _listscales.Add(_m3_6); } _listscales.Add(_integral); }
static void Main(string[] args) { human myHuman = new human(); myHuman.makeSound(); cat myCat = new cat(); myCat.makeSound(); }
public PNNTestReport(human human, testresult testresult, pBaseEntities ge, fBaseEntities fe) { _testresult = testresult; _human = human; _ge = ge; _fe = fe; _listscales = new List <IScale>(); _listscales.Add(new PNNScale(this.GetAnswersFromBase())); }
static void Main(string[] args) { human me = new human(); me.legs = 2; me.lfType = "Human"; me.name = "Paul"; Console.WriteLine(me.name); }
public ReferenceFactory(human human, pBaseEntities ge, fBaseEntities fe) { _ge = ge; _fe = fe; _human = human; _human.testresults.Load(); _evalrefs = new List <string[]>(); this.GetEvalRefs(); }
public void attack(object val) { human enemy = val as human; int attack = 5 * strength; if (enemy != null) { enemy.health = 5 * strength; } }
public void addPass(human passanger) { try { pass.Add(passanger); } catch { } }
public void steal(object enemy) { human opponent = enemy as human; if (opponent != null) { health += 10; attack(opponent); } }
private bool HumanIsExist(human h) { if (h.firstname == this.FirstName & h.secondname == this.SecondName & h.lastname == this.LastName & h.birthday == this.BirthDay) { return(true); } else { return(false); } }
public void CreateRandomHuman() { human v = new human(0); int index = units.add(v); if (index >= 0) { ((human)units.get(index)).create(index); ((human)units.get(index)).spawn(100, 100); //((animal)units.get(index)).ai.wander(true); } }
public PTestReport(human human, testresult testresult, pBaseEntities ge, fBaseEntities fe, bool WithResult) { _testresult = testresult; _human = human; _ge = ge; _fe = fe; _withresult = WithResult; _listscales = new List <IScale>(); _listscales.Add(new PScaleI(GetAnswersFromBase(), _ge)); _listscales.Add(new PScaleNPU(GetAnswersFromBase(), _ge)); }
public void death_blow(object enemy) { human opponent = enemy as human; if (enemy != null) { if (opponent.health < 50) { opponent.health = 0; } } }
public static ITestReport CreateReport(EnumPTests test, human human, testresult testresult, pBaseEntities ge, fBaseEntities fe, bool withresult) { ITestReport _genreport = null; switch (test) { case EnumPTests.KettellC: _genreport = new KettellCTestReport(human, testresult, ge, fe, withresult); break; case EnumPTests.PNN: _genreport = new PNNTestReport(human, testresult, ge, fe); break; case EnumPTests.Adaptability: _genreport = new DTestReport(human, testresult, ge, fe, withresult); break; case EnumPTests.FPI: _genreport = new FPITestReport(human, testresult, ge, fe, withresult); break; case EnumPTests.KettellA: _genreport = new KettellATestReport(human, testresult, ge, fe, withresult); break; case EnumPTests.Modul2: _genreport = new MDTestReport(human, testresult, ge, fe, withresult); break; case EnumPTests.Contrasts: _genreport = new ContrastsTestReport(human, testresult, ge, fe); break; case EnumPTests.Prognoz: _genreport = new PTestReport(human, testresult, ge, fe, withresult); break; case EnumPTests.Addictive: _genreport = new ATestReport(human, testresult, ge, fe, withresult); break; case EnumPTests.NPNA: _genreport = new NPNTestReport(human, testresult, ge, fe, withresult); break; case EnumPTests.Leongard: _genreport = new LTestReport(human, testresult, ge, fe, withresult); break; } return(_genreport); }
static void Main(string[] args) { string name = "Nasif"; for (int i = 0; i < 5; i++) { Console.WriteLine("Hello World!"); } Console.WriteLine("Hello " + name); human x = new human("Nasif"); Console.WriteLine("Hello there new object " + x.myName()); }
private void FillReferences() { dg_references.Rows.Clear(); if (_currenthumanid != 0) { dg_references.Rows.Clear(); human h = _fe.humans.First(hh => hh.idh == _currenthumanid); _referfactory = new ReferenceFactory(h, _ge, _fe); for (int rowindex = 0; rowindex < _referfactory.EvalRefs.Count; rowindex++) { dg_references.Rows.Add(_referfactory.EvalRefs[rowindex]); } } }
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(); } }
static void Main(string[] args) { fish shark = new fish(); shark.size = "large"; shark.lfType = "Fish"; shark.name = "Jaws"; Console.WriteLine(shark.name); human me = new human(); me.legs = 2; me.lfType = "Human"; me.name = "Paul"; Console.WriteLine(me.name); }
public void DeleteHuman() { try { if (_fe != null) { human h = _fe.humans.First(hu => hu.idh == this.Id); if (MessageBox.Show("Вы действительно хотите удалить этого замечательного человека со всеми результатами тестов???", "Удаление записи", MessageBoxButtons.YesNo) == DialogResult.Yes) { h.testresults.Load(); _fe.humans.DeleteObject(h); _fe.SaveChanges(); } } } catch (InvalidOperationException) { MessageBox.Show("Человека с указанным id в базе нет"); } }
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 LTestReport(human human, testresult testresult, pBaseEntities ge, fBaseEntities fe, bool WithResult) { _testresult = testresult; _human = human; _ge = ge; _fe = fe; _withresult = WithResult; _listscales = new List <IScale>(); _listscales.Add(new LScaleG1(GetAnswersFromBase(), _ge)); _listscales.Add(new LScaleG2(GetAnswersFromBase(), _ge)); _listscales.Add(new LScaleG3(GetAnswersFromBase(), _ge)); _listscales.Add(new LScaleG4(GetAnswersFromBase(), _ge)); _listscales.Add(new LScaleG5(GetAnswersFromBase(), _ge)); _listscales.Add(new LScaleG6(GetAnswersFromBase(), _ge)); _listscales.Add(new LScaleG7(GetAnswersFromBase(), _ge)); _listscales.Add(new LScaleG8(GetAnswersFromBase(), _ge)); _listscales.Add(new LScaleG9(GetAnswersFromBase(), _ge)); _listscales.Add(new LScaleG10(GetAnswersFromBase(), _ge)); }
public FPITestReport(human human, testresult testresult, pBaseEntities ge, fBaseEntities fe, bool WithResult) { _testresult = testresult; _human = human; _ge = ge; _fe = fe; _withresult = WithResult; _listscales = new List <IScale>(); _listscales.Add(new FPIScaleI(this.GetAnswersFromBase(), _ge)); _listscales.Add(new FPIScaleII(this.GetAnswersFromBase(), _ge)); _listscales.Add(new FPIScaleIII(this.GetAnswersFromBase(), _ge)); _listscales.Add(new FPIScaleIV(this.GetAnswersFromBase(), _ge)); _listscales.Add(new FPIScaleV(this.GetAnswersFromBase(), _ge)); _listscales.Add(new FPIScaleVI(this.GetAnswersFromBase(), _ge)); _listscales.Add(new FPIScaleVII(this.GetAnswersFromBase(), _ge)); _listscales.Add(new FPIScaleVIII(this.GetAnswersFromBase(), _ge)); _listscales.Add(new FPIScaleIX(this.GetAnswersFromBase(), _ge)); _listscales.Add(new FPIScaleX(this.GetAnswersFromBase(), _ge)); _listscales.Add(new FPIScaleXI(this.GetAnswersFromBase(), _ge)); _listscales.Add(new FPIScaleXII(this.GetAnswersFromBase(), _ge)); }