Esempio n. 1
0
 public fwUser Insert(fwUser obj)
 {
     var ID = DataUtilities.Insert(@"insert into fwUser([AspnetUserID], [UserName], [Name], [Email], [Status], [Locked], [Avata], [NotiCount], [Pass]) values(@AspnetUserID, @UserName, @Name, @Email, @Status, @Locked, @Avata, @NotiCount, @Pass)",
         CommandType.Text, "@AspnetUserID", obj.AspnetUserID, "@UserName", obj.UserName, "@Name", obj.Name, "@Email", obj.Email, "@Status", obj.Status, "@Locked", obj.Locked, "@Avata", obj.Avata, "@NotiCount", obj.NotiCount, "@Pass", obj.Pass);
     obj.ID = ID;
     return obj;
 }
Esempio n. 2
0
 private fwUser CreateObj(DataRow row)
 {
     var obj = new fwUser();
     obj.ID = (int)row["ID"];
     obj.AspnetUserID = row["AspnetUserID"].ToString();
     obj.UserName = (string)row["UserName"];
     obj.Name = GetString(row["Name"]);
     obj.Email = GetString(row["Email"]);
     obj.PhoneNumber = GetString(row["PhoneNumber"]);
     obj.Address = GetString(row["Address"]);
     obj.Status = (int)row["Status"];
     obj.Locked = (bool)row["Locked"];
     obj.Avata = GetString(row["Avata"]);
     obj.NotiCount = GetInt(row["NotiCount"]);
     obj.Avata = GetString(row["Pass"]);
     return obj;
 }
Esempio n. 3
0
 public bool UserInRole(fwUser user, params string[] roles)
 {
     if (user == null) return false;
     return UserInRole(user.ID, roles);
 }
Esempio n. 4
0
 public fwUser Update(fwUser obj)
 {
     var ID = DataUtilities.ExcuteNonQuery(@"update fwUser set [UserName]=@UserName, [Email]=@Email, [Status]=@Status, [Locked]=@Locked, [Avata]=@Avata, [NotiCount] = @NotiCount, [Pass]=@Pass where ID=@ID",
         CommandType.Text, "@UserName", obj.UserName, "@Name", obj.Name, "@Email", obj.Email, "@Status", obj.Status, "@Locked", obj.Locked, "@Avata", obj.Avata, "@NotiCount", obj.NotiCount, "@Pass", obj.Pass, "@ID", obj.ID);
     return obj;
 }
Esempio n. 5
0
 public ActionResult EditUser(fwUser model, string returnUrl)
 {
     if (model.ID == 0)
         new fwUserDAL().Insert(model);
     else
         new fwUserDAL().Update(model);
     return Redirect(returnUrl);
 }
Esempio n. 6
0
        public async Task<ActionResult> Register(RegisterViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new ApplicationUser() { UserName = model.UserName };
                var result = await UserManager.CreateAsync(user, model.Password);
                if (result.Succeeded)
                {
                    var fwUser = new fwUser
                    {
                        AspnetUserID = user.Id,
                        UserName = user.UserName,
                        Locked = false,
                        Status = 1
                    };
                    new fwUserDAL().Insert(fwUser);
                    await SignInAsync(user, isPersistent: false);
                    return RedirectToAction("Index", "Home");
                }
                else
                {
                    AddErrors(result);
                }
            }

            // If we got this far, something failed, redisplay form
            return View(model);
        }