public long UpdateUser(TblUserAccount entity) { long result = 0; //Check create new customer StringBuilder sqlinsert = new StringBuilder(); sqlinsert.Append(@" UPDATE [dbo].[TblUserAccount] SET [USER_NAME] = @USER_NAME ,[USER_AUTHORITY] = @USER_AUTHORITY ,[USER_CITY] = @USER_CITY ,[USER_DISTRICT] = @USER_DISTRICT ,[USER_TOWN] = @USER_TOWN ,[USER_ADDRESS] = @USER_ADDRESS ,[USER_PHONE] = @USER_PHONE ,[SHOP_NAME] = @SHOP_NAME ,[AREA] = @AREA ,[LOGIN_LOCK_FLG] = @LOGIN_LOCK_FLG ,[DEL_FLG] = @DEL_FLG ,[STATUS] = @STATUS ,[UPD_DATE] = @UPD_DATE WHERE [USER_ID] = @USER_ID"); result = base.DbUpdate(sqlinsert.ToString(), entity, new { USER_ID = entity.USER_ID }); return(result); }
// Xác nhận tài khoản public bool ConfirmEmail(long userId) { long result = 0; StringBuilder sqlinsert = new StringBuilder(); TblUserAccount entity = new TblUserAccount(); sqlinsert.Append(@" UPDATE [TblUserAccount] SET [EMAIL_CONFIRMED] = @EMAIL_CONFIRMED ,[UPD_DATE] = @UPD_DATE WHERE [USER_ID] = @USER_ID"); result = base.Execute(sqlinsert.ToString(), new { USER_ID = userId, EMAIL_CONFIRMED = EmailConfirmed.Yes, UPD_DATE = Utility.GetCurrentDateTime() }); if (result > 0) { return(true); } else { return(false); } }
public long UpdateUser(UserAccountModel model) { long res = 0; // Declare new DataAccess object UserAccountDa dataAccess = new UserAccountDa(); using (var transaction = new TransactionScope()) { TblUserAccount entity = new TblUserAccount(); entity.USER_ID = model.USER_ID = model.USER_ID_HIDDEN; entity.USER_NAME = model.USER_NAME; entity.SHOP_NAME = model.SHOP_NAME; entity.AREA = model.AREA; entity.USER_CITY = model.USER_CITY; entity.USER_DISTRICT = model.USER_DISTRICT; entity.USER_TOWN = model.USER_TOWN; entity.USER_ADDRESS = model.USER_ADDRESS; entity.USER_PHONE = model.USER_PHONE; entity.INS_DATE = Utility.GetCurrentDateTime(); entity.PASSWORD_LAST_UPDATE_DATE = Utility.GetCurrentDateTime(); entity.UPD_DATE = Utility.GetCurrentDateTime(); res = dataAccess.UpdateUser(entity); if (res <= 0) { transaction.Dispose(); } transaction.Complete(); } return(res); }
public long InsertUser(TblUserAccount entity) { long result = 0; //Check create new customer StringBuilder sqlinsert = new StringBuilder(); sqlinsert.Append(@" INSERT INTO [TblUserAccount] ([USER_EMAIL] ,[EMAIL_CONFIRMED] ,[USER_NAME] ,[SHOP_NAME] ,[AREA] ,[USER_PASSWORD] ,[PASSWORD_LAST_UPDATE_DATE] ,[USER_AUTHORITY] ,[USER_CITY] ,[USER_DISTRICT] ,[USER_TOWN] ,[USER_ADDRESS] ,[USER_PHONE] ,[USER_FAMILY] ,[LOGIN_LOCK_FLG] ,[GENDER] ,[DEL_FLG] ,[STATUS] ,[INS_DATE] ,[UPD_DATE]) VALUES (@USER_EMAIL, @EMAIL_CONFIRMED, @USER_NAME, @SHOP_NAME, @AREA, @USER_PASSWORD, @PASSWORD_LAST_UPDATE_DATE, @USER_AUTHORITY, @USER_CITY, @USER_DISTRICT, @USER_TOWN, @USER_ADDRESS, @USER_PHONE, @USER_FAMILY, @LOGIN_LOCK_FLG, @GENDER, @DEL_FLG, @STATUS, @INS_DATE, @UPD_DATE)"); result = base.DbAdd(sqlinsert.ToString(), entity); return(result); }
public long InsertUser(UserAccountModel model) { long res = 0; // Declare new DataAccess object UserAccountDa dataAccess = new UserAccountDa(); using (var transaction = new TransactionScope()) { TblUserAccount entity = new TblUserAccount(); entity.USER_EMAIL = model.USER_EMAIL; entity.EMAIL_CONFIRMED = EmailConfirmed.None; entity.USER_NAME = model.USER_NAME; entity.SHOP_NAME = model.SHOP_NAME; entity.USER_PASSWORD = SafePassword.GetSaltedPassword(model.USER_PASSWORD); entity.PASSWORD_LAST_UPDATE_DATE = Utility.GetCurrentDateTime(); entity.USER_AUTHORITY = User_Authority.Set_Person; entity.AREA = model.AREA; entity.USER_CITY = model.USER_CITY; entity.USER_DISTRICT = model.USER_DISTRICT; entity.USER_TOWN = model.USER_TOWN; entity.USER_ADDRESS = model.USER_ADDRESS; entity.USER_PHONE = model.USER_PHONE; entity.USER_FAMILY = 0; entity.LOGIN_LOCK_FLG = LockFlag.NON_LOCK; entity.GENDER = true; entity.DEL_FLG = DeleteFlag.NON_DELETE; entity.STATUS = StatusFlag.NON_DISPLAY; // user chua duoc active entity.INS_DATE = Utility.GetCurrentDateTime(); entity.UPD_DATE = Utility.GetCurrentDateTime(); res = dataAccess.InsertUser(entity); if (res <= 0) { transaction.Dispose(); } transaction.Complete(); } return(res); }
public long ReSetPassword(long userId) { StringBuilder sqlinsert = new StringBuilder(); TblUserAccount entity = new TblUserAccount(); string password = "******"; password = SafePassword.GetSaltedPassword(password); sqlinsert.Append(@" UPDATE [TblUserAccount] SET [EMAIL_CONFIRMED] = @EMAIL_CONFIRMED ,[USER_PASSWORD] = @USER_PASSWORD ,[UPD_DATE] = @UPD_DATE WHERE [USER_ID] = @USER_ID"); return(base.Execute(sqlinsert.ToString(), new { USER_ID = userId, EMAIL_CONFIRMED = EmailConfirmed.RePassword, USER_PASSWORD = password, UPD_DATE = Utility.GetCurrentDateTime() })); }