private void But_Click(object sender, RoutedEventArgs e) { using (RYAD db = new RYAD()) { USER T = db.Users.Check(Log.Text, Pass.Password.GetHashCode().ToString()); if (T != null) { App.CurrentUser = T; if (App.CurrentUser.lvl == 1) { App.normal = new normal(); try { App.normal.Resources.Add("CurrentUser", App.CurrentUser.username); App.normal.Show(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } else { App.newbee = new MainWindow(); App.newbee.Resources.Add("CurrentUser", App.CurrentUser.username); App.newbee.Show(); } this.Close(); } else { Log.BorderBrush = new SolidColorBrush(Colors.Red); Pass.BorderBrush = new SolidColorBrush(Colors.Red); validate.Visibility = Visibility.Visible; } } }
public history(string t, string t1) { InitializeComponent(); currentuser = t; using (RYAD list = new RYAD()) { var G = list.Ryads.GetAll(currentuser); if (t1 == "menu2") { G = from p in G where p.date > DateTime.Today.AddDays(-30) select p; } if (t1 == "menu3") { G = from p in G where p.date > DateTime.Today.AddDays(-7) select p; } if (t1 == "menu4") { G = from p in G where p.date == DateTime.Today select p; } picdownloader.index = list.Ryads.Count(); foreach (Generator m in G) { Border border = new Border(); border.BorderThickness = new Thickness(0, 1, 0, 1); border.BorderBrush = new SolidColorBrush(Colors.Black); Grid Y = new Grid(); Y.Height = 70; Y.Background = new SolidColorBrush(Colors.White); Y.MouseEnter += backmark; Y.MouseLeave += backmark1; Y.MouseDown += backmark2; Y.Name = "nn" + m.Id; all.Children.Add(border); BitmapImage bi3 = new BitmapImage(); bi3.BeginInit(); bi3.UriSource = new Uri(AppDomain.CurrentDomain.BaseDirectory + "\\pics\\ryad" + m.Id + ".gif", UriKind.Absolute); bi3.EndInit(); Image K = new Image(); K.Margin = new Thickness(0, 10, 300, 10); K.Source = bi3; Label Shod = new Label(); Shod.Content = "Дата создания: " + m.date.ToString().Substring(0, 10); Shod.Margin = new Thickness(500, 5, 100, 0); Label Shoshod = new Label(); Label Shotype = new Label(); string type; if (!m.IsAlter && !m.IsFunctional && !m.IsPow && !m.IsRandom && !m.IsWithout9) { type = "Обычный "; } else { type = ""; } if (m.IsConverge && !m.IsPow && !m.IsWithout9 && !m.IsRandom) { type += "сходящийся "; } if (!m.IsConverge && !m.IsPow && !m.IsWithout9 && !m.IsRandom) { type += "рассходящийся "; } if (m.IsAlter) { type += "знакопеременный "; } if (m.IsPow) { type += "степенной "; } if (m.IsWithout9) { type += "истонченный "; } if (m.IsRandom) { type += "случайный "; } Shotype.Content = type + "ряд"; Shotype.Margin = new Thickness(500, 20, 100, 0); border.Child = Y; Y.Children.Add(K); Y.Children.Add(Shod); Y.Children.Add(Shotype); } } }