/// <summary> /// Sets the reader to the parameter Force Secret object.. /// </summary> /// <param name="objForceSecret">The object force secret.</param> /// <param name="result">SqlDataReader</param> private void SetReaderToObject(ref ForceSecret objForceSecret, ref SqlDataReader result) { if (result.HasRows) { objForceSecret.ForceSecretID = (int)result.GetValue(result.GetOrdinal("ForceSecretID")); objForceSecret.ForceSecretName = result.GetValue(result.GetOrdinal("ForceSecretName")).ToString(); objForceSecret.ForceSecretDescription = result.GetValue(result.GetOrdinal("ForceSecretDescription")).ToString(); } }
/// <summary> /// Clones the specified LST ForceSecret. /// </summary> /// <param name="lstForceSecret">The LST ForceSecret.</param> /// <returns>List<ForceSecret></returns> static public List <ForceSecret> Clone(List <ForceSecret> lstForceSecret) { List <ForceSecret> lstCForceSecret = new List <ForceSecret>(); foreach (ForceSecret objForceSecret in lstForceSecret) { lstCForceSecret.Add(ForceSecret.Clone(objForceSecret)); } return(lstCForceSecret); }
/// <summary> /// Gets the force secret list. /// </summary> /// <param name="strSprocName">Name of the string sproc.</param> /// <param name="strWhere">The string where.</param> /// <param name="strOrderBy">The string order by.</param> /// <returns> List<ForceSecret></returns> private List <ForceSecret> GetForceSecretList(string strSprocName, string strWhere, string strOrderBy) { List <ForceSecret> ForceSecrets = new List <ForceSecret>(); SqlDataReader result; DatabaseConnection dbconn = new DatabaseConnection(); SqlCommand command = new SqlCommand(); SqlConnection connection = new SqlConnection(dbconn.SQLSEVERConnString); try { connection.Open(); command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = strSprocName; command.Parameters.Add(dbconn.GenerateParameterObj("@strWhere", SqlDbType.VarChar, strWhere, 1000)); command.Parameters.Add(dbconn.GenerateParameterObj("@strOrderBy", SqlDbType.VarChar, strOrderBy, 1000)); result = command.ExecuteReader(); while (result.Read()) { ForceSecret objForceSecret = new ForceSecret(); SetReaderToObject(ref objForceSecret, ref result); ForceSecrets.Add(objForceSecret); } } catch { Exception e = new Exception(); throw e; } finally { command.Dispose(); connection.Close(); } return(ForceSecrets); }
/// <summary> /// Saves the ClassLevelInfo. /// </summary> /// <returns>ClassLevelInfo Object</returns> public ClassLevelInfo SaveClassLevelInfo() { SqlDataReader result; DatabaseConnection dbconn = new DatabaseConnection(); SqlCommand command = new SqlCommand(); SqlConnection connection = new SqlConnection(dbconn.SQLSEVERConnString); try { connection.Open(); command.Connection = connection; command.CommandType = CommandType.StoredProcedure; command.CommandText = "InsertUpdate_ClassLevel"; command.Parameters.Add(dbconn.GenerateParameterObj("@ClassLevelID", SqlDbType.Int, ClassLevelID.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@ClassID", SqlDbType.Int, ClassID.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@ClassLevel", SqlDbType.Int, ClassLevel.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@BonusFeat", SqlDbType.Int, BonusFeat.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@Talent", SqlDbType.Int, Talent.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@BaseAttack", SqlDbType.Int, BaseAttack.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@ForcePointBase", SqlDbType.Int, ForcePointBase.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@ForceTechnique", SqlDbType.Int, ForceTechnique.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@ForceSecret", SqlDbType.Int, ForceSecret.ToString(), 0)); command.Parameters.Add(dbconn.GenerateParameterObj("@MedicalSecret", SqlDbType.Int, MedicalSecret.ToString(), 0)); result = command.ExecuteReader(); result.Read(); SetReaderToObject(ref result); } catch { Exception e = new Exception(); this._insertUpdateOK = false; this._insertUpdateMessage.Append(e.Message + " Inner Exception= " + e.InnerException); throw e; } finally { command.Dispose(); connection.Close(); } return(this); }
/// <summary> /// Clones the specified object ForceSecret. /// </summary> /// <param name="objForceSecret">The object ForceSecret.</param> /// <returns>ForceSecret</returns> static public ForceSecret Clone(ForceSecret objForceSecret) { ForceSecret objCForceSecret = new ForceSecret(objForceSecret.ForceSecretID); return(objCForceSecret); }