Esempio n. 1
0
        protected void cboAccountPeriod_ItemsRequestedByFilterCondition(object source, ListEditItemsRequestedByFilterConditionEventArgs e)
        {
            ASPxComboBox combo = source as ASPxComboBox;
            XPCollection <AccountingPeriod> collection = new XPCollection <AccountingPeriod>(session);

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

            AccountingPeriodTypeBO typeBO = new AccountingPeriodTypeBO();
            AccountingPeriodType   minAccountingPeriodType = typeBO.GetMinAccountingPeriodType(session);

            CriteriaOperator criteria_RowStatus = new BinaryOperator("RowStatus", Constant.ROWSTATUS_ACTIVE, BinaryOperatorType.GreaterOrEqual);
            CriteriaOperator criteria_IsActive  = new BinaryOperator("IsActive", true, BinaryOperatorType.Equal);
            CriteriaOperator criteria_Type      = new BinaryOperator("AccountingPeriodTypeId", minAccountingPeriodType, BinaryOperatorType.Equal);
            CriteriaOperator criteria           = CriteriaOperator.And(criteria_IsActive, criteria_RowStatus, criteria_Type);
            XPCollection <AccountingPeriod> AccountingPeriodCol = new XPCollection <AccountingPeriod>(session, criteria);

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

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

            combo.DataSource = collection;
            combo.DataBindItems();
        }
Esempio n. 2
0
        public void ItemsRequestedByFilterCondition(Session session, object source, DevExpress.Web.ASPxEditors.ListEditItemsRequestedByFilterConditionEventArgs e)
        {
            ASPxComboBox combo = source as ASPxComboBox;
            XPCollection <Department> collection = new XPCollection <Department>(session);

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

            CriteriaOperator criteria = CriteriaOperator.And(
                //row status is active
                new BinaryOperator("OrganizationId.OrganizationId", Utility.CurrentSession.Instance.AccessingOrganizationId),
                new BinaryOperator("RowStatus", Utility.Constant.ROWSTATUS_ACTIVE),
                CriteriaOperator.Or(
                    //find code contains the filter
                    new BinaryOperator("Code", String.Format("%{0}%", e.Filter), BinaryOperatorType.Like),
                    //find name contains the filter
                    new BinaryOperator("Name", String.Format("%{0}%", e.Filter), BinaryOperatorType.Like)
                    )
                );

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

            combo.DataSource = collection;
            combo.DataBindItems();
        }
Esempio n. 3
0
        public XPCollection <Transaction> GetTransactions(Session session, Guid billId)
        {
            try
            {
                XPCollection <Transaction> ret = null;
                //Get bill
                SalesInvoice bill = session.GetObjectByKey <SalesInvoice>(billId);

                CriteriaOperator criteria = CriteriaOperator.And(
                    new BinaryOperator("RowStatus", Utility.Constant.ROWSTATUS_ACTIVE, BinaryOperatorType.GreaterOrEqual),
                    CriteriaOperator.Or(
                        new ContainsOperator("GeneralJournals",
                                             new BinaryOperator("JournalType", JounalTypeConstant.ACTUAL)
                                             ),
                        new BinaryOperator(new AggregateOperand("GeneralJournals", Aggregate.Count), 0, BinaryOperatorType.Equal)
                        )
                    );

                ret = new XPCollection <Transaction>(session, bill.SaleInvoiceTransactions, criteria);

                return(ret);
            }
            catch (Exception)
            {
                throw;
            }
        }
Esempio n. 4
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();
        }
        protected void comboPerson_ItemsRequestedByFilterCondition(object source, ListEditItemsRequestedByFilterConditionEventArgs e)
        {
            ASPxComboBox          combo      = source as ASPxComboBox;
            XPCollection <Person> collection = new XPCollection <Person>(session);

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

            CriteriaOperator criteria = CriteriaOperator.And(
                //row status is active
                new BinaryOperator("RowStatus", Utility.Constant.ROWSTATUS_ACTIVE),
                CriteriaOperator.Or(
                    //find code contains the filter
                    new BinaryOperator("Code", String.Format("%{0}%", e.Filter), BinaryOperatorType.Like),
                    //find name contains the filter
                    new BinaryOperator("Name", String.Format("%{0}%", e.Filter), BinaryOperatorType.Like)
                    )
                );

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

            combo.DataSource = collection;
            combo.DataBindItems();
        }
