示例#1
0
        public ActionResult LogIn() //Get
        {
            WorkStationDAL.User        User = new WorkStationDAL.User();
            List <WorkStationDAL.User> str  = new List <WorkStationDAL.User>();

            if (Session["Username"] != null)
            {
                return(View("~/Views/Home/Index.cshtml"));
            }
            else
            {
                return(View());
            }
        }
示例#2
0
        public ActionResult Profile()
        {
            if (Session["Username"] != null)
            {
                WorkStationDAL.User    User    = new WorkStationDAL.User();
                WorkStationDAL.Skills  Skills  = new WorkStationDAL.Skills();
                WorkStationDAL.Project Project = new WorkStationDAL.Project();

                ViewBag.UserProfile             = User.UserProfile(Session["Username"].ToString());
                ViewBag.TechnicalLanguageSkills = Skills.TechnicalLanguageSkills(Session["Username"].ToString());
                ViewBag.TechnologySkills        = Skills.TechnologySkills(Session["Username"].ToString());
                ViewBag.LanguageSkills          = Skills.LanguageSkills(Session["Username"].ToString());
                ViewBag.ProjectReview           = Project.ProjectReview(Session["Username"].ToString());
            }
            else
            {
                return(RedirectToAction("LogIn", "User"));
            }
            return(View());
        }
示例#3
0
 public ActionResult LogIn(string Email, string Password) //Post pk tem Httppost
 {
     if (ModelState.IsValid)                              //Para ver se esta tudo preenchid sei la crl
     {
         WorkStationDAL.User        User = new WorkStationDAL.User();
         List <WorkStationDAL.User> str  = new List <WorkStationDAL.User>();
         str = User.LoginAcc(Email, PasswordString(Password));
         if (str != null)
         {
             Session["Username"]  = str[0].userName;
             Session["UserLevel"] = str[0].userLevelId;
             return(View("~/Views/Home/Index.cshtml"));
         }
         else
         {
             return(View("~/Views/Alert/LoginFailed.cshtml"));
         }
     }
     return(View());
 }
示例#4
0
        public ActionResult Register(Register model)
        {
            System.IO.Stream     stream = model.imgURL.InputStream;
            System.Drawing.Image image  = System.Drawing.Image.FromStream(stream);

            if (image.Height > 128 || image.Width > 128)
            {
                return(RedirectToAction("RegisteredFailed", "Alert"));
            }

            string FullPath      = AppDomain.CurrentDomain.BaseDirectory + System.Configuration.ConfigurationManager.AppSettings["ImgPath"] + @"\" + model.Username + Path.GetExtension(model.imgURL.FileName);
            string PathInProject = System.Configuration.ConfigurationManager.AppSettings["ImgPath"] + @"\" + model.Username + Path.GetExtension(model.imgURL.FileName);

            if (ModelState.IsValid)
            {
                WorkStationDAL.User User = new WorkStationDAL.User();
                if (User.RegisterAcc(model.Username, model.FirstName, model.SecondName, model.Email, PasswordString(model.Password), PathInProject, model.Birthday) != -1)
                {
                    try
                    {
                        model.imgURL.SaveAs(FullPath);
                        Session["Username"] = model.Username;
                    }
                    catch
                    {
                        User.DeletRegister(model.Username);
                        return(View("~/Views/Alert/RegisteredFailed.cshtml"));
                    }
                }
                else
                {
                    return(View("~/Views/Alert/RegisteredFailed.cshtml"));
                }
                return(View("~/Views/Alert/SuccessfullyRegistered.cshtml"));
            }

            return(View());
        }