예제 #1
0
        private object ReaderToObject(ClassType class_type)
        {
            switch (class_type)
            {
            case ClassType.account:
                Models.Account temp = new Models.Account(true);
                temp.SetID(Convert.ToInt32(reader["ID"]));
                temp.SetUpperAccountID(Convert.ToInt32(reader["UpperAccountID"]));
                temp.SetName(reader["TheName"].ToString());
                temp.SetName2(reader["TheName2"].ToString());
                temp.SetAccessible(Convert.ToBoolean(reader["Accessible"]));
                temp.SetAsset(Convert.ToBoolean(reader["Asset"]));
                temp.SetConsisted(Convert.ToBoolean(reader["Consisted"]));
                return(temp);

            case ClassType.accounting_record:
                Models.AccountingRecord temp2 = new Models.AccountingRecord(true);
                temp2.SetID(Convert.ToInt32(reader["ID"]));
                temp2.SetName(reader["TheDescription"].ToString());
                temp2.SetName2(reader["TheDescription2"].ToString());
                temp2.SetDate(Convert.ToDateTime(reader["TheDate"]));
                temp2.SetPosted(Convert.ToBoolean(reader["Posted"]));
                return(temp2);

            case ClassType.accounting_record_line:
                Models.AccountingRecordLine temp3 = new Models.AccountingRecordLine(true, 0);
                temp3.SetEntryNo(Convert.ToInt32(reader["ID"]));
                temp3.SetDescription(reader["TheDescription"].ToString());
                temp3.SetDescription2(reader["TheDescription2"].ToString());
                temp3.SetAccountingRecordID(Convert.ToInt32(reader["AccountingRecordID"]));
                temp3.SetAccountID(Convert.ToInt32(reader["AccountID"]));
                temp3.SetAmount(Convert.ToInt32(reader["Amount"]));
                return(temp3);

            default:
                return(new object());
            }
        }