Esempio n. 6
0
        /// <summary>
        /// Evento disparado quando um Group do Barra de Navegação é reduzido
        /// </summary>
        /// <param name="sender">NavBarGroup</param>
        /// <param name="e">NavBarGroupEventArgs</param>
        private void navBarControlProjetos_GroupCollapsed(object sender, NavBarGroupEventArgs e)
        {
            List <CriteriaOperator> criterias = new List <CriteriaOperator>();

            foreach (NavBarGroup navGroupItens in e.Group.Collection)
            {
                if (navGroupItens.Expanded)
                {
                    foreach (NavBarItemLink itemColaborador in navGroupItens.ItemLinks)
                    {
                        criterias.Add(CriteriaOperator.Parse("Periodo.Colaborador.Oid = ?", itemColaborador.Item.Tag));
                    }
                }
            }
            if (criterias.Count > 0)
            {
                Ferias.Filter = CriteriaOperator.Or(criterias);
            }
            else
            {
                //colocando 1=2 não traz nada
                Ferias.Filter = CriteriaOperator.Parse("1=2");
            }
            schedulerStorage1.RefreshData();
            schedulerControl1.RefreshData();
        }
Esempio n. 7
0
 protected void gridviewObjectType_CommandButtonInitialize(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCommandButtonEventArgs e)
 {
     if (e.ButtonType == ColumnCommandButtonType.SelectCheckbox)
     {
         //Determine type of object type custom field
         //Get current object type
         var objectId = gridviewObjectType.GetRowValues(e.VisibleIndex, "ObjectTypeId");
         if (objectId != null)
         {
             NAS.DAL.CMS.ObjectDocument.CustomField customField = GetCurrentCustomField(session);
             if (customField == null)
             {
                 return;
             }
             ObjectType objectType = session.GetObjectByKey <ObjectType>((Guid)objectId);
             //Get ObjectTypeCustomField
             CriteriaOperator criteria = CriteriaOperator.And(
                 new BinaryOperator("ObjectTypeId", objectType),
                 new BinaryOperator("CustomFieldId", customField),
                 CriteriaOperator.Or(
                     new BinaryOperator("CustomFieldType", CustomFieldTypeConstant.CUSTOM_FIELD_TYPE_MASTER),
                     new BinaryOperator("CustomFieldType", CustomFieldTypeConstant.CUSTOM_FIELD_TYPE_MASTER_READONLY),
                     new BinaryOperator("CustomFieldType", CustomFieldTypeConstant.CUSTOM_FIELD_TYPE_READONLY)
                     )
                 );
             ObjectTypeCustomField objectTypeCustomField =
                 session.FindObject <ObjectTypeCustomField>(criteria);
             if (objectTypeCustomField != null)
             {
                 e.Enabled = false;
             }
         }
     }
 }
Esempio n. 8
0
        private void SetCriteriaForOrganization()
        {
            //Get CUSTOMER trading type
            TradingCategory customerTradingCategory =
                NAS.DAL.Util.getXPCollection <TradingCategory>(session, "Code", "CUSTOMER").FirstOrDefault();
            //Get SUPPLIER trading type
            TradingCategory supplierTradingCategory =
                NAS.DAL.Util.getXPCollection <TradingCategory>(session, "Code", "SUPPLIER").FirstOrDefault();

            CriteriaOperator criteria = CriteriaOperator.And(
                CriteriaOperator.Or(
                    new ContainsOperator("OrganizationCategories",
                                         CriteriaOperator.And(
                                             new BinaryOperator("TradingCategoryId.TradingCategoryId", customerTradingCategory.TradingCategoryId),
                                             new BinaryOperator("RowStatus", Utility.Constant.ROWSTATUS_ACTIVE)
                                             )
                                         ),
                    new ContainsOperator("OrganizationCategories",
                                         CriteriaOperator.And(
                                             new BinaryOperator("TradingCategoryId.TradingCategoryId", supplierTradingCategory.TradingCategoryId),
                                             new BinaryOperator("RowStatus", Utility.Constant.ROWSTATUS_ACTIVE)
                                             )
                                         )
                    ),
                new BinaryOperator("RowStatus", Utility.Constant.ROWSTATUS_ACTIVE)
                );

            dsSourceOrg.Criteria = criteria.ToString();
            cbSourceOrganization.DataBindItems();
        }
        public override void ComboBoxItem_ItemsRequestedByFilterCondition(DevExpress.Xpo.Session session, object source, DevExpress.Web.ASPxEditors.ListEditItemsRequestedByFilterConditionEventArgs e)
        {
            ASPxComboBox        combo      = source as ASPxComboBox;
            XPCollection <Item> collection = new XPCollection <Item>(session);

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

            CriteriaOperator criteria = CriteriaOperator.And(
                //row status is active
                new BinaryOperator("RowStatus", Utility.Constant.ROWSTATUS_ACTIVE),
                CriteriaOperator.Or(
                    //find code contains the filter
                    new BinaryOperator("Code", String.Format("%{0}%", e.Filter), BinaryOperatorType.Like),
                    //find name contains the filter
                    new BinaryOperator("Name", String.Format("%{0}%", e.Filter), BinaryOperatorType.Like)
                    ),
                new ContainsOperator("ItemCustomTypes",
                                     new BinaryOperator("ObjectTypeId", ObjectType.GetDefault(session, ObjectTypeEnum.FIXED_ASSETS)))
                );

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

            combo.DataSource = collection;
            combo.DataBindItems();
        }
Esempio n. 10
0
        protected void cboItem_ItemsRequestedByFilterCondition(object source, DevExpress.Web.ASPxEditors.ListEditItemsRequestedByFilterConditionEventArgs e)
        {
            try
            {
                ASPxComboBox            comboItemUnit = source as ASPxComboBox;
                XPCollection <BillItem> collection    = new XPCollection <BillItem>(session);

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

                CriteriaOperator criteria = CriteriaOperator.And(
                    CriteriaOperator.Or(
                        new BinaryOperator("ItemUnitId.ItemId.Code", String.Format("%{0}%", e.Filter), BinaryOperatorType.Like),
                        new BinaryOperator("ItemUnitId.ItemId.Name", String.Format("%{0}%", e.Filter), BinaryOperatorType.Like)
                        ),
                    new BinaryOperator("BillId.BillId", bill.BillId, BinaryOperatorType.Equal));


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

                comboItemUnit.DataSource = collection;
                comboItemUnit.DataBindItems();
            }
            catch
            {
            }
        }
        public override void ItemsRequestedByFilterCondition(DevExpress.Xpo.Session session, object source, DevExpress.Web.ASPxEditors.ListEditItemsRequestedByFilterConditionEventArgs e)
        {
            ASPxComboBox combo = source as ASPxComboBox;
            XPCollection <InventoryCommand> collection = new XPCollection <InventoryCommand>(session);

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

            //Get SUPPLIER trading type
            //TradingCategory supplierTradingCategory =
            //    session.FindObject<TradingCategory>(new BinaryOperator("Code", "SUPPLIER"));

            CriteriaOperator criteria = CriteriaOperator.And(
                //row status is active
                //CriteriaOperator.Or(
                new BinaryOperator("RowStatus", Utility.Constant.ROWSTATUS_ACTIVE),
                //    new BinaryOperator("RowStatus", Utility.Constant.ROWSTATUS_BOOKED_ENTRY)
                //),
                CriteriaOperator.Or(
                    //find code contains the filter
                    new BinaryOperator("Code", String.Format("%{0}%", e.Filter), BinaryOperatorType.Like),
                    //find name contains the filter
                    new BinaryOperator("Name", String.Format("%{0}%", e.Filter), BinaryOperatorType.Like)
                    ),
                new BinaryOperator("CommandType", 'I', BinaryOperatorType.Equal)
                );

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

            combo.DataSource = collection;
            combo.DataBindItems();
        }
Esempio n. 12
0
        void comboItem_ItemsRequestedByFilterCondition(object source, ListEditItemsRequestedByFilterConditionEventArgs e)
        {
            UnitOfWork          uow        = XpoHelper.GetNewUnitOfWork();
            ASPxComboBox        comboItem  = source as ASPxComboBox;
            XPCollection <Item> collection = new XPCollection <Item>(uow);

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

            CriteriaOperator criteria = null;

            criteria = CriteriaOperator.And(
                new ContainsOperator("ItemCustomTypes", new BinaryOperator("ObjectTypeId.Name",
                                                                           "PRODUCT")),
                new BinaryOperator("RowStatus", 0, BinaryOperatorType.Greater),
                CriteriaOperator.Or(
                    new BinaryOperator("Code", String.Format("%{0}%", e.Filter), BinaryOperatorType.Like),
                    new BinaryOperator("Name", String.Format("%{0}%", e.Filter), BinaryOperatorType.Like)));

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

            comboItem.DataSource = collection;
            comboItem.DataBindItems();
        }
