private void Child_Fetch(SafeDataReader dr) { LoadProperty(_Id, dr.GetInt32("disbursement")); LoadProperty(_Type, VoucherTypeInfo.Get(dr, _Type.Name)); LoadProperty(_DocumentNo, dr.GetString("documentno")); LoadProperty(_DocumentDate, dr.GetSmartDate("documentdate")); LoadProperty(_Recipient, dr.GetString("recipient")); LoadProperty(_ControlNumber, dr.GetInt32("controlnumber")); LoadProperty(_Status, dr.GetInt32("status")); }
private void DataPortal_Fetch(int id) { using (var ctx = ConnectionManager <SqlConnection> .GetManager(ConfigHelper.GetDatabase(), false)) { using (var cmd = ctx.Connection.CreateCommand()) { cmd.CommandText = string.Format(@" SELECT d.disbursement,d.type,d.documentno,d.documentdate, d.recipient,d.controlnumber, d.plateno, d.preparedby, d.approvedby,d.receivedby,d.createdby,d.datecreated,d.updatedby,d.dateupdated, d.status,v.contact AS {0}contact,v.code AS {0}code,v.name AS {0}name, vt.vouchertype AS {1}vouchertype,vt.type AS {1}type,vt.name AS {1}name FROM disbursement d LEFT JOIN contact v ON d.vessel = v.contact LEFT JOIN vouchertype vt ON d.type = vt.vouchertype WHERE disbursement = @id", _Vessel.Name, _Type.Name); cmd.Parameters.AddWithValue("@id", id); using (var dr = new SafeDataReader(cmd.ExecuteReader())) { if (dr.Read()) { LoadProperty(_Id, dr.GetInt32("disbursement")); LoadProperty(_Type, dr.GetInt32("type")); LoadProperty(_DocumentNo, dr.GetString("documentno")); LoadProperty(_DocumentDate, dr.GetSmartDate("documentdate")); LoadProperty(_Recipient, dr.GetString("recipient")); LoadProperty(_ControlNumber, dr.GetInt32("controlnumber")); LoadProperty(_PlateNo, dr.GetString("plateno")); LoadProperty(_PreparedBy, dr.GetString("preparedby")); LoadProperty(_ApprovedBy, dr.GetString("approvedby")); LoadProperty(_ReceivedBy, dr.GetString("receivedby")); LoadProperty(_Status, dr.GetInt32("status")); LoadProperty(_CreatedBy, dr.GetInt32("createdby")); LoadProperty(_DateCreated, dr.GetSmartDate("datecreated")); LoadProperty(_UpdatedBy, dr.GetInt32("updatedby")); LoadProperty(_DateUpdated, dr.GetSmartDate("dateupdated")); LoadProperty(_Vessel, BaseContactInfo.Get(dr, _Vessel.Name)); LoadProperty(_Type, VoucherTypeInfo.Get(dr, _Type.Name)); } } } } LoadProperty(_DisbursementItems, DisbursementItems.Get(new SingleCriteria <int>(this.Id))); }