예제 #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;
		}