| 
					
				 | 
			
			
				@@ -19,9 +19,45 @@ namespace CopyCenter 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     /// </summary> 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public partial class RegistrationWindow : Window 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        gr672_liiEntities db; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         public RegistrationWindow() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             InitializeComponent(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private void Registration_Click(object sender, RoutedEventArgs e) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (login.Text == "" || password.Password == "" || lastname.Text == "" || firstname.Text == "" || middlename.Text == "" || contactnumber.Text == "") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                MessageBox.Show("Пустые поля"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (db.User.Select(item => item.Login).Contains(login.Text)) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                MessageBox.Show("Такой логин уже существует в системе"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            User newUser = new User() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Login = login.Text, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                Password = password.Password, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                LastName = lastname.Text, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                FirstName = firstname.Text, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                MiddleName = middlename.Text, 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                ContactNumber = Convert.ToInt32(contactnumber.Text) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            db.User.Add(newUser); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            db.SaveChanges(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            MessageBox.Show("Вы успешно зарегистрировались!"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            AuthorizationWindow aw = new AuthorizationWindow(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            aw.Show(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.Close(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        private void CancelClick(object sender, RoutedEventArgs e) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            AuthorizationWindow aw = new AuthorizationWindow(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            aw.Show(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            this.Close(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |