Beispiel #1
0
        public ActionResult IndexPost(userLogin users)
        {
            userLogin login = new userLogin();

            if (ModelState.IsValid)
            {
                using (userContext db = new userContext())
                {
                    var user = db.userLogins.Where(x => x.uName.Equals(users.uName) && x.Password.Equals(users.Password)).FirstOrDefault();

                    if (user != null)
                    {
                        //Session["Username"] = users.uName;
                        Session.Add("UserName", users.uName);
                        FormsAuthentication.SetAuthCookie(users.uName, true);

                        ViewBag.LoginSuccess = "Login Successfully";
                        return(RedirectToAction("Index", "Profile"));
                    }
                    else
                    {
                        ViewBag.LoginMessage = "Login Failed Username/Password incorrect";
                        return(View());
                    }
                }
            }

            return(View());
        }
Beispiel #2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, userContext dataContext)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }

            // migrate any database changes on startup (includes initial db creation)
            dataContext.Database.Migrate();

            app.UseHttpsRedirection();

            app.UseRouting();

            // global cors policy
            app.UseCors(x => x
                        .AllowAnyOrigin()
                        .AllowAnyMethod()
                        .AllowAnyHeader());

            app.UseAuthentication();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }
Beispiel #3
0
        public async Task <ActionResult> Index(userlogin u)
        {
            // EFConfiguration.SuspendExecutionStrategy = true;



            if (ModelState.IsValid)
            {
                userContext db = new userContext();

                var v = await db.USERS.Where(model => model.username.Equals(u.username) && model.password.Equals(u.password)).FirstOrDefaultAsync();

                if (v != null)
                {
                    if ("TEST" == u.username.ToString() && "TEST" == u.password.ToString())
                    {
                        return(RedirectToAction("site_data_test", "HistorySite"));
                    }
                }
            }

            // EFConfiguration.SuspendExecutionStrategy = false;

            return(View(u));
        }
Beispiel #4
0
 public ActionResult RegisterPost(userLogin user)
 {
     if (ModelState.IsValid)
     {
         if (user != null)
         {
             using (userContext db = new userContext())
             {
                 var users = db.userLogins.Where(x => x.uName.Equals(user.uName) && x.Password.Equals(user.Password)).FirstOrDefault();
                 if (users == null)
                 {
                     db.userLogins.Add(user);
                     db.SaveChanges();
                     ViewBag.SuccessMessage = "User Added";
                 }
                 else
                 {
                     ViewBag.ErrorMessage = "User Already Exists";
                 }
             }
         }
     }
     return(View());
 }
 public EmployeesController(userContext context)
 {
     _context = context;
 }
Beispiel #6
0
        private void updateUserContextVisualization(userContext pose)
        {
            BitmapImage bi3 = new BitmapImage();
            bi3.BeginInit();

            if (pose == userContext.Standing)
            {
                bi3.UriSource = new Uri("/Haixiu;component/images/standingXKCD.jpg", UriKind.Relative);
                poseContextLabel1.Content = "I see you're";
                poseContextLabel2.Content = "Standing";

            }
            else if (pose == userContext.Sitting)
            {
                bi3.UriSource = new Uri("/Haixiu;component/images/sittingXKCD.png", UriKind.Relative);
                poseContextLabel1.Content = "I see you're";
                poseContextLabel2.Content = "Sitting";

            }
            else if (pose == userContext.kinectoff)
            {
                bi3.UriSource = new Uri("/Haixiu;component/images/zoozoo.jpg", UriKind.Relative);
                poseContextLabel1.Content = "Can't see you,";
                poseContextLabel2.Content = "   kinect is off.";
            }

            else if (pose == userContext.Confused)
            {
                bi3.UriSource = new Uri("/Haixiu;component/images/moveToKinect.jpg", UriKind.Relative);
                poseContextLabel1.Content = "Please face to";
                poseContextLabel2.Content = "    kinect and move";
            }
            else if (pose == userContext.Lying)
            {
                bi3.UriSource = new Uri("/Haixiu;component/images/zoozoo.jpg", UriKind.Relative);
                poseContextLabel1.Content = "I see you're";
                poseContextLabel2.Content = "Sleeping! Whoa";
            }
            bi3.EndInit();
            poseContextImage.Source = bi3;
        }
Beispiel #7
0
        private void kinect_SkeletonFrameReady(object sender, SkeletonFrameReadyEventArgs e)
        {
            foreach (SkeletonData skeleData in e.SkeletonFrame.Skeletons)
            {
                if (SkeletonTrackingState.Tracked == skeleData.TrackingState)
                {
                    this.canvas.Children.Clear();
                    foreach (JointID i in globalVars.jid)
                    {
                        if (skeleData.TrackingState == SkeletonTrackingState.Tracked)
                        {
                            drawJoint(skeleData, i);
                           // topView(skeleData, JointID.ShoulderLeft, JointID.ShoulderRight);

                        }
                    }

                    //check context every 30 frames = 1 sec
                    contextCounter++;
                    if (contextCounter % 30 == 0)
                    {
                        poseOfUser = getSittingOrStanding(skeleData);
                        contextCounter = 0;
                        updateUserContextVisualization(poseOfUser);
                    }

                    if (globalVars.chartRighthand == true)
                    {
                        this.fExtractor.getFeatures(skeleData, spinePos);
                        globalVars.a1.Content = this.fExtractor.frames;
                    }

                    //feature logging
                    if (globalVars.logFeatures == true)
                    {
                        // replaced with neww featuee extractor
                        //features.addFeatures(skeleData);
                        this.fExtractor.getFeatures(skeleData, spinePos);
                        globalVars.a1.Content = this.fExtractor.frames;

                    }
                    //feature detection

                    if (globalVars.detectorOn == true)
                    {
                        ////// strictly experimental
                        //globalVars.detector1.detect(skeleData);

                        globalVars.detector.pollFeatures(skeleData, poseOfUser);
                    }
                }

            }
            //throw new NotImplementedException();
        }
Beispiel #8
0
 public HomeController(userContext context)
 {
     _context = context;
 }
Beispiel #9
0
 public UserService(userContext context)
 {
     _context = context;
 }
Beispiel #10
0
 public UsersController(userContext context)
 {
     _context = context;
 }
Beispiel #11
0
 public UserDataService(userContext userContext)
 {
     _userContext = userContext;
 }
Beispiel #12
0
 public UserCredentialDataService(userContext userContext)
 {
     _userContext = userContext;
 }
 public TokenManagerDataService(userContext userContext)
 {
     _userContext = userContext;
 }
Beispiel #14
0
        public async Task <ActionResult> chparams(String serialsite, String xpa, String ypa, String zpa, String apa)
        {
            if (serialsite == null)
            {
                serialsite = "0890CA";
            }
            else
            {
                serialsite = serialsite.Replace(" ", string.Empty);
            }
            userContext db = new userContext();

            if (xpa != null)
            {
                var ch_response = db.chparamdbs.Where(x => x.sitetoboards.serialboard == serialsite).FirstOrDefault();

                double x_int = 10;
                double.TryParse(xpa, out x_int);

                double y_int = 10;
                double.TryParse(ypa, out y_int);

                double z_int = 10;
                double.TryParse(zpa, out z_int);

                double a_int = 10;
                double.TryParse(apa, out a_int);


                if (ch_response != null)
                {
                    ch_response.xparams = x_int;
                    ch_response.yparams = y_int;

                    ch_response.zparams = z_int;
                    ch_response.aparams = a_int;

                    db.Entry(ch_response).State = EntityState.Modified;
                    await db.SaveChangesAsync();
                }
            }

            chparamdb adding_sites = new chparamdb();

            adding_sites.serial_site = new List <String>();

            int count         = 0;
            var site_to_comms = await(from y in db.chparamdbs
                                      select y.sitetoboards).ToListAsync();

            foreach (var item in site_to_comms)
            {
                adding_sites.serial_site.Add(item.serialboard);

                if (item.serialboard.Contains(serialsite))
                {
                    ViewBag.site_selected = count;
                }
                else
                {
                    count = count + 1;
                }
            }


            var x_display = await(from x in db.chparamdbs
                                  where x.sitetoboards.serialboard == serialsite
                                  select new {
                x.xparams,
                x.yparams,
                x.zparams,
                x.aparams
            }).FirstOrDefaultAsync();


            ViewBag.x_pa = x_display.xparams.ToString();
            ViewBag.y_pa = x_display.yparams.ToString();


            ViewBag.z_pa = x_display.zparams.ToString();
            ViewBag.a_pa = x_display.aparams.ToString();



            return(View(adding_sites));
        }
