Beispiel #1
0
        public double GetSaldo()
        {
            //AuxVariables
            double        result;
            List <object> objects;
            List <Int32>  accounting_record_line_entry_nos;

            //Run Method
            result = 0;
            accounting_record_line_entry_nos = new List <int>();
            objects = Read(Controllers.ClassType.accounting_record);
            foreach (object obj in objects)
            {
                Models.AccountingRecord temp = (Models.AccountingRecord)obj;
                if (temp.AccountIDExistsInLine(primary_key))
                {
                    foreach (Int32 line_entry_no in temp.GetAccountingRecordLineEntryNos())
                    {
                        accounting_record_line_entry_nos.Add(line_entry_no);
                    }
                }
            }
            if (accounting_record_line_entry_nos.Count() > 0)
            {
                foreach (Int32 accounting_record_line_entry_no in accounting_record_line_entry_nos)
                {
                    Models.AccountingRecordLine line = new AccountingRecordLine(accounting_record_line_entry_no);
                    result += line.GetAmount();
                }
            }
            return(result);
        }
Beispiel #2
0
        protected bool CandidateIsUnice(string candidate, object obj)
        {
            //AuxVariables
            bool          result;
            List <object> objects;

            //Run Method
            result = true;
            if (candidate != "")
            {
                switch (storage_controller.GetClassTypeOfObject(obj))
                {
                case Controllers.ClassType.account:
                    objects = Read(Controllers.ClassType.account);
                    foreach (object obj2 in objects)
                    {
                        Models.Account temp = (Models.Account)obj2;
                        if (temp.GetName() == candidate)
                        {
                            result = false;
                        }
                    }
                    break;

                case Controllers.ClassType.accounting_record:
                    objects = Read(Controllers.ClassType.accounting_record);
                    foreach (object obj2 in objects)
                    {
                        Models.AccountingRecord temp = (Models.AccountingRecord)obj2;
                        if (temp.GetName() == candidate)
                        {
                            result = false;
                        }
                    }
                    break;

                case Controllers.ClassType.accounting_record_line:
                    objects = Read(Controllers.ClassType.accounting_record_line);
                    foreach (object obj2 in objects)
                    {
                        Models.AccountingRecordLine temp = (Models.AccountingRecordLine)obj2;
                        if (temp.GetDescription() == candidate)
                        {
                            result = false;
                        }
                    }
                    break;

                default:
                    break;
                }
            }
            return(result);
        }
Beispiel #3
0
        public List <Int32> GetAccountingRecordIDs()
        {
            //AuxVariables
            List <object> objects;
            List <Int32>  result;

            //Run Method
            result  = new List <int>();
            objects = Read(Controllers.ClassType.accounting_record);
            foreach (object obj in objects)
            {
                Models.AccountingRecord temp = (Models.AccountingRecord)obj;
                if (temp.AccountIDExistsInLine(primary_key))
                {
                    result.Add(temp.GetID());
                }
            }
            return(result);
        }
Beispiel #4
0
        private bool GetPostetStateOfHdr()
        {
            //AuxVariables
            List <object> objects;
            bool          result;

            //Run Method
            objects = Read(Controllers.ClassType.accounting_record);
            result  = true;
            foreach (object obj in objects)
            {
                Models.AccountingRecord temp = (Models.AccountingRecord)obj;
                if (temp.GetID() == accounting_record_id)
                {
                    result = temp.GetPosted();
                }
            }
            return(result);
        }
Beispiel #5
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());
            }
        }