Esempio n. 1
0
        public ActionResult MyRes(string id)
        {
            UCHomeEntities  ue  = new UCHomeEntities();
            UCHome_BaseInfo ubi = ue.UCHome_BaseInfo.SingleOrDefault(u => u.UserID == loginId);

            return(View(ubi));
        }
Esempio n. 2
0
        public ActionResult PersonInfo2(Guid id)
        {
            UCHomeEntities      uc   = new UCHomeEntities();
            Guid                jsid = id;//LoginSet.Consts.CurrentUser.ID;
            TeacherAllInfo      tai  = new TeacherAllInfo();
            View_Simple_TeaInfo tea  = uc.View_Simple_TeaInfo.SingleOrDefault(u => u.jsid == jsid);

            if (tea != null)
            {
                tai.VST = tea;
            }
            else
            {
                tai.VST = new View_Simple_TeaInfo();
            }
            UCHome_BaseInfo ubi = uc.UCHome_BaseInfo.SingleOrDefault(u => u.UserID == jsid);

            if (ubi != null)
            {
                tai.UBI = ubi;
            }
            else
            {
                tai.UBI = new UCHome_BaseInfo();
            }
            return(PartialView("PersonInfo2", tai));
        }
Esempio n. 3
0
        public ActionResult QueryResById2(Guid id)
        {
            UCHomeEntities  ue  = new UCHomeEntities();
            UCHome_BaseInfo ubi = ue.UCHome_BaseInfo.SingleOrDefault(u => u.UserID == id);

            return(View(ubi));
        }
Esempio n. 4
0
        public ActionResult PersonInfo2(Guid id)
        {
            UCHomeEntities      uc   = new UCHomeEntities();
            Guid                xsid = id;//LoginSet.Consts.CurrentUser.ID;
            StudentAllInfo      sai  = new StudentAllInfo();
            View_Simple_StuInfo stu  = uc.View_Simple_StuInfo.SingleOrDefault(u => u.xsid == xsid);

            if (stu != null)
            {
                sai.VSS = stu;
            }
            else
            {
                sai.VSS = new View_Simple_StuInfo();
            }
            UCHome_BaseInfo ubi = uc.UCHome_BaseInfo.SingleOrDefault(u => u.UserID == xsid);

            if (ubi != null)
            {
                sai.UBI = ubi;
            }
            else
            {
                sai.UBI = new UCHome_BaseInfo();
            }
            return(PartialView("PersonInfo2", sai));
        }
Esempio n. 5
0
        public ActionResult UpdateInfo(FormCollection form)
        {
            UCHomeEntities  uc    = new UCHomeEntities();
            UCHome_BaseInfo space = uc.UCHome_BaseInfo.SingleOrDefault(u => u.UserID == loginId);
            JsonResult      jsonResult;

            if (space != null)
            {
                space.NickName = form["NickName"];
                space.Section  = form["Section"];
                space.Subject  = form["Subject"];
                try
                {
                    uc.SaveChanges();
                    HttpCookie cookie = Request.Cookies["SpaceInfo"];
                    if (cookie != null)
                    {
                        cookie.Values["Subject"] = EncryptUtils.Base64Encrypt(form["Subject"]);
                        Response.AppendCookie(cookie);
                    }
                    else
                    {
                        cookie = new HttpCookie("SpaceInfo");
                        cookie.Values.Add("Subject", EncryptUtils.Base64Encrypt(form["Subject"]));
                        Response.AppendCookie(cookie);
                    }
                    jsonResult = new JsonResult
                    {
                        Data = new
                        {
                            result  = "success",
                            uctype  = user.usertype,
                            subject = form["Subject"]
                        }
                    };
                    return(Json(jsonResult, JsonRequestBehavior.AllowGet));
                }
                catch (Exception)
                {
                    jsonResult = new JsonResult
                    {
                        Data = new
                        {
                            result = "fail",
                            uctype = "X"
                        }
                    };
                    return(Json(jsonResult, JsonRequestBehavior.AllowGet));
                }
            }
            jsonResult = new JsonResult
            {
                Data = new
                {
                    result = "noexist",
                    uctype = "X"
                }
            };
            return(Json(jsonResult, JsonRequestBehavior.AllowGet));
        }
        public ActionResult HailFellow()
        {
            ViewBag.Useirid = loginId;
            UCHomeEntities  uc       = new UCHomeEntities();
            UCHome_BaseInfo userInfo = uc.UCHome_BaseInfo.FirstOrDefault(u => u.UserID == loginId);

            return(View(userInfo));
        }
