コード例 #1
0
        /// <summary>
        /// Deletes the extra class item.
        /// </summary>
        /// <returns></returns>
        public bool DeleteFeatPrerequisiteDarkSide()
        {
            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 = "Delete_FeatPrerequisiteDarkSide";
                command.Parameters.Add(dbconn.GenerateParameterObj("@FeatID", SqlDbType.Int, FeatID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@DarkSideScore", SqlDbType.Int, DarkSideScore.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@TotalDarkSide", SqlDbType.Bit, TotalDarkSide.ToString(), 0));
                result = command.ExecuteReader();
            }
            catch
            {
                Exception e = new Exception();
                this._deleteOK = false;
                this._deletionMessage.Append(e.Message + "                     Inner Exception= " + e.InnerException);
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            return(this.DeleteOK);
        }
コード例 #2
0
ファイル: Feat.cs プロジェクト: dantastic-66/SWRPG_Sample
        /// <summary>
        /// Saves the feat.
        /// </summary>
        /// <returns></returns>
        public Feat SaveFeat()
        {
            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_Feat";
                command.Parameters.Add(dbconn.GenerateParameterObj("@FeatID", SqlDbType.Int, FeatID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@FeatName", SqlDbType.VarChar, FeatName.ToString(), 50));
                command.Parameters.Add(dbconn.GenerateParameterObj("@FeatDescription", SqlDbType.VarChar, FeatDescription.ToString(), 400));
                result = command.ExecuteReader();

                result.Read();
                SetReaderToObject(ref result);
            }
            catch
            {
                Exception e = new Exception();
                this._validated = false;
                this._validationMessage.Append(e.Message.ToString());
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            return(this);
        }
コード例 #3
0
ファイル: Feat.cs プロジェクト: dantastic-66/SWRPG_Sample
        /// <summary>
        /// Deletes the feat.
        /// </summary>
        /// <returns></returns>
        public bool DeleteFeat()
        {
            bool               retDeleteGood = true;
            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 = "Delete_Feat";
                command.Parameters.Add(dbconn.GenerateParameterObj("@FeatID", SqlDbType.Int, FeatID.ToString(), 0));
                result = command.ExecuteReader();
            }
            catch
            {
                Exception e = new Exception();
                this._deleteOK = false;
                this._deletionMessage.Append(e.Message.ToString());
                retDeleteGood = false;
                throw e;
            }
            finally
            {
                command.Dispose();
                connection.Close();
            }
            _deleteOK = retDeleteGood;
            return(retDeleteGood);
        }
コード例 #4
0
        //public List<Feat> GetPrestigeRequiredFeats(string strWhere, string strOrderBy)
        //{
        //    List<Feat> feats = new List<Feat>();

        //    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 = "Select_PrestigeRequiredFeats";
        //        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())
        //        {
        //            Feat feat = new Feat();
        //            SetReaderToObject(ref feat, ref result);
        //            feats.Add(feat);
        //        }
        //    }
        //    catch
        //    {
        //        Exception e = new Exception();
        //        throw e;
        //    }
        //    finally
        //    {
        //        command.Dispose();
        //        connection.Close();
        //    }
        //    return feats;
        //}

        //public List<Feat> GetPrestigeRequiredFeatGroups(string strWhere, string strOrderBy)
        //{
        //    List<Feat> feats = new List<Feat>();

        //    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 = "Select_PrestigeRequiredFeatGroups";
        //        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())
        //        {
        //            Feat feat = new Feat();
        //            SetReaderToObject(ref feat, ref result);
        //            feats.Add(feat);
        //        }
        //    }
        //    catch
        //    {
        //        Exception e = new Exception();
        //        throw e;
        //    }
        //    finally
        //    {
        //        command.Dispose();
        //        connection.Close();
        //    }
        //    return feats;
        //}

        //public List<Feat> GetFeats(string strWhere, string strOrderby)
        //{
        //    SqlDataReader result;
        //    DatabaseConnection dbconn = new DatabaseConnection();
        //    SqlCommand command = new SqlCommand();
        //    SqlConnection connection = new SqlConnection(dbconn.SQLSEVERConnString);

        //    List<Feat> Feats = new List<Feat>();
        //    try
        //    {
        //        connection.Open();
        //        command.Connection = connection;
        //        command.CommandType = CommandType.StoredProcedure;
        //        command.CommandText = "Select_Feat";
        //        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())
        //        {
        //            Feat feat = new Feat();
        //            SetReaderToObject(ref feat, ref result);
        //            Feats.Add(feat);
        //        }
        //    }
        //    catch
        //    {
        //        Exception e = new Exception();
        //        throw e;
        //    }
        //    finally
        //    {
        //        command.Dispose();
        //        connection.Close();
        //    }
        //    return Feats;

        //}

        //public Feat SaveFeat()
        //{

        //    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_Feat";
        //        command.Parameters.Add(dbconn.GenerateParameterObj("@FeatID", SqlDbType.Int, FeatID.ToString(), 0));
        //        command.Parameters.Add(dbconn.GenerateParameterObj("@FeatName", SqlDbType.VarChar, FeatName.ToString(), 50));
        //        command.Parameters.Add(dbconn.GenerateParameterObj("@FeatDescription", SqlDbType.VarChar, FeatDescription.ToString(), 400));
        //        result = command.ExecuteReader();

        //        result.Read();
        //        SetReaderToObject(ref result);

        //    }
        //    catch
        //    {
        //        Exception e = new Exception();
        //        this._validated = false;
        //        this._validationMessage.Append(e.Message.ToString());
        //        throw e;
        //    }
        //    finally
        //    {
        //        command.Dispose();
        //        connection.Close();
        //    }
        //    return this;
        //}

        /// <summary>
        /// Saves the extra class item.
        /// </summary>
        /// <returns></returns>
        public FeatPrerequisiteAbility SaveFeatPrerequisiteAbility()
        {
            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_FeatPrequisiteAbility";
                command.Parameters.Add(dbconn.GenerateParameterObj("@FeatID", SqlDbType.Int, FeatID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@AbilityID", SqlDbType.Int, AbilityID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@AbilityMinimum", SqlDbType.Int, AbilityMinimum.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);
        }