Esempio n. 13
0
        protected void cboLegalInvoiceArtifactType_ItemsRequestedByFilterCondition(object source, ListEditItemsRequestedByFilterConditionEventArgs e)
        {
            try
            {
                ASPxComboBox comboItemUnit = source as ASPxComboBox;
                XPCollection <NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifactType> collection = new XPCollection <NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifactType>(session);

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


                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("Description", "F", BinaryOperatorType.NotEqual),
                    new BinaryOperator("RowStatus", 1, BinaryOperatorType.GreaterOrEqual),
                    new BinaryOperator("Category", m_VatType, BinaryOperatorType.Equal));


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

                comboItemUnit.DataSource = collection;
                comboItemUnit.DataBindItems();
            }
            catch
            {
            }
        }
Esempio n. 14
0
        private static XPCollection <Event> GetPatternsAndExceptions(XPCollection <ContingentUnit> contingentUnits)
        {
            var cursor = new XPCollection <Event>(_session,
                                                  new GroupOperator(
                                                      CriteriaOperator.Or(CriteriaHelper.PatternEvent, CriteriaHelper.ExceptionEventType),
                                                      new InOperator("ContingentUnit", contingentUnits)));

            return(cursor);
        }
Esempio n. 15
0
        private void UpdateStaff()
        {
            IList <hrmStaff> staffs = ObjectSpace.GetObjects <hrmStaff>(
                CriteriaOperator.Or(
                    new UnaryOperator(UnaryOperatorType.IsNull, "BuhCode"),
                    new BinaryOperator("BuhCode", "")
                    ));

            foreach (hrmStaff staff in staffs)
            {
                staff.IsClosed = true;
            }
            IList <crmContract> contracts = ObjectSpace.GetObjects <crmContract>(new BinaryOperator("UserRegistrator.IsClosed", true), true);

            foreach (crmContract contract in contracts)
            {
                String           last_name = contract.UserRegistrator.LastName.Split(' ')[0];
                IList <hrmStaff> staff     = ObjectSpace.GetObjects <hrmStaff>(CriteriaOperator.And(
                                                                                   new BinaryOperator("LastName", last_name),
                                                                                   new BinaryOperator("FirstName", contract.UserRegistrator.FirstName),
                                                                                   new BinaryOperator("Department.BuhCode", "560"),
                                                                                   CriteriaOperator.Or(
                                                                                       new BinaryOperator("IsClosed", false),
                                                                                       new UnaryOperator(UnaryOperatorType.IsNull, "IsClosed")
                                                                                       )), true);
                if (staff.Count == 1)
                {
                    contract.UserRegistrator = staff[0];
                }
                else
                {
                    continue;
                }
            }
            IList <crmContractDeal> deals = ObjectSpace.GetObjects <crmContractDeal>(new BinaryOperator("UserRegistrator.IsClosed", true), true);

            foreach (crmContractDeal deal in deals)
            {
                String           last_name = deal.UserRegistrator.LastName.Split(' ')[0];
                IList <hrmStaff> staff     = ObjectSpace.GetObjects <hrmStaff>(CriteriaOperator.And(
                                                                                   new BinaryOperator("LastName", last_name),
                                                                                   new BinaryOperator("FirstName", deal.UserRegistrator.FirstName),
                                                                                   new BinaryOperator("Department.BuhCode", "560"),
                                                                                   CriteriaOperator.Or(
                                                                                       new BinaryOperator("IsClosed", false),
                                                                                       new UnaryOperator(UnaryOperatorType.IsNull, "IsClosed")
                                                                                       )), true);
                if (staff.Count == 1)
                {
                    deal.UserRegistrator = staff[0];
                }
                else
                {
                    continue;
                }
            }
        }