Beispiel #15
0
        public int pollFeatures(SkeletonData s, userContext poseofUser)
        {
            iter++; //frame++;
            double[][] ans = globalVars.fExtract.getRawDataStream(s);

            /* if something goes wrong with the feature extractor*/
            if (ans[0] == null || ans[1] == null)
            {
                //System.Windows.MessageBox.Show("Ans 0 " + ans[0] + " ans 1 "+ans[1], "feature extractor error", MessageBoxButton.OK, MessageBoxImage.Error);
                return -3;
            }

            if (movement == null)
                movement = new double[ans[0].Length];
            for (int i = 0; i < ans[0].Length; i++)
                movement[i] += ans[0][i];
            movementTick++;

            if (position == null)
                position = new double[ans[1].Length];
            for (int i = 0; i < ans[1].Length; i++)
                position[i] += ans[1][i];
            positionTick++;

            //System.Windows.MessageBox.Show("iter: "+iter, "ANN init error", MessageBoxButton.OK, MessageBoxImage.Error);

            /* Here the detection starts */

            if (iter % 30 == 0 && iter != 0)
            {
                /*this awesome part automates the recognizer choice for Sitting or Standing context*/
                if (poseofUser == userContext.Sitting)
                {
                    mRecog = arousalSittingRecognizer;
                    posRecog = valenceSittingRecognizer;
                }
                else if (poseofUser == userContext.Standing)
                {
                    mRecog = arousalStandingRecognizer;
                    posRecog = valenceStandingRecognizer;
                }
                else
                {
                    System.Windows.MessageBox.Show("there is no saved network for this pose. Please try standing or sitting only.",
                           "detection error", MessageBoxButton.OK, MessageBoxImage.Error);
                    return -1;
                }

                double[] temp1, temp2;
                temp1 = new double[ans[0].Length];
                temp2 = new double[ans[1].Length];

                /*movement and position average*/
                /*releasing movement and position variables*/

                for (int i = 0; i < movement.Length; i++)
                {
                    temp1[i] = movement[i] / movementTick;
                    movement[i] = 0;
                    Console.Write(temp1[i] + " ");
                }
                movementTick = 0;
                Console.WriteLine();
                for (int i = 0; i < position.Length; i++)
                {
                    temp2[i] = position[i] / positionTick;
                    //Console.Write(temp2[i] + " ");
                    position[i] = 0;
                }
                positionTick = 0;
                Console.WriteLine();

                if (slidingWindow == true)
                {
                    /*adding them in a list for sliding window*/
                    movementFeatureList.Add(temp1);
                    positionFeatureList.Add(temp2);

                    double[] finalFeature = new double[movement.Length];
                    for (int i = 0; i < movement.Length; i++)
                    {
                        foreach (double[] d in this.movementFeatureList)
                        {
                            finalFeature[i] += d[i];
                            //Console.Write(d[i]+", ");
                        }
                        finalFeature[i] /= movementFeatureList.Count;
                        //Console.WriteLine("ffm: "+finalFeature[i]);
                    }

                    double[] finalFeature1 = new double[position.Length];

                    for (int i = 0; i < position.Length; i++)
                    {
                        foreach (double[] d in this.positionFeatureList)
                        {
                            finalFeature1[i] += d[i];
                            //Console.Write(d[i]+", ");
                        }
                        finalFeature1[i] /= positionFeatureList.Count;
                        //Console.WriteLine("ffp: " + finalFeature1[i]);
                    }

                    //Console.WriteLine(featureList.Count);

                    //Here the slidingwindow length is determined. ehich can be controlled with the variable: "interval".
                    if (movementFeatureList.Count == 6)
                    {
                        movementFeatureList.RemoveAt(0);
                        positionFeatureList.RemoveAt(0);
                    }
                    detect(finalFeature, finalFeature1);
                }

                else
                {
                    detect(temp1, temp2);
                }
            }
            return iter;
        }
Beispiel #16
0
 public PinsController(userContext context)
 {
     _context = context;
 }
 public usermastersController(userContext context)
 {
     _context = context;
 }