Пример #1
0
        public override bool Search(bool preserveSelection)
        {
            criteria.Validate(true);
            ErrorList valErr = criteria.GetValidationErrors();

            errors.List.DataSource = valErr.Errors;
            errors.List.DataBind();
            if (valErr.HasErrors())
            {
                return(false);
            }

            ICustomerService svcCustomer = DI.Resolve <ICustomerService>();

            try
            {
                Customer_ReadListInput_Criteria inReadList_Criteria = new Customer_ReadListInput_Criteria();
                criteria.ToDataContract(inReadList_Criteria);
                IEnumerable <Customer_ReadListOutput> outReadList;
                using (TimeTracker.ServiceCall)
                    outReadList = svcCustomer.ReadList(inReadList_Criteria);
                list.FromDataContract(outReadList, preserveSelection);
                list.AppliedCriteria = criteria.GetFieldCriteriaSettings();
                uclAppliedCriteria.BindTo(list.AppliedCriteria);
                return(true);
            }
            catch (Exception ex)
            {
                errors.List.DataSource = ErrorList.FromException(ex).Errors;
                errors.List.DataBind();
            }
            finally
            {
                if (svcCustomer is IDisposable)
                {
                    ((IDisposable)svcCustomer).Dispose();
                }
            }
            return(false);
        }