Esempio n. 16
0
        protected override void OnActivated()
        {
            base.OnActivated();
            int soNgayChuaCapNhat = 0;
            /*Tìm ngày cuối cùng lúc trước khi cập nhật*/
            CriteriaOperator criteria         = new BinaryOperator("Id", new JoinOperand("NgayTinhCong", null, Aggregate.Max, new OperandProperty("Id")));
            var ngayTinhCongs                 = (NgayTinhCong)ObjectSpace.FindObject <NgayTinhCong>(criteria);
            CriteriaOperator criteriaOperator = CriteriaOperator.Or(CriteriaOperator.Parse("[daNghiViec] Is Null"), CriteriaOperator.Parse("[daNghiViec] = ?", false));

            if (Equals(ngayTinhCongs, null))
            {
                NgayTinhCong ngayTinhCong = ObjectSpace.CreateObject <NgayTinhCong>();
                ngayTinhCong.ngayChamCong = new DateTime(DateTime.Today.Year, DateTime.Today.Month, 1);
                IList <NhanVien> nhanViens = ObjectSpace.GetObjects <NhanVien>(criteriaOperator);
                if (Equals(nhanViens, null))
                {
                    MessageBox.Show("Khong co nhan vien");
                }
                else
                {
                    foreach (NhanVien nhanVien in nhanViens)
                    {
                        GioCong gioCong = ObjectSpace.CreateObject <GioCong>();
                        gioCong.nguoiChamCong = nhanVien;
                        gioCong.ngay          = ngayTinhCong;
                    }
                }
            }
            else
            {
                DateTime ngayCuoiCung = ngayTinhCongs.ngayChamCong;

                soNgayChuaCapNhat = (int)(DateTime.Today - ngayCuoiCung).TotalDays;

                if (!Equals(soNgayChuaCapNhat, 0))
                {
                    for (int i = 1; i <= soNgayChuaCapNhat; i++)
                    {
                        NgayTinhCong ngayTinhCong = ObjectSpace.CreateObject <NgayTinhCong>();
                        ngayTinhCong.ngayChamCong = ngayCuoiCung.AddDays(i);
                        IList <NhanVien> nhanViens = ObjectSpace.GetObjects <NhanVien>(criteriaOperator);
                        foreach (NhanVien nhanVien in nhanViens)
                        {
                            GioCong gioCong = ObjectSpace.CreateObject <GioCong>();
                            gioCong.nguoiChamCong = nhanVien;
                            gioCong.ngay          = ngayTinhCong;
                        }
                    }
                }
            }
            ObjectSpace.CommitChanges();
            ObjectSpace.Refresh();
            View.Refresh();
        }
Esempio n. 17
0
 public CriteriaOperator ObtenerFiltroReportes()
 {
     CriteriaOperator FiltroDeUnidades = null;
     List<CriteriaOperator> Operadores = new List<CriteriaOperator>();
     foreach (Rol rol in this.Roles)
         foreach (Reporte reporte in rol.Reporte)
             Operadores.Add(new BinaryOperator("Oid", reporte.Oid));
     //if (Operadores.Count == 0)
     //    Operadores.Add(new BinaryOperator("Oid", Guid.Empty));
     FiltroDeUnidades = CriteriaOperator.Or(Operadores.ToArray());
     return FiltroDeUnidades;
 }
Esempio n. 18
0
        protected void cboProductManufacturer_OnItemsRequestedByFilterCondition_SQL(object source, ListEditItemsRequestedByFilterConditionEventArgs e)
        {
            ASPxComboBox comboBox = (ASPxComboBox)source;
            XPCollection <NAS.DAL.Nomenclature.Organization.ManufacturerOrg> collection = new XPCollection <NAS.DAL.Nomenclature.Organization.ManufacturerOrg>(session);

            collection.SkipReturnedObjects = e.BeginIndex;
            collection.TopReturnedObjects  = e.EndIndex - e.BeginIndex + 1;
            collection.Criteria            = CriteriaOperator.Or(
                new BinaryOperator("Code", String.Format("%{0}%", e.Filter), BinaryOperatorType.Like),
                new BinaryOperator("Name", String.Format("%{0}%", e.Filter), BinaryOperatorType.Like)
                );
            collection.Sorting.Add(new SortProperty("Code", DevExpress.Xpo.DB.SortingDirection.Ascending));
            comboBox.DataSource = collection;
            comboBox.DataBindItems();
        }
        public IEnumerable <EducatorMasterPerson> SearchByLastName(string lastNameQuery)
        {
            if (string.IsNullOrEmpty(lastNameQuery))
            {
                return(Enumerable.Empty <EducatorMasterPerson>());
            }

            var likeQuery = $"{lastNameQuery}%";
            var criteria  = CriteriaOperator.Or(
                new BinaryOperator("DisplayName", likeQuery, BinaryOperatorType.Like),
                new BinaryOperator("DisplayNameEnglish", likeQuery, BinaryOperatorType.Like));

            return(new XPCollection <EducatorMasterPerson>(session, criteria,
                                                           new SortProperty("DisplayName", DevExpress.Xpo.DB.SortingDirection.Ascending)
                                                           ));
        }
