Beispiel #1
0
        public void ProcessRequest(HttpContext context)
        {
            Guid attenduser = Guid.Empty;

            if (!string.IsNullOrEmpty(context.Request["attenduser"]))
            {
                attenduser = new Guid(context.Request["attenduser"]);
            }
            Guid adduser = Guid.Empty;

            if (!string.IsNullOrEmpty(context.Request["adduser"]))
            {
                adduser = new Guid(context.Request["adduser"]);
            }
            UCHomeEntities   uc  = new UCHomeEntities();
            View_Simple_User vsu = uc.View_Simple_User.SingleOrDefault(u => u.userid == attenduser);

            if (vsu != null)
            {
                UCHome_Attention attent = new UCHome_Attention();
                attent.PKID      = Guid.NewGuid();
                attent.AddUser   = adduser;
                attent.AttenUser = vsu.userid;
                attent.AttenName = vsu.username; attent.AttenTime = DateTime.Now;
                uc.UCHome_Attention.AddObject(attent);
                uc.SaveChanges();
                context.Response.ContentType = "text/plain";
                context.Response.Write(true);
            }
            else
            {
                context.Response.ContentType = "text/plain";
                context.Response.Write(false);
            }
        }
        public JsonResult RemoveMyBook(string removeUserId)
        {
            var reUserId = new Guid(removeUserId);

            UCHomeBasePage   ucbBasePage = new UCHomeBasePage();
            Guid             adduser     = user.userid;
            UCHomeEntities   uc          = new UCHomeEntities();
            View_Simple_User vsu         = uc.View_Simple_User.SingleOrDefault(u => u.userid == reUserId);

            if (vsu != null)
            {
                UCHome_Attention attent =
                    uc.UCHome_Attention.FirstOrDefault(u => u.AddUser == adduser && u.AttenUser == vsu.userid);
                if (attent != null)
                {
                    uc.UCHome_Attention.DeleteObject(attent);
                    uc.SaveChanges();

                    var            client1 = new JsonServiceClient(http + "/SNSApi/");
                    DeleteAddrBook book    = new DeleteAddrBook
                    {
                        GroupID = user.userid.ToString(),
                        UID     = vsu.userid.ToString()
                    };

                    client1.Delete(book);
                }
                return(Json(true, JsonRequestBehavior.AllowGet));
            }
            return(Json(false, JsonRequestBehavior.AllowGet));
        }
        public ActionResult AddMyBook(string addUserId)
        {
            var aUserId = new Guid(addUserId);

            UCHomeBasePage   ucbBasePage = new UCHomeBasePage();
            Guid             adduser     = user.userid;
            UCHomeEntities   uc          = new UCHomeEntities();
            View_Simple_User vsu         = uc.View_Simple_User.SingleOrDefault(u => u.userid == aUserId);

            if (vsu != null)
            {
                UCHome_Attention attent = new UCHome_Attention();
                attent.PKID          = Guid.NewGuid();
                attent.AddUser       = adduser;
                attent.AttenUser     = vsu.userid;
                attent.AttenName     = vsu.username; attent.AttenTime = DateTime.Now;
                attent.AttenIdentity = vsu.usertype.ToUpper();
                uc.UCHome_Attention.AddObject(attent);
                uc.SaveChanges();

                AddAddrBookEntry book = new AddAddrBookEntry
                {
                    GroupID   = user.userid.ToString(),
                    GroupName = "我的关注",
                    UID       = vsu.userid.ToString(),
                    UName     = vsu.username
                };

                client.Send <AddAddrBookEntry>(book);

                return(Json(true, JsonRequestBehavior.AllowGet));
            }
            return(Json(false, JsonRequestBehavior.AllowGet));
        }
        public ActionResult CancelAttent(Guid AttentUser)
        {
            View_Simple_User vsu = uc.View_Simple_User.SingleOrDefault(u => u.userid == AttentUser);

            if (vsu != null)
            {
                UCHome_Attention attent =
                    uc.UCHome_Attention.FirstOrDefault(u => u.AddUser == userid && u.AttenUser == vsu.userid);
                if (attent != null)
                {
                    uc.UCHome_Attention.DeleteObject(attent);
                    uc.SaveChanges();

                    var            client1 = new JsonServiceClient(http + "/SNSApi/");
                    DeleteAddrBook book    = new DeleteAddrBook
                    {
                        GroupID = user.userid.ToString(),
                        UID     = vsu.userid.ToString()
                    };

                    client1.Delete(book);
                }
                return(Json(true, JsonRequestBehavior.AllowGet));
            }
            return(Json(false, JsonRequestBehavior.AllowGet));
        }
        public ActionResult AddAttent(Guid AttentUser)
        {
            View_Simple_User vsu = uc.View_Simple_User.SingleOrDefault(u => u.userid == AttentUser);

            if (vsu != null)
            {
                UCHome_Attention attent = new UCHome_Attention
                {
                    PKID          = Guid.NewGuid(),
                    AddUser       = userid,
                    AttenUser     = vsu.userid,
                    AttenName     = vsu.username,
                    AttenTime     = DateTime.Now,
                    AttenIdentity = vsu.usertype.ToUpper()
                };
                uc.UCHome_Attention.AddObject(attent);
                uc.SaveChanges();

                AddAddrBookEntry book = new AddAddrBookEntry
                {
                    GroupID   = user.userid.ToString(),
                    GroupName = "我的关注",
                    UID       = vsu.userid.ToString(),
                    UName     = vsu.username
                };

                client.Send <AddAddrBookEntry>(book);

                return(Json(true, JsonRequestBehavior.AllowGet));
            }
            return(Json(false, JsonRequestBehavior.AllowGet));
        }
        public ActionResult staticnews(Guid id)
        {
            UCHomeEntities   uc   = new UCHomeEntities();
            Guid             jsid = id;//new Guid("efcf1840-e5d6-42cd-a1a3-5f457bc680bf"); //LoginSet.Consts.CurrentUser.ID;
            View_Simple_User tea  = uc.View_Simple_User.SingleOrDefault(u => u.userid == jsid);

            return(PartialView("staticnews", tea));
        }
