public IList <ACAccount_DetailedEntity> GetPagedData(Int32 startRowIndex, Int32 pageSize, String sortExpression, String filterExpression)
        {
            IList <ACAccount_DetailedEntity> aCAccount_DetailedEntityList = new List <ACAccount_DetailedEntity>();

            try
            {
                if (String.IsNullOrEmpty(sortExpression))
                {
                    sortExpression = "AccountID";
                }

                Int32 currentPage = Convert.ToInt32(startRowIndex / pageSize) + 1;
                //startRowIndex = Convert.ToInt32(  startRowIndex / pageSize) + 1;

                if (pageSize == -1)
                {
                    pageSize = 1000000000;
                }

                aCAccount_DetailedEntityList = FCCACAccount_Detailed.GetFacadeCreate().GetIL(pageSize, currentPage, sortExpression, filterExpression);

                if (aCAccount_DetailedEntityList != null && aCAccount_DetailedEntityList.Count > 0)
                {
                    totalRowCount = aCAccount_DetailedEntityList[0].TotalRowCount;
                }
            }
            catch (Exception ex)
            {
            }

            return(aCAccount_DetailedEntityList ?? new List <ACAccount_DetailedEntity>());
        }
Esempio n. 2
0
    public string[] GetCompletionItemList(string prefixText, int count, string contextKey)
    {
        #region GET ITEM

        //Int64 storeUnitID;
        //Int64.TryParse(contextKey.ToString(), out storeUnitID);

        List <string> items = new List <string>(count);

        #region Accounts

        String fePrefix       = SqlExpressionBuilder.PrepareFilterExpression("(SELECT dbo.RemoveAllSpecialCharacter(ACAccount.AccountName))", prefixText, SQLMatchType.LikeWithSuffixMath);
        String fe_accountCode = SqlExpressionBuilder.PrepareFilterExpression("ACAccount." + ACAccountEntity.FLD_NAME_AccountCode, prefixText, SQLMatchType.LikeWithSuffixMath);
        fePrefix = SqlExpressionBuilder.PrepareFilterExpression(fePrefix, SQLJoinType.OR, fe_accountCode);

        IList <ACAccount_DetailedEntity> accountsListBySuffix = FCCACAccount_Detailed.GetFacadeCreate().GetIL(10000000, 1, String.Empty, fePrefix);

        String feBothfix = SqlExpressionBuilder.PrepareFilterExpression("(SELECT dbo.RemoveAllSpecialCharacter(ACAccount.AccountName))", prefixText, SQLMatchType.LikeWithBothMath);

        IList <ACAccount_DetailedEntity> accountsListByBoth = FCCACAccount_Detailed.GetFacadeCreate().GetIL(10000000, 1, String.Empty, feBothfix);

        if (accountsListBySuffix == null || accountsListBySuffix.Count <= 0)
        {
            accountsListBySuffix = new List <ACAccount_DetailedEntity>();
        }

        if (accountsListByBoth == null || accountsListByBoth.Count <= 0)
        {
            accountsListByBoth = new List <ACAccount_DetailedEntity>();
        }

        IList <ACAccount_DetailedEntity> tempBOQItemList = accountsListByBoth.Except(accountsListBySuffix, new ACAccountComparer()).ToList();
        IList <ACAccount_DetailedEntity> itemList        = new List <ACAccount_DetailedEntity>();

        itemList = accountsListBySuffix;

        if (tempBOQItemList != null && tempBOQItemList.Count > 0)
        {
            foreach (ACAccount_DetailedEntity ent in tempBOQItemList)
            {
                itemList.Add(ent);
            }
        }

        if (itemList != null && itemList.Count > 0)
        {
            foreach (ACAccount_DetailedEntity entItem in itemList)
            {
                if (prefixText.Equals(entItem.AccountCode + " - " + entItem.AccountName))
                {
                    return(new string[0]);
                }

                items.Add(AutoCompleteExtender.CreateAutoCompleteItem(entItem.AccountCode + " - " + entItem.AccountName, entItem.AccountID.ToString()));
            }
        }
        else
        {
            items.Add(AutoCompleteExtender.CreateAutoCompleteItem("No Accounts Available", "0"));
        }

        #endregion

        #endregion

        return(items.ToArray());
    }