Esempio n. 20
0
        public override void UpdateDatabaseAfterUpdateSchema()
        {
            base.UpdateDatabaseAfterUpdateSchema();
            // Disable version
            if (this.CurrentDBVersion != new Version("0.0.0.0"))
            {
                return;
            }
            //
            try {
                fmCSAImporter1C.GetInstance(((ObjectSpace)ObjectSpace).Session);
            } catch {
            }
            try {
                fmCSAImporter1CGazPromBank.GetInstance(((ObjectSpace)ObjectSpace).Session);
            } catch {
            }

            // Заполнение кодов ценностей и курсов валют
            UpdaterVaultaCourse uvc = new UpdaterVaultaCourse(((ObjectSpace)this.ObjectSpace).Session);

            uvc.FixValutaCourseEtc();
            //
            //
            IList <fmCPRPaymentRequest> pays = ObjectSpace.GetObjects <fmCPRPaymentRequest>(new BinaryOperator("FBKManager.IsClosed", true), true);

            foreach (fmCPRPaymentRequest pay in pays)
            {
                String           last_name = pay.FBKManager.LastName.Split(' ')[0];
                IList <hrmStaff> staff     = ObjectSpace.GetObjects <hrmStaff>(CriteriaOperator.And(
                                                                                   new BinaryOperator("LastName", last_name),
                                                                                   new BinaryOperator("FirstName", pay.FBKManager.FirstName),
                                                                                   new BinaryOperator("Department.BuhCode", "560"),
                                                                                   CriteriaOperator.Or(
                                                                                       new BinaryOperator("IsClosed", false),
                                                                                       new UnaryOperator(UnaryOperatorType.IsNull, "IsClosed")
                                                                                       )), true);
                if (staff.Count == 1)
                {
                    pay.FBKManager = staff[0];
                }
                else
                {
                    continue;
                }
            }
        }
Esempio n. 21
0
        private CriteriaOperator FilterData()
        {
            CriteriaOperator        filter       = null;
            List <CriteriaOperator> filterLoaiDL = new List <CriteriaOperator>();


            foreach (LoaiDuLieuChamCong item in cbbTTChamCong.Properties.Items.GetCheckedValues())
            {
                filterLoaiDL.Add(new BinaryOperator("LoaiDuLieuChamCong", item));
            }
            if (lkupPhongBan.EditValue != null)
            {
                filter = new BinaryOperator("NhanVien.phongBan", lkupPhongBan.EditValue);
                return(CriteriaOperator.And(filter, CriteriaOperator.Or(filterLoaiDL.ToArray())));
            }
            return(CriteriaOperator.Or(filterLoaiDL.ToArray()));
        }
Esempio n. 22
0
        private IEnumerable <Classroom> GetByCriteria(
            Guid addressOid,
            IEnumerable <string> equipmentElements,
            SeatingType?seating = default(SeatingType?),
            int?capacity        = default(int?))
        {
            var criteria = new CriteriaOperatorCollection();

            if (addressOid != Guid.Empty)
            {
                criteria.Add(
                    new BinaryOperator("Address", addressOid, BinaryOperatorType.Equal)
                    );
            }

            if (equipmentElements?.Any() ?? false)
            {
                criteria.Add(CriteriaOperator.Or(
                                 equipmentElements.Select(e => new BinaryOperator(
                                                              "AdditionalInfo",
                                                              $"%{e}%",
                                                              BinaryOperatorType.Like
                                                              ))
                                 ));
            }

            if (capacity.HasValue)
            {
                criteria.Add(
                    new BinaryOperator(
                        "Capacity",
                        capacity.Value,
                        BinaryOperatorType.GreaterOrEqual
                        )
                    );
            }

            if (seating.HasValue)
            {
                criteria.Add(new BinaryOperator("SeatingType", seating.Value));
            }

            return(criteria.Any() ?
                   new XPCollection <Classroom>(session, CriteriaOperator.And(criteria)) :
                   new XPCollection <Classroom>(session));
        }
Esempio n. 23
0
        protected void cboBalanceInitCurrency_ItemsRequestedByFilterCondition(object source, DevExpress.Web.ASPxEditors.ListEditItemsRequestedByFilterConditionEventArgs e)
        {
            ASPxComboBox comboBox = (ASPxComboBox)source;
            XPCollection <NAS.DAL.Accounting.Currency.Currency> collection = new XPCollection <NAS.DAL.Accounting.Currency.Currency>(session);

            collection.SkipReturnedObjects = e.BeginIndex;
            collection.TopReturnedObjects  = e.EndIndex - e.BeginIndex + 1;
            collection.Criteria            = new GroupOperator(GroupOperatorType.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));

            collection.Sorting.Add(new SortProperty("Code", DevExpress.Xpo.DB.SortingDirection.Ascending));
            comboBox.DataSource = collection;
            comboBox.DataBindItems();
        }
