/// <summary> /// Save /// </summary> /// <param name="model">User model</param> /// <returns>ResponseStatusCodeHelper</returns> public ResponseStatusCodeHelper Save(UserModel model) { try { using (var _context = new TDHEntities()) { string _password = null; if (model.Password != null && model.Password.Length > 0) { _password = Utils.Security.PasswordSecurityHelper.GetHashedPassword(model.Password); } ObjectParameter _status = new ObjectParameter("STATUS", typeof(int)); int _return = _context.PROC_SYS_USER_Save(model.ID, model.FullName, model.UserName, _password, model.Locked, model.Notes, model.RoleID, model.Insert, this.SessionID, model.CreateBy, _status); if (_status.Value.ToString() == "0") { throw new DataAccessException(FILE_NAME, MethodInfo.GetCurrentMethod().Name, model.CreateBy); } } } catch (ServiceException serviceEx) { throw serviceEx; } catch (DataAccessException fieldEx) { throw fieldEx; } catch (Exception ex) { throw new ServiceException(FILE_NAME, MethodInfo.GetCurrentMethod().Name, model.CreateBy, ex); } if (model.Insert) { Notifier.Notification(model.CreateBy, Message.InsertSuccess, Notifier.TYPE.Success); } else { Notifier.Notification(model.CreateBy, Message.UpdateSuccess, Notifier.TYPE.Success); } return(ResponseStatusCodeHelper.Success); }