Ejemplo n.º 1
0
        protected void cboBalanceInitAccount_ItemsRequestedByFilterCondition(object source, DevExpress.Web.ASPxEditors.ListEditItemsRequestedByFilterConditionEventArgs e)
        {
            ASPxComboBox           comboItemUnit = source as ASPxComboBox;
            XPCollection <Account> collection    = new XPCollection <Account>(session);

            collection.SkipReturnedObjects = e.BeginIndex;
            collection.TopReturnedObjects  = e.EndIndex - e.BeginIndex + 1;

            XPCollection <Account> _childAccount = AccountingBO.getNotParentAccountCollection(session);
            CriteriaOperator       _filter       = CriteriaOperator.Or(
                new BinaryOperator("AccountTypeId.AccountCategoryId.AccountCategoryId", Guid.Parse("A5FD76BB-F0D8-40F5-ADF8-6648804BDC62"), BinaryOperatorType.Equal),
                new BinaryOperator("AccountTypeId.AccountCategoryId.AccountCategoryId", Guid.Parse("387208A7-8D9E-49DA-8131-A83BA97B9D6B"), BinaryOperatorType.Equal),
                new BinaryOperator("AccountTypeId.AccountCategoryId.AccountCategoryId", Guid.Parse("FF561A7E-00D8-4596-B46A-29064BCB09D2"), BinaryOperatorType.Equal),
                new BinaryOperator("AccountTypeId.AccountCategoryId.AccountCategoryId", Guid.Parse("C1EC8F33-C4F6-4312-AE4A-6F8FD3A1F5DB"), BinaryOperatorType.Equal));

            _childAccount.Filter = _filter;

            CriteriaOperator criteria = CriteriaOperator.And(
                CriteriaOperator.Or(
                    new BinaryOperator("Code", String.Format("%{0}%", e.Filter), BinaryOperatorType.Like),
                    new BinaryOperator("Name", String.Format("%{0}%", e.Filter), BinaryOperatorType.Like)
                    ),
                new BinaryOperator("RowStatus", 1, BinaryOperatorType.GreaterOrEqual),
                new InOperator("this", _childAccount)
                );

            collection.Criteria = criteria;
            collection.Sorting.Add(new SortProperty("Code", DevExpress.Xpo.DB.SortingDirection.Ascending));

            comboItemUnit.DataSource = collection;
            comboItemUnit.DataBindItems();
        }
Ejemplo n.º 2
0
 protected void grd_Journal_CellEditorInitialize(object sender, ASPxGridViewEditorEventArgs e)
 {
     if (e.Column.FieldName.Equals("AccountId!Key"))
     {
         try
         {
             ASPxComboBox accountCombobox = e.Editor as ASPxComboBox;
             accountCombobox.TextField  = "Code";
             accountCombobox.DataSource = AccountingBO.getNotParentAccountCollection(session);
             accountCombobox.DataBind();
         }
         catch (Exception)
         {
         }
     }
 }