示例#1
0
        public static void Create(User model, out string redirectUrl)
        {
            redirectUrl = string.Empty;

            //Set authorization cookie
            FormsAuthentication.SetAuthCookie(TextHelper.ToString(model.UserId), false);

            var returnUrl = QueryHelper.GetQueryString("ReturnUrl");

            //Create Cookie
            if (!UserCookie.Create(model))
                return;

            redirectUrl = returnUrl;

            if (string.IsNullOrEmpty(redirectUrl))
            {
                switch (model.UserRoleId)
                {
                    //Administrator
                    case 1:
                        redirectUrl = "~/Admin/";
                        break;

                    default:
                        redirectUrl = "~/";
                        break;
                }
            }
        }
示例#2
0
        public static bool Create(User model)
        {
            //Create Cookie
            var cookie = new HttpCookie(CookieName);

            //Assign Cookie
            cookie["id"] = TextHelper.ToString(model.UserId);
            cookie["name"] = model.Name;
            cookie["roleId"] = TextHelper.ToString(model.UserRoleId);
            cookie.Expires = DateTime.Now.AddDays(30);

            //Add Cookie
            HttpContext.Current.Response.Cookies.Add(cookie);

            return IsCookieExist();
        }
示例#3
0
 partial void DeleteUser(User instance);
示例#4
0
 partial void UpdateUser(User instance);
示例#5
0
 partial void InsertUser(User instance);
示例#6
0
		private void detach_Users(User entity)
		{
			this.SendPropertyChanging();
			entity.UserRole = null;
		}
示例#7
0
		private void attach_Users(User entity)
		{
			this.SendPropertyChanging();
			entity.UserRole = this;
		}