Esempio n. 7
0
        public ActionResult PersonHome2(Guid id)
        {
            UCHomeEntities  uc  = new UCHomeEntities();
            UCHome_BaseInfo ubi = uc.UCHome_BaseInfo.SingleOrDefault(u => u.UserID == id);

            ViewData["usertype"] = ubi != null?ubi.UserType.ToUpper() : "";

            return(PartialView("PersonHome2", id));
        }
Esempio n. 8
0
        public ActionResult SkinSet(string skintheme, string skincolor)
        {
            UCHomeEntities  uc    = new UCHomeEntities();
            UCHome_BaseInfo space = uc.UCHome_BaseInfo.SingleOrDefault(u => u.UserID == loginId);
            JsonResult      jsonResult;

            if (space != null)
            {
                space.SkinTheme = skintheme;
                try
                {
                    uc.SaveChanges();
                    HttpCookie cookie = Request.Cookies["SpaceInfo"];
                    if (cookie != null)
                    {
                        cookie.Values["Theme"] = EncryptUtils.Base64Encrypt(skintheme);
                        cookie.Values["Skin"]  = EncryptUtils.Base64Encrypt(skincolor);
                        Response.AppendCookie(cookie);
                    }
                    else
                    {
                        cookie = new HttpCookie("SpaceInfo");
                        cookie.Values.Add("Theme", EncryptUtils.Base64Encrypt(skintheme));
                        cookie.Values.Add("Skin", EncryptUtils.Base64Encrypt(skincolor));
                        Response.AppendCookie(cookie);
                    }
                    jsonResult = new JsonResult
                    {
                        Data = new
                        {
                            statuscode = "200"
                        }
                    };
                    return(Json(jsonResult, JsonRequestBehavior.AllowGet));
                }
                catch (Exception)
                {
                    jsonResult = new JsonResult
                    {
                        Data = new
                        {
                            statuscode = "500"
                        }
                    };
                    return(Json(jsonResult, JsonRequestBehavior.AllowGet));
                }
            }
            jsonResult = new JsonResult
            {
                Data = new
                {
                    statuscode = "404"
                }
            };
            return(Json(jsonResult, JsonRequestBehavior.AllowGet));
        }
Esempio n. 9
0
        public static void SetSpaceCookies(UCHome_BaseInfo space)
        {
            HttpCookie cookie = new HttpCookie("SpaceInfo");

            cookie.Values.Add("HeadPic", EncryptUtils.Base64Encrypt(space.headphoto ?? ""));
            cookie.Values.Add("Subject", EncryptUtils.Base64Encrypt(space.Subject ?? ""));
            cookie.Values.Add("Theme", EncryptUtils.Base64Encrypt(space.SkinTheme ?? ""));
            cookie.Values.Add("Skin", EncryptUtils.Base64Encrypt(space.SkinCss ?? ""));
            HttpContext.Current.Response.AppendCookie(cookie);
        }
