public int AddUser(dev_users usr, bool isWithoutRegistration) { if (isWithoutRegistration || !isLoginExist(usr.Login)) { return SaveUser(usr); } return 0; }
public dev_users GetSessionUser() { dev_users retval = new dev_users(); if (HttpContext.Current.Session[_sessionUserKey] != null) { dev_users tmp_retval = HttpContext.Current.Session[_sessionUserKey] as dev_users; if (tmp_retval != null) { retval = tmp_retval; } } return retval; }
public void SetSessionUser(int user_id) { dev_users user; if (user_id == 0) { user = new dev_users(); } else { user = GetUser(user_id); } SetSessionUser(user); }
public void SetSessionUser(dev_users user) { // if registered user then try to serf basket items if (user.Id > 0) { string cookieSrc = string.Format("{0}{1}{2}", user.Id.ToString(), _hashSeparator, dev_security.GetMD5(user.Id.ToString())); cmng.WriteCookie(dev_accaunt_mng.CookieUserIdKey, cookieSrc, cmng.CookieExpire); // if serf is well then drop user goods at session dev_basket_mng sbmng = new dev_basket_mng(0); if (sbmng.GetBasket().Count > 0) { dev_basket_mng ubmng = new dev_basket_mng(user.Id); if (ubmng.UpdItems(sbmng.GetBasket()) > 0) { sbmng.ClearBasket(); } } } HttpContext.Current.Session[_sessionUserKey] = user; }
public int SaveUser(dev_users usr) { db.ClearParams(); db.AddParameter(new SqlParameter("@Id", usr.Id)); db.AddParameter(new SqlParameter("@Login", usr.Login)); db.AddParameter(new SqlParameter("@Adres", usr.Adres)); db.AddParameter(new SqlParameter("@Deleted", usr.Deleted)); db.AddParameter(new SqlParameter("@Dop_info", usr.Dop_info)); db.AddParameter(new SqlParameter("@Email", usr.Email)); db.AddParameter(new SqlParameter("@Fname", usr.Fname)); db.AddParameter(new SqlParameter("@Lname", usr.Lname)); db.AddParameter(new SqlParameter("@Mname", usr.Mname)); db.AddParameter(new SqlParameter("@Phone", usr.Phone)); db.AddParameter(new SqlParameter("@Pswd", usr.Pswd)); db.SetStoredProcedure("PersonalCabinet.User_Save"); return db.GetReturnValue<int>(); }