/// <summary> /// Add common parameters before calling a procedure /// </summary> /// <param name="cmd">command object, where parameters will be added</param> /// <param name="userLoginObject"></param> private void AddCommonParams(SqlCommand cmd, UserLoginBase userLoginObject) { AddParameter(cmd, pGuid(UserLoginBase.Property_UserId, userLoginObject.UserId)); AddParameter(cmd, pNVarChar(UserLoginBase.Property_UserName, 250, userLoginObject.UserName)); AddParameter(cmd, pNVarChar(UserLoginBase.Property_Password, 100, userLoginObject.Password)); AddParameter(cmd, pNVarChar(UserLoginBase.Property_EmailAddress, 500, userLoginObject.EmailAddress)); AddParameter(cmd, pBool(UserLoginBase.Property_IsActive, userLoginObject.IsActive)); AddParameter(cmd, pBool(UserLoginBase.Property_IsDeleted, userLoginObject.IsDeleted)); AddParameter(cmd, pNVarChar(UserLoginBase.Property_LastUpdatedBy, 250, userLoginObject.LastUpdatedBy)); AddParameter(cmd, pDateTime(UserLoginBase.Property_LastUpdatedDate, userLoginObject.LastUpdatedDate)); }
/// <summary> /// Fills UserLogin object /// </summary> /// <param name="userLoginObject">The object to be filled</param> /// <param name="reader">The reader to use to fill a single object</param> /// <param name="start">The ordinal position from which to start reading the reader</param> protected void FillObject(UserLoginBase userLoginObject, SqlDataReader reader, int start) { userLoginObject.Id = reader.GetInt32(start + 0); userLoginObject.UserId = reader.GetGuid(start + 1); userLoginObject.Username = reader.GetString(start + 2); userLoginObject.Password = reader.GetString(start + 3); userLoginObject.EmailAddress = reader.GetString(start + 4); userLoginObject.IsActive = reader.GetBoolean(start + 5); userLoginObject.IsDeleted = reader.GetBoolean(start + 6); userLoginObject.CreatedDate = reader.GetDateTime(start + 7); if (!reader.IsDBNull(8)) { userLoginObject.UserRole = reader.GetString(start + 8); } FillBaseObject(userLoginObject, reader, (start + 9)); userLoginObject.RowState = BaseBusinessEntity.RowStateEnum.NormalRow; }
/// <summary> /// Updates UserLogin /// </summary> /// <param name="userLoginObject">Object to be updated</param> /// <returns>Number of rows affected</returns> public long Update(UserLoginBase userLoginObject) { try { SqlCommand cmd = GetSPCommand(UPDATEUSERLOGIN); AddParameter(cmd, pInt32(UserLoginBase.Property_Id, userLoginObject.Id)); AddCommonParams(cmd, userLoginObject); long result = UpdateRecord(cmd); if (result > 0) { userLoginObject.RowState = BaseBusinessEntity.RowStateEnum.NormalRow; } return(result); } catch (SqlException x) { throw new ObjectUpdateException(userLoginObject, x); } }
/// <summary> /// Inserts UserLogin /// </summary> /// <param name="userLoginObject">Object to be inserted</param> /// <returns>Number of rows affected</returns> public long Insert(UserLoginBase userLoginObject) { try { SqlCommand cmd = GetSPCommand(INSERTUSERLOGIN); AddParameter(cmd, pInt32Out(UserLoginBase.Property_Id)); AddCommonParams(cmd, userLoginObject); long result = InsertRecord(cmd); if (result > 0) { userLoginObject.RowState = BaseBusinessEntity.RowStateEnum.NormalRow; userLoginObject.Id = (Int32)GetOutParameter(cmd, UserLoginBase.Property_Id); } return(result); } catch (SqlException x) { throw new ObjectInsertException(userLoginObject, x); } }
/// <summary> /// Fills UserLogin object /// </summary> /// <param name="userLoginObject">The object to be filled</param> /// <param name="reader">The reader to use to fill a single object</param> protected void FillObject(UserLoginBase userLoginObject, SqlDataReader reader) { FillObject(userLoginObject, reader, 0); }
public void SetUserLoginPlanner(UserLoginBase _userLoginBase) { this.userLoginBase = _userLoginBase; }