Example #1
0
        /// <summary>
        /// Updates a record in the <c>lkpCasepriority</c> table.
        /// </summary>
        /// <param name="value">The <see cref="lkpCasepriorityRow"/>
        /// object used to update the table record.</param>
        /// <returns>true if the record was updated; otherwise, false.</returns>
        public virtual bool Update(lkpCasepriorityRow value)
        {
            IDbCommand cmd = _db.CreateCommand("dbo._lkpCasepriority_Update", true);

            AddParameter(cmd, "CaseProName", value.CaseProName);
            AddParameter(cmd, "CaseProID", value.CaseProID);
            return(0 != cmd.ExecuteNonQuery());
        }
Example #2
0
        /// <summary>
        /// Adds a new record into the <c>lkpCasepriority</c> table.
        /// </summary>
        /// <param name="value">The <see cref="lkpCasepriorityRow"/> object to be inserted.</param>
        public virtual void Insert(lkpCasepriorityRow value)
        {
            IDbCommand cmd = _db.CreateCommand("dbo._lkpCasepriority_Insert", true);

            AddParameter(cmd, "CaseProID", value.CaseProID);
            AddParameter(cmd, "CaseProName", value.CaseProName);
            cmd.ExecuteNonQuery();
        }
Example #3
0
        /// <summary>
        /// Reads data from the provided data reader and returns
        /// an array of mapped objects.
        /// </summary>
        /// <param name="reader">The <see cref="System.Data.IDataReader"/> object to read data from the table.</param>
        /// <param name="startIndex">The index of the first record to map.</param>
        /// <param name="length">The number of records to map.</param>
        /// <param name="totalRecordCount">A reference parameter that returns the total number
        /// of records in the reader object if 0 was passed into the method; otherwise it returns -1.</param>
        /// <returns>An array of <see cref="lkpCasepriorityRow"/> objects.</returns>
        protected virtual lkpCasepriorityRow[] MapRecords(IDataReader reader,
                                                          int startIndex, int length, ref int totalRecordCount)
        {
            if (0 > startIndex)
            {
                throw new ArgumentOutOfRangeException("startIndex", startIndex, "StartIndex cannot be less than zero.");
            }
            if (0 > length)
            {
                throw new ArgumentOutOfRangeException("length", length, "Length cannot be less than zero.");
            }

            int caseProIDColumnIndex   = reader.GetOrdinal("caseProID");
            int caseProNameColumnIndex = reader.GetOrdinal("caseProName");

            System.Collections.ArrayList recordList = new System.Collections.ArrayList();
            int ri = -startIndex;

            while (reader.Read())
            {
                ri++;
                if (ri > 0 && ri <= length)
                {
                    lkpCasepriorityRow record = new lkpCasepriorityRow();
                    recordList.Add(record);

                    record.CaseProID = Convert.ToInt32(reader.GetValue(caseProIDColumnIndex));
                    if (!reader.IsDBNull(caseProNameColumnIndex))
                    {
                        record.CaseProName = Convert.ToString(reader.GetValue(caseProNameColumnIndex));
                    }

                    if (ri == length && 0 != totalRecordCount)
                    {
                        break;
                    }
                }
            }

            totalRecordCount = 0 == totalRecordCount ? ri + startIndex : -1;
            return((lkpCasepriorityRow[])(recordList.ToArray(typeof(lkpCasepriorityRow))));
        }
Example #4
0
        /// <summary>
        /// Converts <see cref="System.Data.DataRow"/> to <see cref="lkpCasepriorityRow"/>.
        /// </summary>
        /// <param name="row">The <see cref="System.Data.DataRow"/> object to be mapped.</param>
        /// <returns>A reference to the <see cref="lkpCasepriorityRow"/> object.</returns>
        protected virtual lkpCasepriorityRow MapRow(DataRow row)
        {
            lkpCasepriorityRow mappedObject = new lkpCasepriorityRow();
            DataTable          dataTable    = row.Table;
            DataColumn         dataColumn;

            // Column "CaseProID"
            dataColumn = dataTable.Columns["CaseProID"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.CaseProID = (int)row[dataColumn];
            }
            // Column "CaseProName"
            dataColumn = dataTable.Columns["CaseProName"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.CaseProName = (string)row[dataColumn];
            }
            return(mappedObject);
        }
Example #5
0
 /// <summary>
 /// Deletes the specified object from the <c>lkpCasepriority</c> table.
 /// </summary>
 /// <param name="value">The <see cref="lkpCasepriorityRow"/> object to delete.</param>
 /// <returns>true if the record was deleted; otherwise, false.</returns>
 public bool Delete(lkpCasepriorityRow value)
 {
     return(DeleteByPrimaryKey(value.CaseProID));
 }