public static void SetChildCookies(View_Simple_StuInfo child) { if (HttpContext.Current.Request.Cookies["ChildInfo"] != null) { HttpCookie cookie = HttpContext.Current.Request.Cookies["ChildInfo"]; cookie.Values["childareacode"] = EncryptUtils.Base64Encrypt(child.XZQHM ?? ""); cookie.Values["childxxid"] = EncryptUtils.Base64Encrypt(child.xxid.ToString()); cookie.Values["childxxmc"] = EncryptUtils.Base64Encrypt(child.XXMC ?? ""); cookie.Values["childbjid"] = EncryptUtils.Base64Encrypt(child.BJID.ToString()); cookie.Values["childbjmc"] = EncryptUtils.Base64Encrypt(child.bjmc ?? ""); cookie.Values["childuserid"] = EncryptUtils.Base64Encrypt(child.xsid.ToString()); cookie.Values["childusername"] = EncryptUtils.Base64Encrypt(child.XM); HttpContext.Current.Response.AppendCookie(cookie); } else { HttpCookie cookie = new HttpCookie("ChildInfo"); cookie.Values.Add("childareacode", EncryptUtils.Base64Encrypt(child.XZQHM ?? "")); cookie.Values.Add("childxxid", EncryptUtils.Base64Encrypt(child.xxid.ToString())); cookie.Values.Add("childxxmc", EncryptUtils.Base64Encrypt(child.XXMC ?? "")); cookie.Values.Add("childbjid", EncryptUtils.Base64Encrypt(child.BJID.ToString())); cookie.Values.Add("childbjmc", EncryptUtils.Base64Encrypt(child.bjmc ?? "")); cookie.Values.Add("childuserid", EncryptUtils.Base64Encrypt(child.xsid.ToString())); cookie.Values.Add("childusername", EncryptUtils.Base64Encrypt(child.XM)); HttpContext.Current.Response.AppendCookie(cookie); } }
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)); }
public ActionResult ClassKB(Guid id) { UCHomeEntities uc = new UCHomeEntities(); Guid xsid = id; View_Simple_StuInfo stu = uc.View_Simple_StuInfo.SingleOrDefault(u => u.xsid == xsid); return(PartialView("ClassKB", stu)); }
public ViewResult ChildRedirect(Guid childid) { //设置ChildGuid UCHomeEntities uc = new UCHomeEntities(); View_Simple_StuInfo childinfo = uc.View_Simple_StuInfo.SingleOrDefault(s => s.xsid == childid); UCHomeBasePage.SetChildCookies(childinfo); return(View("HomePage", user)); }
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)); }
public ActionResult SystemAppRedirectPage(Guid id, string typename, Guid?MenuID) { if (user == null) { return(Redirect(Url.Action("Logout"))); } UCHomeEntities uc = new UCHomeEntities(); 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 { return(RedirectToAction("HomePage", "Home")); } } UCHome_App_System app = uc.UCHome_App_System.SingleOrDefault(u => u.PKID == id); if (app != null && app.AppTarget == "_blank") { return(Redirect(app.AppUrl)); } AppCollection sysapp = new AppCollection(); sysapp.app = app; ViewBag.SelMenuID = MenuID; ViewBag.TypeName = typename; return(PartialView("AppRedirectPage", sysapp)); }
public ActionResult Index() { UCHomeEntities uc = new UCHomeEntities(); 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 { return(RedirectToAction("HomePage", "Home")); } } return(View(user)); }
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); } }