Beispiel #7
0
        public static void SetUserCookies(View_Simple_User u)
        {
            HttpCookie cookie = new HttpCookie("PersonInfo");

            cookie.Values.Add("areacode", EncryptUtils.Base64Encrypt(u.xzqhm ?? ""));
            cookie.Values.Add("xxid", EncryptUtils.Base64Encrypt(u.xxid.ToString()));
            cookie.Values.Add("xxmc", EncryptUtils.Base64Encrypt(u.xxmc ?? ""));
            cookie.Values.Add("orgid", EncryptUtils.Base64Encrypt(u.orgid.ToString()));
            cookie.Values.Add("orgname", EncryptUtils.Base64Encrypt(u.orgname ?? ""));
            cookie.Values.Add("usertype", EncryptUtils.Base64Encrypt(u.usertype));
            cookie.Values.Add("userid", EncryptUtils.Base64Encrypt(u.userid.ToString()));
            cookie.Values.Add("username", EncryptUtils.Base64Encrypt(u.username));
            cookie.Values.Add("loginname", EncryptUtils.Base64Encrypt(u.loginname));
            HttpContext.Current.Response.AppendCookie(cookie);
        }
Beispiel #8
0
        public UserInfo GetUserInfoByRequestId(Guid id)
        {
            UCHomeEntities   uche = new UCHomeEntities();
            View_Simple_User u    = uche.View_Simple_User.SingleOrDefault(tea => tea.userid == id);

            if (u != null)
            {
                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
                };
                return(ui);
            }
            return(null);
        }
Beispiel #9
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"])
                            };
                        }
                    }
                }
            }
        }