Esempio n. 1
0
 public void Parse( string s )
 {
     string[] parts = s.Split( ':' );
     this.AccountType = (AccountType)Enum.Parse( typeof( AccountType ), parts[0] );
     if( parts.Length > 1 )
     {
         if( parts[1] == "*" )
             this.SubAccountType = SubAccountType.Unset;
         else
             this.SubAccountType = (SubAccountType)Enum.Parse( typeof( SubAccountType ), parts[1] );
     }
     else
         this.SubAccountType = SubAccountType.Unset;
 }
Esempio n. 2
0
        protected override OpResult _Store(SubAccountType _obj)
        {
            if (_obj == null)
            {
                return(OpResult.NotifyStoreAction(OpResult.ResultStatus.ObjectIsNull, _obj, "SubAccountType object cannot be created as it is null"));
            }

            if (Exists(_obj))
            {
                ExecuteNonQuery(GetQuery_UpdateQuery(_obj));
                return(OpResult.NotifyStoreAction(OpResult.ResultStatus.Updated, _obj));
            }

            ExecuteNonQuery(GetQuery_InsertQuery(_obj));
            _obj.FromDb = true;

            return(OpResult.NotifyStoreAction(OpResult.ResultStatus.Created, _obj));
        }
Esempio n. 3
0
 private DbUpdateStatement GetQuery_UpdateQuery(SubAccountType _obj)
 {
     return(DbMgr.CreateUpdateClause("SubAccountTypes", GetFields(_obj), "SubAccountTypeID", _obj.SubAccountTypeID));
 }
Esempio n. 4
0
        private DbInsertStatement GetQuery_InsertQuery(SubAccountType _obj)
        {
            Dictionary <string, DbFieldEntry> fields = GetFields(_obj);

            return(DbMgr.CreateInsertClause("SubAccountTypes", fields));
        }
Esempio n. 5
0
        public JsonResult SearchAccount(string field, string search, SubAccountType subType, AccountType accountType, bool?isHeader, bool?isActive, int?pageCount = null)
        {
            if (string.IsNullOrEmpty(search) && !isHeader.HasValue && !isActive.HasValue &&
                subType == SubAccountType.Unknown && accountType == AccountType.Unknown)
            {
                return(Json(GetPageItem(null, LogicalOperator.and, DefaultSorting(), pageCount)));
            }

            var searchCriteria = new List <SearchCriteria>();

            if (!string.IsNullOrEmpty(search))
            {
                searchCriteria.Add(new SearchCriteria
                {
                    Field      = field,
                    SearchText = search,
                    FieldType  = field.Contains("Balance")? typeof(decimal): typeof(string)
                });
            }

            if (subType != SubAccountType.Unknown)
            {
                searchCriteria.Add(new SearchCriteria
                {
                    Field      = "Type",
                    SearchText = subType.GetHashCode().ToString(),
                    FieldType  = typeof(string)
                });
            }

            if (accountType != AccountType.Unknown)
            {
                searchCriteria.Add(new SearchCriteria
                {
                    Field      = "Classification",
                    SearchText = accountType.GetHashCode().ToString(),
                    FieldType  = typeof(string)
                });
            }
            if (isHeader.HasValue)
            {
                searchCriteria.Add(new SearchCriteria
                {
                    Field      = "IsHeader",
                    SearchText = isHeader.Value.ToString().ToLower(),
                    FieldType  = typeof(bool)
                });
            }

            if (isActive.HasValue)
            {
                searchCriteria.Add(new SearchCriteria
                {
                    Field      = "IsActive",
                    SearchText = (!isActive.Value).ToString().ToLower(),
                    FieldType  = typeof(bool)
                });
            }

            return(Json(GetPageItem(searchCriteria, LogicalOperator.and, DefaultSorting(), pageCount)));
        }