Esempio n. 10
0
        public ActionResult HomePage()
        {
            if (user != null)
            {
                UCHomeEntities  uc    = new UCHomeEntities();
                UCHome_BaseInfo space = uc.UCHome_BaseInfo.SingleOrDefault(u => u.UserID == user.userid);
                if (space == null)
                {
                    ViewBag.usertype = user.usertype;
                    return(View("Index", true));
                }
                if (space.UserType == null)
                {
                    space.UserType = user.usertype;
                    uc.SaveChanges();
                }
                ViewBag.XXID    = user.xxid;
                ViewBag.UserID  = loginId;
                ViewBag.OrgID   = user.orgid;
                ViewBag.OrgName = user.orgname;
                //获取用户皮肤主题
                //if (userType.ToLower() == "s")
                //{
                //    return RedirectToAction("Index", "StudentCenter");
                //}
                if (userType.ToLower() == "p" && Request.Cookies["ChildInfo"] == null)
                {
                    StudentEntities stu = new StudentEntities();
                    List <Guid>     rel =
                        stu.Stu_FamilyStuRel.Where(f => f.JZID == user.userid).Select(f => f.XSID).ToList();
                    if (rel.Count == 1)
                    {
                        //设置ChildGuid
                        Guid xsid = rel.First();
                        View_Simple_StuInfo childinfo = uc.View_Simple_StuInfo.SingleOrDefault(s => s.xsid == xsid);
                        UCHomeBasePage.SetChildCookies(childinfo);
                    }
                    else
                    {
                        List <View_Simple_StuInfo> stulist =
                            uc.View_Simple_StuInfo.Where(s => rel.Contains(s.xsid)).ToList();
                        ViewBag.childs = stulist;
                        return(View("ChildRedirect", stulist));
                    }
                }
                return(View("HomePage", user));
            }

            return(View("Index", false));
        }
Esempio n. 11
0
        public void ProcessRequest(HttpContext context)
        {
            UCHomeEntities uc = new UCHomeEntities();
            Guid           id = Guid.Empty;

            if (!string.IsNullOrEmpty(context.Request["ID"]))
            {
                id = new Guid(context.Request["ID"]);
            }
            TeacherAllInfo      tai = new TeacherAllInfo();
            StudentAllInfo      sai = new StudentAllInfo();
            View_Simple_TeaInfo tea = uc.View_Simple_TeaInfo.SingleOrDefault(u => u.jsid == id);
            View_Simple_StuInfo stu = uc.View_Simple_StuInfo.SingleOrDefault(u => u.xsid == id);

            if (tea != null)
            {
                tai.VST = tea;
                UCHome_BaseInfo ubi = uc.UCHome_BaseInfo.SingleOrDefault(u => u.UserID == id);
                if (ubi != null)
                {
                    tai.UBI = ubi;
                }
                else
                {
                    tai.UBI = new UCHome_BaseInfo();
                }
                string Newjson = "";
                string split   = string.Empty;
                Newjson += string.Format("{0}{{\"nickname\":\"{1}\",\"username\":\"{2}\",\"xxmc\":\"{3}\",\"xbm\":\"{4}\",\"headphoto\":\"{5}\"}}", split,
                                         ubi.NickName, tea.XM, tea.xxmc, tai.VST.xbm, ubi.headphoto);
                split   = ",";
                Newjson = string.Format("[{0}]", Newjson);
                context.Response.ContentType = "text/plain";
                context.Response.Write(Newjson);
            }
            else if (stu != null)
            {
                if (stu != null)
                {
                    sai.VSS = stu;
                }
                else
                {
                    sai.VSS = new View_Simple_StuInfo();
                }
                UCHome_BaseInfo ubi = uc.UCHome_BaseInfo.SingleOrDefault(u => u.UserID == id);
                if (ubi != null)
                {
                    sai.UBI = ubi;
                }
                else
                {
                    sai.UBI = new UCHome_BaseInfo();
                }
                string Newjson = "";
                string split   = string.Empty;
                Newjson += string.Format("{0}{{\"nickname\":\"{1}\",\"username\":\"{2}\",\"xxmc\":\"{3}\",\"xbm\":\"{4}\",\"headphoto\":\"{5}\"}}", split,
                                         ubi.NickName, stu.XM, stu.XXMC, sai.VSS.XBM, ubi.headphoto);
                split   = ",";
                Newjson = string.Format("[{0}]", Newjson);
                context.Response.ContentType = "text/plain";
                context.Response.Write(Newjson);
            }
            else
            {
                var Newjson = "当前登陆人信息没有传递!";
                context.Response.ContentType = "text/plain";
                context.Response.Write(Newjson);
            }
        }