Esempio n. 24
0
        protected void cboSourceOrganization_ItemsRequestedByFilterCondition(object source, DevExpress.Web.ASPxEditors.ListEditItemsRequestedByFilterConditionEventArgs e)
        {
            XPCollection <Organization> collection = new XPCollection <Organization>(session);

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

            //Get CUSTOMER trading type
            TradingCategory customerTradingCategory =
                session.FindObject <TradingCategory>(new BinaryOperator("Code", "CUSTOMER"));
            //Get SUPPLIER trading type
            TradingCategory supplierTradingCategory =
                session.FindObject <TradingCategory>(new BinaryOperator("Code", "SUPPLIER"));

            CriteriaOperator criteria = CriteriaOperator.And(
                //row status is active
                new BinaryOperator("RowStatus", Utility.Constant.ROWSTATUS_ACTIVE),
                CriteriaOperator.Or(
                    //find code contains the filter
                    new BinaryOperator("Code", String.Format("%{0}%", e.Filter), BinaryOperatorType.Like),
                    //find name contains the filter
                    new BinaryOperator("Name", String.Format("%{0}%", e.Filter), BinaryOperatorType.Like)
                    ),
                //find customer and supplier
                CriteriaOperator.Or(
                    new ContainsOperator("OrganizationCategories",
                                         CriteriaOperator.And(
                                             new BinaryOperator("TradingCategoryId.TradingCategoryId", customerTradingCategory.TradingCategoryId),
                                             new BinaryOperator("RowStatus", Utility.Constant.ROWSTATUS_ACTIVE)
                                             )
                                         ),
                    new ContainsOperator("OrganizationCategories",
                                         CriteriaOperator.And(
                                             new BinaryOperator("TradingCategoryId.TradingCategoryId", supplierTradingCategory.TradingCategoryId),
                                             new BinaryOperator("RowStatus", Utility.Constant.ROWSTATUS_ACTIVE)
                                             )
                                         )
                    )
                );

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

            cboSourceOrganization.DataSource = collection;
            cboSourceOrganization.DataBindItems();
        }
Esempio n. 25
0
        /// <summary>
        /// Método de filtro de superior imediato
        /// </summary>
        private void PopulateItemNoSuperior()
        {
            List <CriteriaOperator> criterias = new List <CriteriaOperator>();

            foreach (NavBarGroup navGroupItens in navBarControlProjetos.Groups)
            {
                if (navGroupItens.Expanded)
                {
                    foreach (NavBarItemLink itemColaborador in navGroupItens.ItemLinks)
                    {
                        criterias.Add(CriteriaOperator.Parse("Periodo.Colaborador.Oid = ?", itemColaborador.Item.Tag));
                    }
                }
            }
            Ferias.Filter = CriteriaOperator.Or(criterias);
            schedulerStorage1.RefreshData();
            schedulerControl1.RefreshData();
        }
Esempio n. 26
0
        public static void AfterChange_Name(IProperty p, IObjectSpace os)
        {
            if (string.IsNullOrEmpty(p.Caption))
            {
                p.Caption = p.Name;
            }

            if (p.PropertyType == null)
            {
                var find = os.FindObject <IBusinessObject>(
                    CriteriaOperator.Or(
                        new BinaryOperator("Name", p.Name),
                        new BinaryOperator("Caption", p.Caption),
                        new BinaryOperator("Name", p.Caption),
                        new BinaryOperator("Caption", p.Name)
                        )
                    );
                if (find != null)
                {
                    p.TypeCategory = PropertyTypeCategory.引用类型;
                    p.PropertyType = find;
                }
                else
                {
                    var objs = os.GetObjects <IProperty>(
                        CriteriaOperator.Or(
                            new FunctionOperator("Like", new OperandProperty("Name"), "%" + p.Name + "%"),
                            new FunctionOperator("Like", new OperandProperty("Caption"), "%" + p.Caption + "%")
                            )
                        );
                    var equ = objs.FirstOrDefault(x => x.Name == p.Name || x.Caption == p.Caption);
                    if (equ != null)
                    {
                        p.PropertyType = equ.PropertyType;
                    }
                    else
                    {
                        p.PropertyType = objs.FirstOrDefault()?.PropertyType;
                    }
                }
            }
        }
