Beispiel #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            KeyValuePair <string, string> lgnpwd = new KeyValuePair <string, string>(this.login.Text, this.pwd.Password);

            if (!LogPas.Contains(lgnpwd))
            {
                this.InfoBlock.Text = "Incorrect Login!";
                return;
            }
            else
            {
                if (lgnpwd.Key == "admin")
                {
                    IsAdmin      = true;
                    Teacher      = 0;
                    DialogResult = true;
                }
                else
                {
                    using (var _ujc = new Model.UniversityEntities())
                    {
                        Teacher = _ujc.University_Teacher.Where(t => t.Login == lgnpwd.Key).FirstOrDefault().Teacher_ID;
                    }
                    IsAdmin           = false;
                    this.DialogResult = true;
                }
            }
        }
 public MainWindowVM(bool admin, int teachid)
 {
     _isAdmin = admin;
     TeachID = teachid;
     if (admin)
     {
         LoggedIn = "Admin";
         forA = Visibility.Visible;
         forT = Visibility.Collapsed;
     }
     else
     {
         forT = Visibility.Visible;
         forA = Visibility.Collapsed;
         using (_ujc = new Model.UniversityEntities())
         {
             var _tmpteach = _ujc.University_Teacher.Where(t => t.Teacher_ID == TeachID).FirstOrDefault();
             LoggedIn = _tmpteach.First_Name + " " + _tmpteach.Last_Name;
         }
     }
     _schdVM = new ScheduleVM() { TabName = "Schedule", Vis = forA };
     _gvm = new GroupVM() { TabName = "Groups", Vis = forA };
     _teacVM = new TeacherVM() { TabName = "Teachers", Vis = forA };
     _subjvm = new SubjectVM() { TabName = "Subjects", Vis = forA };
     _studvm = new StudentVM() { TabName = "Students", Vis = forA };
     _teachIntVM = new TeacherInterfaceVM(TeachID) { TabName = "", TeacherID = TeachID, Vis = forT };
     if (!_isAdmin)
         SelectIndex = 5;
 }
		private void Button_Click(object sender, RoutedEventArgs e)
		{
			KeyValuePair<string,string> lgnpwd = new KeyValuePair<string,string>(this.login.Text,this.pwd.Password);
			if (!LogPas.Contains(lgnpwd))
			{
				this.InfoBlock.Text = "Incorrect Login!";
				return;
			}
			else
			{
				if (lgnpwd.Key == "admin")
				{
					IsAdmin = true;
					Teacher = 0;
					DialogResult = true;
				}
				else
				{
					using (var _ujc = new Model.UniversityEntities())
					{
						Teacher = _ujc.University_Teacher.Where(t => t.Login == lgnpwd.Key).FirstOrDefault().Teacher_ID;
					}
					IsAdmin = false;
					this.DialogResult = true;
				}
				
			}
		}
		private void LoadSecurityData()
		{
			using(_ujc = new Model.UniversityEntities())
			{
				var _teachers = _ujc.University_Teacher.Select(s => s);
				foreach (var tch in _teachers)
				{
					LogPas.Add(tch.Login, tch.Password);
				}
			}
		}
Beispiel #5
0
 private void LoadSecurityData()
 {
     using (_ujc = new Model.UniversityEntities())
     {
         var _teachers = _ujc.University_Teacher.Select(s => s);
         foreach (var tch in _teachers)
         {
             LogPas.Add(tch.Login, tch.Password);
         }
     }
 }
Beispiel #6
0
 public LoginScreen()
 {
     InitializeComponent();
     LogPas.Add("admin", "admin");
     using (var _ujc = new Model.UniversityEntities())
     {
         var _teachers = _ujc.University_Teacher.Select(s => s);
         foreach (var tch in _teachers)
         {
             LogPas.Add(tch.Login, tch.Password);
         }
     }
 }
		public LoginScreen()
		{
			InitializeComponent();
			LogPas.Add("admin", "admin");
			using (var _ujc = new Model.UniversityEntities())
			{
				var _teachers = _ujc.University_Teacher.Select(s => s);
				foreach (var tch in _teachers)
				{
					LogPas.Add(tch.Login, tch.Password);
				}
			}

		}
 public MainWindowVM(bool admin, int teachid)
 {
     _isAdmin = admin;
     TeachID  = teachid;
     if (admin)
     {
         LoggedIn = "Admin";
         forA     = Visibility.Visible;
         forT     = Visibility.Collapsed;
     }
     else
     {
         forT = Visibility.Visible;
         forA = Visibility.Collapsed;
         using (_ujc = new Model.UniversityEntities())
         {
             var _tmpteach = _ujc.University_Teacher.Where(t => t.Teacher_ID == TeachID).FirstOrDefault();
             LoggedIn = _tmpteach.First_Name + " " + _tmpteach.Last_Name;
         }
     }
     _schdVM = new ScheduleVM()
     {
         TabName = "Schedule", Vis = forA
     };
     _gvm = new GroupVM()
     {
         TabName = "Groups", Vis = forA
     };
     _teacVM = new TeacherVM()
     {
         TabName = "Teachers", Vis = forA
     };
     _subjvm = new SubjectVM()
     {
         TabName = "Subjects", Vis = forA
     };
     _studvm = new StudentVM()
     {
         TabName = "Students", Vis = forA
     };
     _teachIntVM = new TeacherInterfaceVM(TeachID)
     {
         TabName = "", TeacherID = TeachID, Vis = forT
     };
     if (!_isAdmin)
     {
         SelectIndex = 5;
     }
 }