Пример #1
0
        /// <summary>
        /// Deletes the sub skill.
        /// </summary>
        /// <returns>boolean</returns>
        public bool DeleteSubSkill()
        {
            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_SubSkill";
                command.Parameters.Add(dbconn.GenerateParameterObj("@SubSkillID", SqlDbType.Int, SubSkillID.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
        /// <summary>
        /// Saves the sub skill.
        /// </summary>
        /// <returns>SubSkill object</returns>
        public SubSkill SaveSubSkill()
        {
            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_SubSkill";
                command.Parameters.Add(dbconn.GenerateParameterObj("@SubSkillID", SqlDbType.Int, SubSkillID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@SkillID", SqlDbType.Int, SkillID.ToString(), 0));
                command.Parameters.Add(dbconn.GenerateParameterObj("@SubSkillName", SqlDbType.VarChar, SubSkillName.ToString(), 100));
                command.Parameters.Add(dbconn.GenerateParameterObj("@SubSkillDescription", SqlDbType.VarChar, SubSkillDescription.ToString(), 1000));
                command.Parameters.Add(dbconn.GenerateParameterObj("@Trained", SqlDbType.Bit, Trained.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);
        }