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

            AddParameter(cmd, "Payment_Date", value.Payment_Date);
            AddParameter(cmd, "Reference", value.Reference);
            AddParameter(cmd, "Vendor_Id",
                         value.IsVendor_IdNull ? DBNull.Value : (object)value.Vendor_Id);
            AddParameter(cmd, "CashBank", value.CashBank);
            AddParameter(cmd, "ChequeNo", value.ChequeNo);
            AddParameter(cmd, "Payment_Type_Id", value.Payment_Type_Id);
            AddParameter(cmd, "Invoice_Id",
                         value.IsInvoice_IdNull ? DBNull.Value : (object)value.Invoice_Id);
            AddParameter(cmd, "Amount", value.Amount);
            AddParameter(cmd, "Donor_Id", value.Donor_Id);
            AddParameter(cmd, "GL_Act_Id", value.GL_Act_Id);
            AddParameter(cmd, "Currency_Id", value.Currency_Id);
            AddParameter(cmd, "Company_Id", value.Company_Id);
            AddParameter(cmd, "Created_By", value.Created_By);
            AddParameter(cmd, "Created_Time", value.Created_Time);
            AddParameter(cmd, "Updated_By", value.Updated_By);
            AddParameter(cmd, "Updated_Time", value.Updated_Time);
            AddParameter(cmd, "Payment_Id", value.Payment_Id);
            return(0 != cmd.ExecuteNonQuery());
        }
示例#2
0
        /// <summary>
        /// Adds a new record into the <c>tblPayment</c> table.
        /// </summary>
        /// <param name="value">The <see cref="tblPaymentRow"/> object to be inserted.</param>
        public virtual void Insert(tblPaymentRow value)
        {
            IDbCommand cmd = _db.CreateCommand("dbo._tblPayment_Insert", true);

            AddParameter(cmd, "Payment_Date", value.Payment_Date);
            AddParameter(cmd, "Reference", value.Reference);
            AddParameter(cmd, "Vendor_Id",
                         value.IsVendor_IdNull ? DBNull.Value : (object)value.Vendor_Id);
            AddParameter(cmd, "CashBank", value.CashBank);
            AddParameter(cmd, "ChequeNo", value.ChequeNo);
            AddParameter(cmd, "Payment_Type_Id", value.Payment_Type_Id);
            AddParameter(cmd, "Invoice_Id",
                         value.IsInvoice_IdNull ? DBNull.Value : (object)value.Invoice_Id);
            AddParameter(cmd, "Amount", value.Amount);
            AddParameter(cmd, "Donor_Id", value.Donor_Id);
            AddParameter(cmd, "GL_Act_Id", value.GL_Act_Id);
            AddParameter(cmd, "Currency_Id", value.Currency_Id);
            AddParameter(cmd, "Company_Id", value.Company_Id);
            AddParameter(cmd, "Created_By", value.Created_By);
            AddParameter(cmd, "Created_Time", value.Created_Time);
            AddParameter(cmd, "Updated_By", value.Updated_By);
            AddParameter(cmd, "Updated_Time", value.Updated_Time);
            value.Payment_Id = Convert.ToInt32(cmd.ExecuteScalar());
        }
示例#3
0
        /// <summary>
        /// Converts <see cref="System.Data.DataRow"/> to <see cref="tblPaymentRow"/>.
        /// </summary>
        /// <param name="row">The <see cref="System.Data.DataRow"/> object to be mapped.</param>
        /// <returns>A reference to the <see cref="tblPaymentRow"/> object.</returns>
        protected virtual tblPaymentRow MapRow(DataRow row)
        {
            tblPaymentRow mappedObject = new tblPaymentRow();
            DataTable     dataTable    = row.Table;
            DataColumn    dataColumn;

            // Column "Payment_Id"
            dataColumn = dataTable.Columns["Payment_Id"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Payment_Id = (int)row[dataColumn];
            }
            // Column "Payment_Date"
            dataColumn = dataTable.Columns["Payment_Date"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Payment_Date = (System.DateTime)row[dataColumn];
            }
            // Column "Reference"
            dataColumn = dataTable.Columns["Reference"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Reference = (string)row[dataColumn];
            }
            // Column "Vendor_Id"
            dataColumn = dataTable.Columns["Vendor_Id"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Vendor_Id = (int)row[dataColumn];
            }
            // Column "CashBank"
            dataColumn = dataTable.Columns["CashBank"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.CashBank = (bool)row[dataColumn];
            }
            // Column "ChequeNo"
            dataColumn = dataTable.Columns["ChequeNo"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.ChequeNo = (string)row[dataColumn];
            }
            // Column "Payment_Type_Id"
            dataColumn = dataTable.Columns["Payment_Type_Id"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Payment_Type_Id = (int)row[dataColumn];
            }
            // Column "Invoice_Id"
            dataColumn = dataTable.Columns["Invoice_Id"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Invoice_Id = (int)row[dataColumn];
            }
            // Column "Amount"
            dataColumn = dataTable.Columns["Amount"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Amount = (int)row[dataColumn];
            }
            // Column "Donor_Id"
            dataColumn = dataTable.Columns["Donor_Id"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Donor_Id = (int)row[dataColumn];
            }
            // Column "GL_Act_Id"
            dataColumn = dataTable.Columns["GL_Act_Id"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.GL_Act_Id = (int)row[dataColumn];
            }
            // Column "Currency_Id"
            dataColumn = dataTable.Columns["Currency_Id"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Currency_Id = (int)row[dataColumn];
            }
            // Column "Company_Id"
            dataColumn = dataTable.Columns["Company_Id"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Company_Id = (int)row[dataColumn];
            }
            // Column "Created_By"
            dataColumn = dataTable.Columns["Created_By"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Created_By = (int)row[dataColumn];
            }
            // Column "Created_Time"
            dataColumn = dataTable.Columns["Created_Time"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Created_Time = (System.DateTime)row[dataColumn];
            }
            // Column "Updated_By"
            dataColumn = dataTable.Columns["Updated_By"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Updated_By = (int)row[dataColumn];
            }
            // Column "Updated_Time"
            dataColumn = dataTable.Columns["Updated_Time"];
            if (!row.IsNull(dataColumn))
            {
                mappedObject.Updated_Time = (System.DateTime)row[dataColumn];
            }
            return(mappedObject);
        }