Esempio n. 12
0
        public ActionResult AliveSpace(FormCollection form)
        {
            JsonResult jsonResult;

            if (user != null)
            {
                UCHomeEntities  uc    = new UCHomeEntities();
                UCHome_BaseInfo space = uc.UCHome_BaseInfo.SingleOrDefault(u => u.UserID == user.userid);
                if (space == null)
                {
                    UCHome_BaseInfo ucbBaseInfo = new UCHome_BaseInfo
                    {
                        PKID           = Guid.NewGuid(),
                        NickName       = form["NickName"],
                        Section        = form["Section"],
                        Subject        = form["Subject"],
                        UserID         = user.userid,
                        UserType       = user.usertype,
                        Visits         = 0,
                        ExcellentSpace = "other",
                        IsStatus       = "1",
                        CreateTime     = DateTime.Now
                    };
                    uc.UCHome_BaseInfo.AddObject(ucbBaseInfo);
                    try
                    {
                        uc.SaveChanges();
                        jsonResult = new JsonResult
                        {
                            Data = new
                            {
                                result  = "success",
                                uctype  = user.usertype,
                                subject = form["Subject"]
                            }
                        };
                        UCHomeBasePage.SetSpaceCookies(ucbBaseInfo);
                        return(Json(jsonResult, JsonRequestBehavior.AllowGet));
                    }
                    catch (Exception)
                    {
                        jsonResult = new JsonResult
                        {
                            Data = new
                            {
                                result = "fail",
                                uctype = "X"
                            }
                        };
                        return(Json(jsonResult, JsonRequestBehavior.AllowGet));
                    }
                }
                jsonResult = new JsonResult
                {
                    Data = new
                    {
                        result = "exist",
                        uctype = space.UserType
                    }
                };
            }
            else
            {
                jsonResult = new JsonResult
                {
                    Data = new
                    {
                        result = "fail",
                        uctype = "X"
                    }
                };
            }
            return(Json(jsonResult, JsonRequestBehavior.AllowGet));
        }
Esempio n. 13
0
        public static void SetSSOUser()
        {
            if (!IsLogin)
            {
                UCHomeEntities uche = new UCHomeEntities();
                //登录跳转
                Guid uid;
                if (loginmethod == "other")
                {
                    uid = SSO.Adapter.AdapterHelper.CurrentNewUser;
                }
                else
                {
                    //本系统登录uid
                    uid = Guid.Parse(HttpContext.Current.Request.QueryString["UserID"]);
                }
                if (uid != null && uid != Guid.Empty)
                {
                    View_Simple_User u = uche.View_Simple_User.FirstOrDefault(tea => tea.userid == uid);

                    if (u != null)
                    {
                        SetUserCookies(u);

                        UserInfo ui = new UserInfo {
                            areacode  = u.xzqhm,
                            xxid      = new Guid(u.xxid.ToString()),
                            xxmc      = u.xxmc,
                            orgid     = u.orgid,
                            orgname   = u.orgname ?? "",
                            usertype  = u.usertype,
                            userid    = u.userid,
                            username  = u.username,
                            loginname = u.loginname
                        };
                        UCHome_BaseInfo space = uche.UCHome_BaseInfo.SingleOrDefault(s => s.UserID == u.userid);
                        if (space != null)
                        {
                            SetSpaceCookies(space);
                            ui.headpic   = space.headphoto;
                            ui.subject   = space.Subject;
                            ui.skincss   = space.SkinCss;
                            ui.skintheme = space.SkinTheme;
                        }
                        if (HttpContext.Current.Request.Cookies["ChildInfo"] != null)
                        {
                            HttpCookie cookies3 = HttpContext.Current.Request.Cookies["ChildInfo"];
                            ui.childinfo = new ChildInfo {
                                childareacode = EncryptUtils.Base64Decrypt(cookies3["childareacode"]),
                                childxxid     = new Guid(EncryptUtils.Base64Decrypt(cookies3["childxxid"])),
                                childxxmc     = EncryptUtils.Base64Decrypt(cookies3["childxxmc"]),
                                childbjid     = new Guid(EncryptUtils.Base64Decrypt(cookies3["childbjid"])),
                                childbjmc     = EncryptUtils.Base64Decrypt(cookies3["childbjmc"]),
                                childuserid   = new Guid(EncryptUtils.Base64Decrypt(cookies3["childuserid"])),
                                childusername = EncryptUtils.Base64Decrypt(cookies3["childusername"])
                            };
                        }
                    }
                }
            }
        }
