Esempio n. 1
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);
        }
Esempio n. 2
0
        public List <Int32> GetAccountingRecordLineEntryNos()
        {
            //AuxVariables
            List <object> objects;
            List <Int32>  result;

            //Run Method
            result  = new List <int>();
            objects = Read(Controllers.ClassType.accounting_record_line);
            foreach (object obj in objects)
            {
                Models.AccountingRecordLine temp = (Models.AccountingRecordLine)obj;
                if (temp.GetAccountingRecordID() == primary_key)
                {
                    result.Add(temp.GetEntryNo());
                }
            }
            return(result);
        }
Esempio n. 3
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());
            }
        }