private void buttonDispose_Click(object sender, EventArgs e) { A1 = new IntervalPoint(0, 0); A2 = new IntervalPoint(0, 1); A3 = new IntervalPoint(0, 0); B1 = new IntervalPoint(0, 0); B2 = new IntervalPoint(0, 1); B3 = new IntervalPoint(0, 0); C1 = new IntervalPoint(); C2 = new IntervalPoint(); C3 = new IntervalPoint(); textBoxInputX.Enabled = buttonFindX.Enabled = XisSet = false; textBoxA1.BackColor = textBoxA2.BackColor = textBoxA3.BackColor = textBoxB1.BackColor = textBoxB2.BackColor = textBoxB3.BackColor = textBoxResult.BackColor = textBoxXfromA.BackColor = textBoxXfromB.BackColor = textBoxXfromC.BackColor = textBoxInputX.BackColor = DefaultBoxColor; textBoxA1.Text = textBoxA2.Text = textBoxA3.Text = textBoxB1.Text = textBoxB2.Text = textBoxB3.Text = textBoxResult.Text = textBoxInputX.Text = textBoxXfromA.Text = textBoxXfromB.Text = textBoxXfromC.Text = ""; Graphics graphicDischarge = pictureBoxGraphic.CreateGraphics(); graphicDischarge.Clear(Color.White); labelFullNumberA.Text = "мА(х) = "; labelFullNumberB.Text = "мB(х) = "; labelFullNumberC.Text = "мC(х) = "; labelAalpha.Text = "A alpha ="; labelBalpha.Text = "B alpha ="; labelCalpha.Text = "C alpha ="; richTextBoxLog.Text += "Умова скинута" + endl; counterBunkering = 1; }
private void Calculations(IntervalPoint A1, IntervalPoint A2, IntervalPoint A3, IntervalPoint B1, IntervalPoint B2, IntervalPoint B3) { if (comboBoxOperations.SelectedIndex == 0) { C1.x = A1.x + B1.x; C2.x = A2.x + B2.x; C3.x = A3.x + B3.x; C1.verity = C3.verity = 0; C2.verity = 1; PrintResult(C1, C2, C3); PrintGraphic(); PrintModel('A', A1, A2, A3); PrintModel('B', B1, B2, B3); PrintModel('C', C1, C2, C3); } if (comboBoxOperations.SelectedIndex == 1) { C1.x = A1.x - B3.x; C2.x = A2.x - B2.x; C3.x = A3.x - B1.x; C1.verity = C3.verity = 0; C2.verity = 1; PrintResult(C1, C2, C3); if (checkBoxBunkering.Checked) { PrintResultLog(C1, C2, C3); } PrintGraphic(); PrintModel('A', A1, A2, A3); PrintModel('B', B1, B2, B3); PrintModel('C', C1, C2, C3); } }
private double FindVerity(double X, IntervalPoint point1, IntervalPoint point2, IntervalPoint point3) { double tempVerity = 0; if (X < point1.x) { tempVerity = 0; } if (X == point1.x) { tempVerity = point1.verity; } if (X > point1.x && X < point2.x) { tempVerity = (point2.x * point1.verity - point1.x * point2.verity - X * (point1.verity - point2.verity)) / (point2.x - point1.x); } if (X == point2.x) { tempVerity = point2.verity; } if (X > point2.x && X < point3.x) { tempVerity = (point3.x * point2.verity - point2.x * point3.verity - X * (point2.verity - point3.verity)) / (point3.x - point2.x); } if (X == point3.x) { tempVerity = point3.verity; } if (X > point3.x) { tempVerity = 0; } return(tempVerity); }
private void PrintModel(char tempNumber, IntervalPoint number1, IntervalPoint number2, IntervalPoint number3) { String tempLabelFullNumber = "no data"; String tempLabelAlpha = "no data"; tempLabelFullNumber = "mA(x) = 0, при х <= " + Math.Round(number1.x, 2).ToString() + endl + " (" + Math.Round(number1.x, 2).ToString() + " + x) / " + Math.Round(number2.x - number1.x, 2).ToString() + ", при " + Math.Round(number1.x, 2).ToString() + " <= x <= " + Math.Round(number2.x, 2).ToString() + endl + " (" + Math.Round(number3.x, 2).ToString() + " - x) / " + Math.Round(number3.x - number2.x, 2).ToString() + ", при " + Math.Round(number2.x, 2).ToString() + " <= x <= " + Math.Round(number3.x, 2).ToString() + endl + " 0, при х >= " + Math.Round(number3.x, 2).ToString(); tempLabelAlpha = "A alpha = [" + Math.Round(number1.x, 2).ToString() + " + " + Math.Round(number2.x - number1.x, 2).ToString() + "al, " + Math.Round(number3.x, 2).ToString() + " - " + Math.Round(number3.x - number2.x, 2).ToString() + "al]"; if (tempNumber == 'A') { labelFullNumberA.Text = tempLabelFullNumber; labelAalpha.Text = tempLabelAlpha; } if (tempNumber == 'B') { labelFullNumberB.Text = tempLabelFullNumber; labelBalpha.Text = tempLabelAlpha; } if (tempNumber == 'C') { labelFullNumberC.Text = tempLabelFullNumber; labelCalpha.Text = tempLabelAlpha; } }
void QuickSort(List <IntervalPoint> arr, int low, int high, int[][] intervals) { if (low >= high) { return; } int i = low; int j = high; IntervalPoint temp = arr[i]; //基准值 while (i < j) //从两端向中间扫描,跳出循环时i=j { while (i < j && LessThan(temp, arr[j], intervals)) //从右往左 { j--; } arr[i] = arr[j]; while (i < j && LessThan(arr[i], temp, intervals))//从左往右 { i++; } arr[j] = arr[i]; } arr[i] = temp;// 基准值回归正确位置 QuickSort(arr, low, i - 1, intervals); QuickSort(arr, i + 1, high, intervals); }
public ActionResult DeleteConfirmed(int id) { IntervalPoint intervalPoint = db.IntervalPoints.Find(id); db.IntervalPoints.Remove(intervalPoint); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "IntervalPointID,LowerRange,UpperRange,Name")] IntervalPoint intervalPoint) { if (ModelState.IsValid) { db.Entry(intervalPoint).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(intervalPoint)); }
public ActionResult Create([Bind(Include = "IntervalPointID,LowerRange,UpperRange,Name")] IntervalPoint intervalPoint) { if (ModelState.IsValid) { db.IntervalPoints.Add(intervalPoint); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(intervalPoint)); }
private void PrintResultLog(IntervalPoint C1, IntervalPoint C2, IntervalPoint C3)//только для бункерування { if ((point1ForBunkering.x != C1.x) || (point2ForBunkering.x != C2.x) || (point3ForBunkering.x != C3.x)) { richTextBoxLog.Text += "\tБункерування " + counterBunkering + " :" + endl + "Вантажомісткість [ " + A1.x.ToString() + " , " + A2.x.ToString() + " , " + A3.x.ToString() + " ]" + endl; richTextBoxLog.Text += "Замовлення порту [ " + B1.x.ToString() + " , " + B2.x.ToString() + " , " + B2.x.ToString() + " ]" + endl; richTextBoxLog.Text += "Залишок місця [ " + C1.x.ToString() + " , " + C2.x.ToString() + " , " + C2.x.ToString() + " ]" + endl + endl; point1ForBunkering.x = C1.x; point2ForBunkering.x = C2.x; point3ForBunkering.x = C3.x; counterBunkering++; } }
// GET: IntervalPoints/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } IntervalPoint intervalPoint = db.IntervalPoints.Find(id); if (intervalPoint == null) { return(HttpNotFound()); } return(View(intervalPoint)); }
private void buttonCalculate_Click(object sender, EventArgs e) { bool resultIsDouble, resultRightBunkeringInequality; resultIsDouble = resultRightBunkeringInequality = true; bool resultRightInequality = false; resutlConflictSituasion = false; if (double.TryParse(textBoxA1.Text, out double resultA1) && double.TryParse(textBoxA2.Text, out double resultA2) && double.TryParse(textBoxA3.Text, out double resultA3) && double.TryParse(textBoxB1.Text, out double resultB1) && double.TryParse(textBoxB2.Text, out double resultB2) && double.TryParse(textBoxB3.Text, out double resultB3)) { A1.x = Convert.ToDouble(textBoxA1.Text); A2.x = Convert.ToDouble(textBoxA2.Text); A3.x = Convert.ToDouble(textBoxA3.Text); B1.x = Convert.ToDouble(textBoxB1.Text); B2.x = Convert.ToDouble(textBoxB2.Text); B3.x = Convert.ToDouble(textBoxB3.Text); } else { resultIsDouble = false; richTextBoxLog.Text += "Помилка: Невірно задані дані" + endl; textBoxA1.BackColor = textBoxA2.BackColor = textBoxA3.BackColor = textBoxB1.BackColor = textBoxB2.BackColor = textBoxB3.BackColor = LightRed; } if (resultIsDouble) { if (resultIsDouble && (A1.x <= A2.x && A2.x <= A3.x && A1.x <= A3.x) && (B1.x <= B2.x && B2.x <= B3.x && B1.x <= B3.x)) { resultRightInequality = true; //if bunkering if (checkBoxBunkering.Checked == true) { if (A1.x < 0 || A3.x > maxBunkering) { resultRightBunkeringInequality = false; richTextBoxLog.Text += "Помилка: Вантажомісткість має бути [0, maxBunkering]" + endl; textBoxA1.BackColor = textBoxA2.BackColor = textBoxA3.BackColor = LightRed; } else { if (B1.x < 50) { resultRightBunkeringInequality = false; richTextBoxLog.Text += "Помилка: Замовлення порту має бути не менше 50" + endl; textBoxB1.BackColor = LightRed; } else { if (B1.x > A3.x) { resultRightBunkeringInequality = false; richTextBoxLog.Text += "Помилка: Немає вільного місця на судні" + endl; textBoxA1.BackColor = textBoxA2.BackColor = textBoxA3.BackColor = LightRed; } else { if (B3.x > A1.x) { resultRightBunkeringInequality = true; resutlConflictSituasion = true; richTextBoxLog.Text += "Помилка: Конфліктна ситуація (максимальне замовлення > мінімальної вантажомісткості)" + endl; } //else resultRightBunkeringInequality = true; } } } } } else { richTextBoxLog.Text += "Помилка: Відсутня нерівність А1<=A2<=A3 або B1<=B2<=B3" + endl; textBoxA1.BackColor = textBoxA2.BackColor = textBoxA3.BackColor = textBoxB1.BackColor = textBoxB2.BackColor = textBoxB3.BackColor = LightRed; } } //если все ок if (resultIsDouble && resultRightInequality && resultRightBunkeringInequality) { if (resutlConflictSituasion) { textBoxResult.BackColor = DefaultBoxColor; textBoxResult.Text = ""; C1 = new IntervalPoint(); C2 = new IntervalPoint(); C3 = new IntervalPoint(); textBoxInputX.Enabled = buttonFindX.Enabled = XisSet = false; PrintGraphic(); } else { textBoxA1.BackColor = textBoxA2.BackColor = textBoxA3.BackColor = textBoxB1.BackColor = textBoxB2.BackColor = textBoxB3.BackColor = textBoxResult.BackColor = LightGreen; textBoxInputX.Enabled = buttonFindX.Enabled = true; if (textBoxInputX.Text != "") { FindX(); } else { Calculations(A1, A2, A3, B1, B2, B3); } } } }
private void PrintResult(IntervalPoint C1, IntervalPoint C2, IntervalPoint C3) { textBoxResult.Text = "[" + C1.x.ToString() + ", " + C2.x.ToString() + ", " + C3.x.ToString() + "]"; }
bool LessThan(IntervalPoint a, IntervalPoint b, int[][] intervals) { return(a.value - b.value <= 0); }
protected override void Seed(SBDforum.Models.MyDbContext context) { // This method will be called after migrating to the latest version. // You can use the DbSet<T>.AddOrUpdate() helper extension method // to avoid creating duplicate seed data. E.g. // // context.People.AddOrUpdate( // p => p.FullName, // new Person { FullName = "Andrew Peters" }, // new Person { FullName = "Brice Lambson" }, // new Person { FullName = "Rowan Miller" } // ); // context.Database.ExecuteSqlCommand("Delete from comments"); context.Database.ExecuteSqlCommand("Delete from answers"); context.Database.ExecuteSqlCommand("Delete from threads"); context.Database.ExecuteSqlCommand("Delete from categories"); context.Database.ExecuteSqlCommand("Delete from messages"); context.Database.ExecuteSqlCommand("Delete from users"); context.Database.ExecuteSqlCommand("Delete from rules"); context.Database.ExecuteSqlCommand("Delete from bannedwordsdictionaries"); context.Database.ExecuteSqlCommand("Delete from intervalpoints"); context.SaveChanges(); User u = new Models.User(); // u.UserID = 1; u.Nick = "Witek15"; u.Email = "*****@*****.**"; u.Password = "******"; u.Role = false; u.Avatar = "http://i.wp.pl/a/f/jpeg/20901/walesa_wp_04_550.jpeg"; u.Active = true; context.Users.Add(u); context.SaveChanges(); u = new Models.User(); // u.UserID = 2; u.Nick = "Jola17"; u.Email = "*****@*****.**"; u.Password = "******"; u.Role = false; u.Avatar = "http://images.hellokids.com/_uploads/_tiny_galerie/20131043/vign-pikachu-by5_bb9.jpg"; u.Active = true; context.Users.Add(u); context.SaveChanges(); u = new Models.User(); // u.UserID = 3; u.Nick = "drobiowy07"; u.Email = "*****@*****.**"; u.Password = "******"; u.Role = false; u.Avatar = "http://megaicons.net/static/img/icons_sizes/84/445/256/blue-user-icon.png"; u.Active = true; context.Users.Add(u); context.SaveChanges(); u = new Models.User(); // u.UserID = 4; u.Nick = "wiktor500"; u.Email = "*****@*****.**"; u.Password = "******"; u.Role = false; u.Avatar = "http://www.rmf.fm/_files/Short_foto/625/0e4fb6e75a40f3ac328f8fe2e841898e.jpg"; u.Active = true; context.Users.Add(u); context.SaveChanges(); u = new Models.User(); // u.UserID = 5; u.Nick = "marysia94"; u.Email = "*****@*****.**"; u.Password = "******"; u.Role = false; u.Avatar = "http://www.tapetus.pl/obrazki/n/111055_kotek-apka-klopot.jpg"; u.Active = true; context.Users.Add(u); context.SaveChanges(); u = new Models.User(); // u.UserID = 6; u.Nick = "admin"; u.Email = "*****@*****.**"; u.Password = "******"; u.Role = true; u.Avatar = "http://megaicons.net/static/img/icons_sizes/84/445/256/blue-user-icon.png"; u.Active = true; context.Users.Add(u); context.SaveChanges(); u = new Models.User(); // u.UserID = 7; u.Nick = "u"; u.Email = "u"; u.Password = "******"; u.Role = false; u.Avatar = "http://megaicons.net/static/img/icons_sizes/84/445/256/blue-user-icon.png"; u.Active = true; context.Users.Add(u); context.SaveChanges(); BannedWordsDictionary b = new BannedWordsDictionary(); b.Name = "krucafuks"; context.BannedWordsDictionaries.AddOrUpdate(b); context.SaveChanges(); b = new BannedWordsDictionary(); b.Name = "psia koœæ".ToString(); context.BannedWordsDictionaries.AddOrUpdate(b); context.SaveChanges(); b = new BannedWordsDictionary(); b.Name = "kurka wodna".ToString(); context.BannedWordsDictionaries.AddOrUpdate(b); context.SaveChanges(); b = new BannedWordsDictionary(); b.Name = "pata³ach".ToString(); context.BannedWordsDictionaries.AddOrUpdate(b); context.SaveChanges(); b = new BannedWordsDictionary(); b.Name = "motyla noga".ToString(); context.BannedWordsDictionaries.AddOrUpdate(b); context.SaveChanges(); b = new BannedWordsDictionary(); b.Name = "cholercia".ToString(); context.BannedWordsDictionaries.AddOrUpdate(b); context.SaveChanges(); IntervalPoint i = new IntervalPoint(); i.LowerRange = 0; i.UpperRange = 5; i.Name = "nowicjusz".ToString(); context.IntervalPoints.AddOrUpdate(i); context.SaveChanges(); i = new IntervalPoint(); i.LowerRange = 6; i.UpperRange = 500; i.Name = "pocz¹tkuj¹cy".ToString(); context.IntervalPoints.AddOrUpdate(i); context.SaveChanges(); i = new IntervalPoint(); i.LowerRange = 501; i.UpperRange = 10000; i.Name = "œredniozaawansowany".ToString(); context.IntervalPoints.AddOrUpdate(i); context.SaveChanges(); i = new IntervalPoint(); i.LowerRange = 10001; i.UpperRange = 100000; i.Name = "zaawansowany"; context.IntervalPoints.AddOrUpdate(i); context.SaveChanges(); i = new IntervalPoint(); i.LowerRange = 100001; i.UpperRange = 2147483647; i.Name = "super nerd"; context.IntervalPoints.AddOrUpdate(i); context.SaveChanges(); Rule r = new Rule(); r.Name = "Nie bluzgaj"; r.Text = "Nie u¿ywaj brzydkich s³ów"; context.Rules.AddOrUpdate(r); context.SaveChanges(); r = new Rule(); r.Name = "Pisz poprawnie"; r.Text = "Nie pope³niaj ortografów"; context.Rules.AddOrUpdate(r); context.SaveChanges(); r = new Rule(); r.Name = "Zbieraj punkty"; r.Text = "Zbieraj¹c punkty zdobywasz wy¿szy level"; context.Rules.AddOrUpdate(r); context.SaveChanges(); r = new Rule(); r.Name = "Myj rêce"; r.Text = "Myj d³onie przed posi³kiem"; context.Rules.AddOrUpdate(r); context.SaveChanges(); r = new Rule(); r.Name = "Szanuj rodziców"; r.Text = "Zadzwoñ do mamy"; context.Rules.AddOrUpdate(r); context.SaveChanges(); int ids, idr; ids = context.Users.Where(n => n.Nick == "Witek15").Select(n => n.UserID).FirstOrDefault(); idr = context.Users.Where(n => n.Nick == "Jola17").Select(n => n.UserID).FirstOrDefault(); Message m = new Message(); m.SenderID = ids; m.ReceiverID = idr; m.Text = "czeœæ"; m.Date = new DateTime(2016, 11, 20, 10, 10, 10); m.Read = true; context.Messages.AddOrUpdate(m); context.SaveChanges(); ids = context.Users.Where(n => n.Nick == "Jola17").Select(n => n.UserID).FirstOrDefault(); idr = context.Users.Where(n => n.Nick == "Witek15").Select(n => n.UserID).FirstOrDefault(); m = new Message(); m.SenderID = ids; m.ReceiverID = idr; m.Text = "no czeœæ"; m.Read = true; m.Date = new DateTime(2016, 11, 20, 10, 10, 15); context.Messages.AddOrUpdate(m); context.SaveChanges(); ids = context.Users.Where(n => n.Nick == "Witek15").Select(n => n.UserID).FirstOrDefault(); idr = context.Users.Where(n => n.Nick == "Jola17").Select(n => n.UserID).FirstOrDefault(); m = new Message(); m.SenderID = ids; m.ReceiverID = idr; m.Text = "idziemy na piwo?"; m.Read = true; m.Date = new DateTime(2016, 11, 20, 10, 11, 5); context.Messages.AddOrUpdate(m); context.SaveChanges(); ids = context.Users.Where(n => n.Nick == "Jola17").Select(n => n.UserID).FirstOrDefault(); idr = context.Users.Where(n => n.Nick == "Witek15").Select(n => n.UserID).FirstOrDefault(); m = new Message(); m.SenderID = ids; m.ReceiverID = idr; m.Text = "za 15 minut na murkach"; m.Read = true; m.Date = new DateTime(2016, 11, 20, 10, 11, 17); context.Messages.AddOrUpdate(m); context.SaveChanges(); ids = context.Users.Where(n => n.Nick == "Witek15").Select(n => n.UserID).FirstOrDefault(); idr = context.Users.Where(n => n.Nick == "Jola17").Select(n => n.UserID).FirstOrDefault(); m = new Message(); m.SenderID = ids; m.ReceiverID = idr; m.Text = "elo"; m.Read = true; m.Date = new DateTime(2016, 11, 20, 10, 11, 29); context.Messages.AddOrUpdate(m); context.SaveChanges(); Category c = new Category(); // c.CategoryID = 1; c.Name = "Linux"; c.Description = "W¹tki o Linuxie"; context.Categories.AddOrUpdate(c); context.SaveChanges(); c = new Category(); // c.CategoryID = 2; c.Name = "Monitory"; c.Description = "W¹tki o Monitorach"; context.Categories.AddOrUpdate(c); context.SaveChanges(); c = new Category(); // c.CategoryID = 3; c.Name = "Myszki"; c.Description = "W¹tki o Myszach"; context.Categories.AddOrUpdate(c); context.SaveChanges(); c = new Category(); // c.CategoryID = 4; c.Name = "Laptopy"; c.Description = "W¹tki o Laptopach"; context.Categories.AddOrUpdate(c); context.SaveChanges(); c = new Category(); //c.CategoryID = 5; c.Name = "MVC"; c.Description = "W¹tki o MVC"; context.Categories.AddOrUpdate(c); context.SaveChanges(); c = new Category(); // c.CategoryID = 6; c.Name = "Programowanie"; c.Description = "W¹tki o Programowaniu"; context.Categories.AddOrUpdate(c); context.SaveChanges(); int ui, ci, ai, ti; ui = context.Users.Where(n => n.Nick == "Witek15").Select(n => n.UserID).FirstOrDefault(); ci = context.Categories.Where(n => n.Name == "Linux").Select(n => n.CategoryID).FirstOrDefault(); Thread t = new Thread(); t.CategoryID = ci; t.UserID = ui; t.Title = "Co to jest grep?"; t.Date = new DateTime(2016, 11, 20, 07, 50, 37); context.Threads.AddOrUpdate(t); context.SaveChanges(); ui = context.Users.Where(n => n.Nick == "wiktor500").Select(n => n.UserID).FirstOrDefault(); ci = context.Categories.Where(n => n.Name == "Myszki").Select(n => n.CategoryID).FirstOrDefault(); t = new Thread(); t.CategoryID = ci; t.UserID = ui; t.Title = "Jaka najlepsza myszka do grania?"; t.Date = new DateTime(2016, 11, 20, 07, 52, 37); context.Threads.AddOrUpdate(t); context.SaveChanges(); ui = context.Users.Where(n => n.Nick == "wiktor500").Select(n => n.UserID).FirstOrDefault(); ci = context.Categories.Where(n => n.Name == "Myszki").Select(n => n.CategoryID).FirstOrDefault(); t = new Thread(); t.CategoryID = ci; t.UserID = ui; t.Title = "Myszka przewodowa czy bezprzewodowa?"; t.Date = new DateTime(2016, 11, 20, 07, 54, 37); context.Threads.AddOrUpdate(t); context.SaveChanges(); ui = context.Users.Where(n => n.Nick == "marysia94").Select(n => n.UserID).FirstOrDefault(); ci = context.Categories.Where(n => n.Name == "MVC").Select(n => n.CategoryID).FirstOrDefault(); t = new Thread(); t.CategoryID = ci; t.UserID = ui; t.Title = "Areas in MVC?"; t.Date = new DateTime(2016, 11, 20, 07, 56, 37); context.Threads.AddOrUpdate(t); context.SaveChanges(); ui = context.Users.Where(n => n.Nick == "wiktor500").Select(n => n.UserID).FirstOrDefault(); ci = context.Categories.Where(n => n.Name == "Laptopy").Select(n => n.CategoryID).FirstOrDefault(); t = new Thread(); t.CategoryID = ci; t.UserID = ui; t.Title = "Jaki laptop do gier do 3000z³?"; t.Date = new DateTime(2016, 11, 20, 07, 58, 37); context.Threads.AddOrUpdate(t); context.SaveChanges(); ui = context.Users.Where(n => n.Nick == "wiktor500").Select(n => n.UserID).FirstOrDefault(); ti = context.Threads.Where(n => n.Title == "Co to jest grep?").Select(n => n.ThreadID).FirstOrDefault(); Answer a = new Models.Answer(); a.ThreadID = ti; a.UserID = ui; a.Text = "To wyszukiwanie"; a.Points = 2; a.Date = new DateTime(2016, 11, 20, 08, 50, 37); context.Answers.AddOrUpdate(a); context.SaveChanges(); ui = context.Users.Where(n => n.Nick == "Jola17").Select(n => n.UserID).FirstOrDefault(); ti = context.Threads.Where(n => n.Title == "Myszka przewodowa czy bezprzewodowa?").Select(n => n.ThreadID).FirstOrDefault(); a = new Models.Answer(); a.ThreadID = ti; a.UserID = ui; a.Text = "Zdecydowanie bezprzewodowa"; a.Points = 3; a.Date = new DateTime(2016, 11, 20, 09, 52, 37); context.Answers.AddOrUpdate(a); context.SaveChanges(); ui = context.Users.Where(n => n.Nick == "drobiowy07").Select(n => n.UserID).FirstOrDefault(); ti = context.Threads.Where(n => n.Title == "Myszka przewodowa czy bezprzewodowa?").Select(n => n.ThreadID).FirstOrDefault(); a = new Models.Answer(); a.ThreadID = ti; a.UserID = ui; a.Text = "Polecam przewodow¹"; a.Points = 1; a.Date = new DateTime(2016, 11, 20, 09, 50, 37); context.Answers.AddOrUpdate(a); context.SaveChanges(); ui = context.Users.Where(n => n.Nick == "wiktor500").Select(n => n.UserID).FirstOrDefault(); ti = context.Threads.Where(n => n.Title == "Myszka przewodowa czy bezprzewodowa?").Select(n => n.ThreadID).FirstOrDefault(); a = new Models.Answer(); a.ThreadID = ti; a.UserID = ui; a.Text = "Bezprzewodowe lepsze. W przewodowych kable denerwuj¹ce"; a.Points = 0; a.Date = new DateTime(2016, 11, 20, 09, 54, 37); context.Answers.AddOrUpdate(a); context.SaveChanges(); ui = context.Users.Where(n => n.Nick == "Witek15").Select(n => n.UserID).FirstOrDefault(); ti = context.Threads.Where(n => n.Title == "Myszka przewodowa czy bezprzewodowa?").Select(n => n.ThreadID).FirstOrDefault(); a = new Models.Answer(); a.ThreadID = ti; a.UserID = ui; a.Text = "Je¿eli do stacjonarnego, to przewodowa. Do laptopa bezprzewodowa."; a.Points = 2; a.Date = new DateTime(2016, 11, 20, 09, 51, 37); context.Answers.AddOrUpdate(a); context.SaveChanges(); ui = context.Users.Where(n => n.Nick == "Witek15").Select(n => n.UserID).FirstOrDefault(); ai = context.Answers.Where(n => n.Text == "Zdecydowanie bezprzewodowa").Select(n => n.AnswerID).FirstOrDefault(); Comment cm = new Comment(); cm.AnswerID = ai; cm.UserID = ui; cm.Text = "Popieram! Jedyne s³uszne rozwi¹zanie!"; cm.Date = new DateTime(2016, 11, 20, 09, 53, 37); context.Comments.AddOrUpdate(cm); context.SaveChanges(); ui = context.Users.Where(n => n.Nick == "drobiowy07").Select(n => n.UserID).FirstOrDefault(); ai = context.Answers.Where(n => n.Text == "Zdecydowanie bezprzewodowa").Select(n => n.AnswerID).FirstOrDefault(); cm = new Comment(); cm.AnswerID = ai; cm.UserID = ui; cm.Text = "Dok³adnie, nie trzeba sie mêczyc z kabelkiem"; cm.Date = new DateTime(2016, 11, 20, 09, 54, 37); context.Comments.AddOrUpdate(cm); context.SaveChanges(); ui = context.Users.Where(n => n.Nick == "Jola17").Select(n => n.UserID).FirstOrDefault(); ai = context.Answers.Where(n => n.Text == "Bezprzewodowe lepsze. W przewodowych kable denerwuj¹ce").Select(n => n.AnswerID).FirstOrDefault(); cm = new Comment(); cm.AnswerID = ai; cm.UserID = ui; cm.Text = "W jakim sensie denerwuj¹ce?"; cm.Date = new DateTime(2016, 11, 20, 11, 50, 37); context.Comments.AddOrUpdate(cm); context.SaveChanges(); ui = context.Users.Where(n => n.Nick == "drobiowy07").Select(n => n.UserID).FirstOrDefault(); ai = context.Answers.Where(n => n.Text == "Bezprzewodowe lepsze. W przewodowych kable denerwuj¹ce").Select(n => n.AnswerID).FirstOrDefault(); cm = new Comment(); cm.AnswerID = ai; cm.UserID = ui; cm.Text = "¯e trzeba je zwijaæ i rozwijaæ i siê pl¹cz¹."; cm.Date = new DateTime(2016, 11, 20, 12, 50, 37); context.Comments.AddOrUpdate(cm); context.SaveChanges(); ui = context.Users.Where(n => n.Nick == "drobiowy07").Select(n => n.UserID).FirstOrDefault(); ai = context.Answers.Where(n => n.Text == "Je¿eli do stacjonarnego, to przewodowa. Do laptopa bezprzewodowa.").Select(n => n.AnswerID).FirstOrDefault(); cm = new Comment(); cm.AnswerID = ai; cm.UserID = ui; cm.Text = "Przy stacjonarnym kabel nie przeszkadza. A jak do laptopa to szybciej bez kabla."; cm.Date = new DateTime(2016, 11, 20, 15, 50, 37); context.Comments.AddOrUpdate(cm); context.SaveChanges(); }