Esempio n. 14
0
        private static void GetRequestUser(out UserInfo userinfo)
        {
            UCHomeEntities uche = new UCHomeEntities();

            //Guid uid;
            //string rid = GetRequestValue();
            //if (string.IsNullOrEmpty(rid) || rid == Guid.Empty.ToString())
            //{
            //判断是否已登录
            if (HttpContext.Current.Request.Cookies["PersonInfo"] != null)
            {
                HttpCookie cookies = HttpContext.Current.Request.Cookies["PersonInfo"];

                UserInfo ui = new UserInfo {
                    areacode  = EncryptUtils.Base64Decrypt(cookies["areacode"]),
                    xxid      = new Guid(EncryptUtils.Base64Decrypt(cookies["xxid"])),
                    xxmc      = EncryptUtils.Base64Decrypt(cookies["xxmc"]),
                    orgid     = new Guid(EncryptUtils.Base64Decrypt(cookies["orgid"])),
                    orgname   = EncryptUtils.Base64Decrypt(cookies["orgname"]),
                    usertype  = EncryptUtils.Base64Decrypt(cookies["usertype"]),
                    userid    = new Guid(EncryptUtils.Base64Decrypt(cookies["userid"])),
                    username  = EncryptUtils.Base64Decrypt(cookies["username"]),
                    loginname = EncryptUtils.Base64Decrypt(cookies["loginname"])
                };
                if (HttpContext.Current.Request.Cookies["SpaceInfo"] != null)
                {
                    HttpCookie cookies2 = HttpContext.Current.Request.Cookies["SpaceInfo"];
                    ui.headpic   = EncryptUtils.Base64Decrypt(cookies2["HeadPic"]);
                    ui.subject   = EncryptUtils.Base64Decrypt(cookies2["Subject"]);
                    ui.skintheme = EncryptUtils.Base64Decrypt(cookies2["Theme"]);
                    ui.skincss   = EncryptUtils.Base64Decrypt(cookies2["Skin"]);
                }
                else
                {
                    UCHome_BaseInfo space = uche.UCHome_BaseInfo.SingleOrDefault(s => s.UserID == ui.userid);
                    if (space != null)
                    {
                        SetSpaceCookies(space);
                        ui.headpic   = space.headphoto;
                        ui.subject   = space.Subject;
                        ui.skincss   = space.SkinCss;
                        ui.skintheme = space.SkinTheme;
                    }
                }
                if (HttpContext.Current.Request.Cookies["ChildInfo"] != null)
                {
                    HttpCookie cookies3 = HttpContext.Current.Request.Cookies["ChildInfo"];
                    ui.childinfo = new ChildInfo {
                        childareacode = EncryptUtils.Base64Decrypt(cookies3["childareacode"]),
                        childxxid     = new Guid(EncryptUtils.Base64Decrypt(cookies3["childxxid"])),
                        childxxmc     = EncryptUtils.Base64Decrypt(cookies3["childxxmc"]),
                        childbjid     = new Guid(EncryptUtils.Base64Decrypt(cookies3["childbjid"])),
                        childbjmc     = EncryptUtils.Base64Decrypt(cookies3["childbjmc"]),
                        childuserid   = new Guid(EncryptUtils.Base64Decrypt(cookies3["childuserid"])),
                        childusername = EncryptUtils.Base64Decrypt(cookies3["childusername"])
                    };
                    ui.areacode = EncryptUtils.Base64Decrypt(cookies3["childareacode"]);
                    ui.xxid     = new Guid(EncryptUtils.Base64Decrypt(cookies3["childxxid"]));
                    ui.xxmc     = EncryptUtils.Base64Decrypt(cookies3["childxxmc"]);
                    ui.orgid    = new Guid(EncryptUtils.Base64Decrypt(cookies3["childbjid"]));
                    ui.orgname  = EncryptUtils.Base64Decrypt(cookies3["childbjmc"]);
                }
                userinfo = ui;
            }
            else
            {
                userinfo = null;
                HttpContext.Current.Response.Redirect(iiswebsitedirectory + "Login/SSOtransfer?returnurl=" + HttpContext.Current.Request.Url);
            }
        }
