示例#1
0
 public UserViewPage(trainee a_trainee, scalodromEntities3 a_db_context)
 {
     InitializeComponent();
     DataContext    = this;
     currentTrainee = new TraineeWrapper(a_trainee);
     db_context     = a_db_context;
 }
示例#2
0
        public login Login()
        {
            IList <login> logins = new List <login>();

            using (var db = new scalodromEntities3())
            {
                logins = (from loginlist in db.login where loginlist.login1 == loginEntered select loginlist).ToList();
            }
            if (logins.Count == 1)
            {
                if (logins[0].password == passwordEntered)
                {
                    if (logins[0].approved == 1)
                    {
                        return(logins[0]);
                    }
                    else
                    {
                        throw new UserIsNotActiveException("Учетная запись не активирована!");
                    }
                }
                else
                {
                    throw new WrongPasssword("Неверный пароль!");
                }
            }
            else
            {
                throw new NoSuchUserException("Пользователь не найден!");
            }
        }
 public ClimbPathModel(training a_tr, scalodromEntities3 a_db_context)
 {
     training   = a_tr;
     db_context = a_db_context;
     tracks     = new ObservableCollection <Track>();
     tracks.Add(new Track(0));
     tracks.Add(new Track(1));
     tracks.Add(new Track(2));
     subscribeToggles();
 }
 public ClimbPathView(training a_tr, scalodromEntities3 a_db_context)
 {
     _model    = new ClimbPathModel(a_tr, a_db_context);
     _grapples = new ObservableCollection <grapple_series>((from grapplesList in a_db_context.grapple_series where grapplesList.id_training == a_tr.id select grapplesList));
     InitializeComponent();
     DataContext = _model;
     if (_grapples.Count > 0)
     {
         _model.Grapples = _grapples;
     }
 }
示例#5
0
 public PlayTrainingModel(training a_tr, scalodromEntities3 a_db_context)
 {
     initialModel           = new TrainingViewModel(a_tr, a_db_context);
     CurrentPlayButtonImage = c_playImage;
     IsPlaying      = false;
     CurrentTime    = 0;
     MaxPrgBarValue = CalculatePrgBarLength();
     if (_bw == null)
     {
         _bw = new BackgroundWorker();
         _bw.WorkerSupportsCancellation = true;
         _bw.DoWork += Bw_DoWork;
         _bw.RunWorkerAsync();
     }
 }
示例#6
0
        public TrainingViewModel(training a_tr, scalodromEntities3 a_db_context)
        {
            training   = a_tr;
            db_context = a_db_context;
            i_trPath1  = collectionOfWrappers((from trPathList in a_db_context.tr_path where trPathList.id_training == training.id && trPathList.num_path == 1 select trPathList).ToList());
            i_trPath2  = collectionOfWrappers((from trPathList in a_db_context.tr_path where trPathList.id_training == training.id && trPathList.num_path == 2 select trPathList).ToList());
            i_trPath3  = collectionOfWrappers((from trPathList in a_db_context.tr_path where trPathList.id_training == training.id && trPathList.num_path == 3 select trPathList).ToList());
            i_angles   = collectionOfAngleWrappers((from angles in a_db_context.angle_series where angles.id_training == training.id select angles).ToList());

            i_seriesCollection1      = ConfigureTrPathPlot(i_trPath1);
            i_seriesCollection2      = ConfigureTrPathPlot(i_trPath2);
            i_seriesCollection3      = ConfigureTrPathPlot(i_trPath3);
            i_seriesCollectionAngles = ConfigureAnglesPlot(i_angles);

            path_graph_dict.Add(1, i_seriesCollection1); path_graph_dict.Add(2, i_seriesCollection2); path_graph_dict.Add(3, i_seriesCollection3);
            path_col_dict.Add(1, i_trPath1); path_col_dict.Add(2, i_trPath2); path_col_dict.Add(3, i_trPath3);

            ConfigureCollbacksTrPath(i_trPath1, i_seriesCollection1, 1);
            ConfigureCollbacksTrPath(i_trPath2, i_seriesCollection2, 2);
            ConfigureCollbacksTrPath(i_trPath3, i_seriesCollection3, 3);
        }
示例#7
0
 public void RegisterNewUser()
 {
     using (var db = new scalodromEntities3())
     {
         login l_new_login = new login()
         {
             login1 = inputLogin, password = (inputPassword == "" ? "12345" : inputPassword), approved = 1
         };
         try
         {
             db.login.Add(l_new_login);
             db.SaveChanges();
         }
         catch (Exception e)
         {
             throw e;
         }
         finally
         {
             db.Dispose();
         }
     }
 }
示例#8
0
 public TrainingView(training a_tr, scalodromEntities3 a_db_context)
 {
     InitializeComponent();
     model       = new TrainingViewModel(a_tr, a_db_context);
     DataContext = model;
 }
示例#9
0
 private void page_user_Unloaded(object sender, RoutedEventArgs e)
 {
     db_context.Dispose();
     db_context = null;
 }
示例#10
0
 public PlayTrainingPage(training a_tr, scalodromEntities3 a_db_context)
 {
     InitializeComponent();
     model       = new PlayTrainingModel(a_tr, a_db_context);
     DataContext = model;
 }