Esempio n. 27
0
        public XPCollection <ETLBusinessObject> GetOlderETLBusinessObject(Session session, Guid jobId, Int64 ObjectId)
        {
            XPCollection <ETLBusinessObject> etlBusinessObjectCollection = null;

            try
            {
                ETLJob job = session.GetObjectByKey <ETLJob>(jobId);
                if (job == null)
                {
                    return(null);
                }

                BusinessObject businessObject = session.GetObjectByKey <BusinessObject>(ObjectId);
                if (businessObject == null)
                {
                    return(null);
                }

                DateTime issueDate  = businessObject.ObjectIssueDate;
                DateTime createDate = businessObject.IssuedDateTimeStamp;

                CriteriaOperator criteria_Job = new BinaryOperator("ETLJobId", job, BinaryOperatorType.Equal);
                //DateTime
                CriteriaOperator criteria_IssueDate   = new BinaryOperator(new OperandProperty("BusinessObjectId.ObjectIssueDate"), issueDate, BinaryOperatorType.Less);
                CriteriaOperator criteria_IssueDate_1 = new BinaryOperator(new OperandProperty("BusinessObjectId.ObjectIssueDate"), issueDate, BinaryOperatorType.Equal);
                CriteriaOperator criteria_CreateDate  = new BinaryOperator("BusinessObjectId.IssuedDateTimeStamp", createDate, BinaryOperatorType.LessOrEqual);
                CriteriaOperator criteria_Datetime    = CriteriaOperator.Or(
                    criteria_IssueDate,
                    CriteriaOperator.And(criteria_IssueDate_1, criteria_CreateDate));

                CriteriaOperator criteria_RowStatus        = new BinaryOperator("RowStatus", 0, BinaryOperatorType.GreaterOrEqual);
                CriteriaOperator criteria_BusinessObjectId = new BinaryOperator(new OperandProperty("BusinessObjectId.BusinessObjectId"), businessObject.BusinessObjectId, BinaryOperatorType.NotEqual);
                CriteriaOperator criteria = CriteriaOperator.And(criteria_Job, criteria_Datetime, criteria_RowStatus, criteria_BusinessObjectId);

                etlBusinessObjectCollection = new XPCollection <ETLBusinessObject>(session, criteria);
            }
            catch (Exception)
            {
                throw;
            }
            return(etlBusinessObjectCollection);
        }
Esempio n. 28
0
        protected override void OnActivated()
        {
            //找出所有使用本单据的FlowChartFormNode
            //所出所有使用FormNode.Oid的FormEdge
            var thisName = this.View.Model.ModelClass.Name;
            var forms    = ObjectSpace.GetObjects <FlowChartFormNode>(new BinaryOperator("FormID", this.View.Model.ModelClass.Name));
            var actions  = ObjectSpace.GetObjects <FlowChartEdge>(CriteriaOperator.Or(new InOperator("From", forms.ToArray()), new InOperator("To", forms.ToArray())));

            DoFlowAction.Items.Clear();
            foreach (var act in actions)
            {
                var singleAction = new ChoiceActionItem();

                singleAction.Caption = GetActionCaption(act, thisName);
                singleAction.Data    = act;
                DoFlowAction.Items.Add(singleAction);
            }
            base.OnActivated();
            // Perform various tasks depending on the target View.
        }
Esempio n. 29
0
        protected void comboInventory_ItemsRequestedByFilterCondition(object source, ListEditItemsRequestedByFilterConditionEventArgs e)
        {
            ASPxComboBox             comboItemUnit = source as ASPxComboBox;
            XPCollection <Inventory> collection    = new XPCollection <Inventory>(session);

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

            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));

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

            comboItemUnit.DataSource = collection;
            comboItemUnit.DataBindItems();
        }
Esempio n. 30
0
        void accountCombobox_ItemsRequestedByFilterCondition(object source, ListEditItemsRequestedByFilterConditionEventArgs e)
        {
            ASPxComboBox           accountCombobox = source as ASPxComboBox;
            XPCollection <Account> collection      = new XPCollection <Account>(session);

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

            CriteriaOperator criteria = CriteriaOperator.Or(
                new BinaryOperator("Code", e.Filter, BinaryOperatorType.Like),
                new BinaryOperator("Name", e.Filter, BinaryOperatorType.Like),
                new BinaryOperator("Description", e.Filter, BinaryOperatorType.Like)
                );

            collection.Criteria = criteria;

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

            accountCombobox.DataSource = collection;
            accountCombobox.DataBindItems();
        }