internal static ObservableCollection <JournalVoucher> WhereMemberCodeIs(string memberCode) { var sqlBuilder = new StringBuilder(); sqlBuilder.AppendFormat("SELECT * FROM `{0}` WHERE MEM_CODE = ?MEM_CODE", TABLE_NAME); DataTable dataTable = DatabaseController.ExecuteSelectQuery(sqlBuilder.ToString(), new SqlParameter("?MEM_CODE", memberCode)); var listRecord = new ObservableCollection <JournalVoucher>(); foreach (DataRow dataRow in dataTable.Rows) { var foundRecord = new JournalVoucher(); foundRecord.SetPropertiesFromDataRow(dataRow); listRecord.Add(foundRecord); } return(listRecord); }
public static ObservableCollection <JournalVoucher> WhereDocumentNumberIs(int documentNo) { var sqlBuilder = new StringBuilder(); sqlBuilder.AppendFormat("SELECT * FROM `{0}` WHERE DOC_NUM = ?DOC_NUM", TABLE_NAME); DataTable dataTable = DatabaseController.ExecuteSelectQuery(sqlBuilder.ToString(), new SqlParameter("?DOC_NUM", documentNo)); var listRecord = new ObservableCollection <JournalVoucher>(); foreach (DataRow dataRow in dataTable.Rows) { var foundRecord = new JournalVoucher(); foundRecord.SetPropertiesFromDataRow(dataRow); listRecord.Add(foundRecord); } return(listRecord); }