Esempio n. 15
0
        protected string SaveAsHeadImg(HttpPostedFileBase file, Guid AddUser, int sx, int sy, int iw, int ih)
        {
            string fileurl    = Guid.NewGuid().ToString();
            string fileext    = Path.GetExtension(file.FileName);
            string fname      = fileurl + fileext;
            string foldername = DateTime.Now.Year + "/" + DateTime.Now.Month + "/" + DateTime.Now.Day;
            string basicPath  = "/upload/headimg/" + AddUser;

            if (!Directory.Exists(Server.MapPath(basicPath + "/" + foldername + "/")))
            {
                Directory.CreateDirectory(Server.MapPath(basicPath + "/" + foldername + "/"));
            }
            string webpath           = basicPath + "/" + foldername + "/" + fname;
            string webpath_thumbnail = basicPath + "/" + foldername + "/" + fileurl + "_thumbnail" + fileext;
            string webpath_min       = basicPath + "/" + foldername + "/" + fileurl + "_min" + fileext;
            string webpath_headimg   = basicPath + "/" + foldername + "/" + fileurl + "_headimg" + fileext;

            //单独存放用户头像
            const string basicPath1 = "/upload/headimages/";

            if (!Directory.Exists(Server.MapPath(basicPath1)))
            {
                Directory.CreateDirectory(Server.MapPath(basicPath1));
            }
            string headimages = basicPath1 + "/" + AddUser + ".jpg";



            string Upload_headimages = Server.MapPath(headimages);

            string UploadPath           = Server.MapPath(webpath);
            string UploadPath_thumbnail = Server.MapPath(webpath_thumbnail);
            string UploadPath_min       = Server.MapPath(webpath_min);
            string UploadPath_headimg   = Server.MapPath(webpath_headimg);

            file.SaveAs(UploadPath);
            ImgReduceCutOut(sx, sy, iw, ih, UploadPath, UploadPath_thumbnail);
            SaveAsThumbil(160, 160, UploadPath_thumbnail, UploadPath_min);
            SaveAsThumbil(60, 60, UploadPath_thumbnail, UploadPath_headimg);

            SaveAsThumbil(60, 60, UploadPath_thumbnail, Upload_headimages);

            //Cookie ck = new Cookie();
            //string TempUserID = ck.GetCookie("UserserID");
            //保存文件到数据表
            UCHome_BaseInfo personInfo = uc.UCHome_BaseInfo.SingleOrDefault(p => p.UserID == AddUser);

            if (personInfo != null)
            {
                personInfo.headphoto = webpath_headimg;
                uc.SaveChanges();
                //更改头像cookies值
                HttpCookie cookie = Request.Cookies["SpaceInfo"];
                if (cookie != null)
                {
                    cookie.Values["HeadPic"] = EncryptUtils.Base64Encrypt(webpath_headimg);
                    Response.AppendCookie(cookie);
                }
                else
                {
                    cookie = new HttpCookie("SpaceInfo");
                    cookie.Values.Add("HeadPic", EncryptUtils.Base64Encrypt(webpath_headimg));
                    Response.AppendCookie(cookie);
                }
                return(webpath_headimg);
            }
            return(string.Empty);
        }