示例#4
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="tblPaymentRow"/> objects.</returns>
        protected virtual tblPaymentRow[] 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 payment_IdColumnIndex      = reader.GetOrdinal("Payment_Id");
            int payment_DateColumnIndex    = reader.GetOrdinal("Payment_Date");
            int referenceColumnIndex       = reader.GetOrdinal("Reference");
            int vendor_IdColumnIndex       = reader.GetOrdinal("Vendor_Id");
            int cashBankColumnIndex        = reader.GetOrdinal("CashBank");
            int chequeNoColumnIndex        = reader.GetOrdinal("ChequeNo");
            int payment_Type_IdColumnIndex = reader.GetOrdinal("Payment_Type_Id");
            int invoice_IdColumnIndex      = reader.GetOrdinal("Invoice_Id");
            int amountColumnIndex          = reader.GetOrdinal("Amount");
            int donor_IdColumnIndex        = reader.GetOrdinal("Donor_Id");
            int gL_Act_IdColumnIndex       = reader.GetOrdinal("GL_Act_Id");
            int currency_IdColumnIndex     = reader.GetOrdinal("Currency_Id");
            int company_IdColumnIndex      = reader.GetOrdinal("Company_Id");
            int created_ByColumnIndex      = reader.GetOrdinal("Created_By");
            int created_TimeColumnIndex    = reader.GetOrdinal("Created_Time");
            int updated_ByColumnIndex      = reader.GetOrdinal("Updated_By");
            int updated_TimeColumnIndex    = reader.GetOrdinal("Updated_Time");

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

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

                    record.Payment_Id   = Convert.ToInt32(reader.GetValue(payment_IdColumnIndex));
                    record.Payment_Date = Convert.ToDateTime(reader.GetValue(payment_DateColumnIndex));
                    if (!reader.IsDBNull(referenceColumnIndex))
                    {
                        record.Reference = Convert.ToString(reader.GetValue(referenceColumnIndex));
                    }
                    if (!reader.IsDBNull(vendor_IdColumnIndex))
                    {
                        record.Vendor_Id = Convert.ToInt32(reader.GetValue(vendor_IdColumnIndex));
                    }
                    record.CashBank = Convert.ToBoolean(reader.GetValue(cashBankColumnIndex));
                    if (!reader.IsDBNull(chequeNoColumnIndex))
                    {
                        record.ChequeNo = Convert.ToString(reader.GetValue(chequeNoColumnIndex));
                    }
                    record.Payment_Type_Id = Convert.ToInt32(reader.GetValue(payment_Type_IdColumnIndex));
                    if (!reader.IsDBNull(invoice_IdColumnIndex))
                    {
                        record.Invoice_Id = Convert.ToInt32(reader.GetValue(invoice_IdColumnIndex));
                    }
                    record.Amount       = Convert.ToInt32(reader.GetValue(amountColumnIndex));
                    record.Donor_Id     = Convert.ToInt32(reader.GetValue(donor_IdColumnIndex));
                    record.GL_Act_Id    = Convert.ToInt32(reader.GetValue(gL_Act_IdColumnIndex));
                    record.Currency_Id  = Convert.ToInt32(reader.GetValue(currency_IdColumnIndex));
                    record.Company_Id   = Convert.ToInt32(reader.GetValue(company_IdColumnIndex));
                    record.Created_By   = Convert.ToInt32(reader.GetValue(created_ByColumnIndex));
                    record.Created_Time = Convert.ToDateTime(reader.GetValue(created_TimeColumnIndex));
                    record.Updated_By   = Convert.ToInt32(reader.GetValue(updated_ByColumnIndex));
                    record.Updated_Time = Convert.ToDateTime(reader.GetValue(updated_TimeColumnIndex));

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

            totalRecordCount = 0 == totalRecordCount ? ri + startIndex : -1;
            return((tblPaymentRow[])(recordList.ToArray(typeof(tblPaymentRow))));
        }
示例#5
0
 /// <summary>
 /// Deletes the specified object from the <c>tblPayment</c> table.
 /// </summary>
 /// <param name="value">The <see cref="tblPaymentRow"/> object to delete.</param>
 /// <returns>true if the record was deleted; otherwise, false.</returns>
 public bool Delete(tblPaymentRow value)
 {
     return(DeleteByPrimaryKey(value.Payment_Id));
 }