Esempio n. 1
0
        /// <summary>
        /// 从数据库中获取习文存储的业务组预置参数信息
        /// </summary>
        /// <param name="filter"></param>
        /// <param name="solutionId"></param>
        /// <returns></returns>
        private bool InitFilterArgsAfterOpenFilter(ref FilterArgs filter, string solutionId)
        {
            try
            {
                string sql          = string.Format("select RunData FROM dbo.flt_Solution where id = '{0}'", solutionId);
                var    filterString = SqlHelper.ExecuteScalar(this._loginInfo.UfDataCnnString, sql).ToString();
                var    xmlDocument  = new XmlDocument();
                xmlDocument.LoadXml(filterString);
                var doc      = xmlDocument.DocumentElement;
                var nodelist = doc.SelectNodes("/rundata/args/arg");
                if (nodelist != null)
                {
                    foreach (XmlNode node in nodelist)
                    {
                        _filter.Args.Add(node.Attributes["key"].Value, node.Attributes["value"].Value);
                    }
                }
                nodelist = doc.SelectNodes("/rundata/items/item");
                if (nodelist != null)
                {
                    foreach (XmlNode node in nodelist)
                    {
                        _filter.Args.Add(node.Attributes["name"].Value, node.Attributes["value"].Value);
                    }
                }
            }
            catch (Exception)
            {
                return(false);

                throw;
            }
            return(true);
        }
Esempio n. 2
0
        private void InitFilter(ref FilterArgs filterargs, U8LoginInfor login)
        {
            filterargs.Login       = login != null ? login.U8Login : null;
            filterargs.IsWebFilter = false;
            filterargs.ViewID      = this._viewId;
            if (login != null)
            {
                filterargs.UserID    = login.UserID;
                filterargs.LangID    = login.LocaleID;
                filterargs.AccID     = login.cAccId;
                filterargs.UserToken = login.UserToken;
            }
            filterargs.DataSource.FilterString = this._customFilterString;
            object result = SqlHelper.ExecuteDataSet(login.UfMetaCnnString,
                                                     string.Format(
                                                         "SELECT * FROM uap_report  WHERE ID = '{0}'",
                                                         this._reportId));
            var dataSet = result as DataSet;

            if (dataSet != null)
            {
                var dt = dataSet.Tables[0];
                if (dt != null)
                {
                    _className   = dt.Rows[0]["ClassName"].ToString();
                    _filterClass = dt.Rows[0]["FilterClass"].ToString();
                    _filterId    = dt.Rows[0]["FilterID"].ToString();
                    filterargs.InitClass(null, _filterId, _filterClass, _className);
                }
            }
        }
        public void Process(FilterArgs args)
        {
            //get current content item from our filter args.
            Item contentItem = args.ContentItem;

            //check if the content item is null
            if (contentItem.IsNull())
            {
                return;
            }

            //get current filter item from our filter args.
            //this will be used to pull out any filter settings.
            HierarchyFilterItem filterItem = args.FilterItem;

            //check if our filter item is null
            if (filterItem.IsNull())
            {
                return;
            }

            //verify that we also have a root item and if not return
            if (filterItem.RootItem == null || filterItem.RootItem.TargetItem.IsNull())
            {
                return;
            }

            //get our root item to filter off of
            Item rootItem = filterItem.RootItem.TargetItem;

            //hide our menu item if our content item is not a descendant of our root item.
            args.HideCommand = !contentItem.Axes.IsDescendantOf(rootItem);
        }
Esempio n. 4
0
        /// <summary>
        /// 同步调用api
        /// </summary>
        /// <param name="apiDescriptor"> API描述 </param>
        /// <param name="dataProvider"> API数据提供程序 </param>
        /// <returns></returns>
        public static ApiCallContext Invoke(this ApiDescriptor apiDescriptor, IApiDataProvider dataProvider)
        {
            if (dataProvider == null)
            {
                throw new ArgumentNullException(nameof(dataProvider));
            }
            var container = apiDescriptor.Container;
            var context   = container.CreateContext(apiDescriptor, dataProvider, out var resultProvider);

            if (context.IsError)
            {
                return(context);
            }
            try
            {
                var instance   = context.ApiInstance;
                var filterArgs = new FilterArgs(context, resultProvider);
                apiDescriptor.FiltrationOnExecuting(context, filterArgs); //执行前置过滤器
                if (filterArgs.Cancel == false)
                {
                    container.EventCaller.Invoke(GlobalEvents.OnBeginInvokeMethod, context);
                    filterArgs.Result = apiDescriptor.Invoke(instance, context.Parameters.Values.ToArray()).ProcessResult(); //执行方法
                }
                else
                {
                    context.Debug("前置过滤器截断");
                }
                filterArgs.Cancel = false;
                apiDescriptor.FiltrationOnExecuted(context, filterArgs); //执行后置过滤器
                container.EventCaller.Invoke(GlobalEvents.OnBeginResponse, context);
                return(context);
            }
            catch (Exception ex)
            {
                context.Error(ex, "系统异常");
                container.EventCaller.Invoke(GlobalEvents.OnUnprocessException, context);
                throw;
            }
            finally
            {
                if (context?.IsError == true)
                {
                    var ex = context.Exception.GetRealException();
                    if (ex is ApiException e)
                    {
                        context.Warning(e.Message, "逻辑异常");
                        if (e.InnerException != null)
                        {
                            context.Warning(e.InnerException, "内部逻辑异常");
                        }
                        container.EventCaller.Invoke(GlobalEvents.OnApiException, context);
                    }
                    else
                    {
                        context.Error(context.Exception, "服务器内部错误");
                        container.EventCaller.Invoke(GlobalEvents.OnUnprocessException, context);
                    }
                }
            }
        }
Esempio n. 5
0
		public EventListModel() : base(typeof(GedcomEvent))
		{
			this.DefaultSortFunc = new Gtk.TreeIterCompareFunc(Compare);
			this.SetSortFunc(0, new Gtk.TreeIterCompareFunc(Compare));

			_args = new FilterArgs();
		}
Esempio n. 6
0
        public override MaidDocumentsViewModel GetViewModelForIndex(FilterArgs args)
        {
            var viewModel = new MaidDocumentsViewModel
            {
                Title        = BshkaraRes.MaidDocuments_Title,
                SearchString = args.SearchString,
                PageSize     = args.PageSize,
                MaidId       = args.MaidId
            };

            var query = UnitOfWork.Repository <MaidDocumentEntity>().Query()
                        .Include(x => x.CreatedBy)
                        .Include(x => x.UpdatedBy);

            if (!string.IsNullOrWhiteSpace(args.SearchString))
            {
                query.Filter(x => x.FileName.Contains(args.SearchString));
            }

            query.Filter(x => x.IsDeleted == false && (args.MaidId == Guid.Empty || x.MaidId == args.MaidId));
            query.OrderBy(q => q.OrderBy(d => d.FileName));

            int count;
            var items = query.GetPage(args.PageNumber, args.PageSize, out count);

            viewModel.Items = new StaticPagedList <MaidDocumentEntity>(items, args.PageNumber, args.PageSize,
                                                                       count);

            return(viewModel);
        }
Esempio n. 7
0
        private FilterArgs GetSql(FilterArgs args)
        {
            #region CS
            //RemoteDataHelper rdh = null;
            //if (args != null && !string.IsNullOrEmpty(args.ClassName.Trim()))
            //{
            //    if (args.DataSource.Type == CustomDataSourceTypeEnum.TemplateTable)
            //        args.DataSource.SQL = CustomDataSource.GetATableName();
            //    if (_context.ReportState == ReportStates.WebBrowse)
            //    {
            //        rdh = DefaultConfigs.GetRemoteHelper();
            //        args = rdh.GetSql(_context.UserToken, _context.TaskID, _context.SubID, _context.FilterArgs);
            //    }
            //    else
            //    {
            //        rdh = new RemoteDataHelper();
            //        ClientReportContext.Login = _login;
            //        rdh.GetSql(args);
            //    }
            //}
            #endregion

            var rdHelper = new RemoteDataHelper();
            //return rdHelper.GetSql(_login.UserToken, _login.TaskID, _login.SubID, args);
            if (args.DataSource.Type == CustomDataSourceTypeEnum.TemplateTable)
            {
                //args.DataSource.SQL = CustomDataSource.GetATableNameWithTaskId(_login.TaskID);
                args.DataSource.SQL = CustomDataSource.GetATableName();
            }
            ClientReportContext.Login = _login;
            rdHelper.GetSql(args);
            return(args);
        }
 public FilterArgs generateArgs()
 {
     FilterArgs args = new FilterArgs(this);
     if (milestone.SelectedItem != null)
         args.Add("milestone", (milestone.SelectedItem as Milestone).number + "");
     else if (allIssuesCheckbox.IsChecked != null && (bool)allIssuesCheckbox.IsChecked)
         args.Add("milestone", "none");
     args.Add("state", (StateSwitch.IsOn) ? "open" : "closed");
     args.Add("direction", (OrderSwitch.IsOn) ? "asc" : "desc");
     string labels = "";
     foreach (Label a in LabelsList.SelectedItems)
     {
         labels += a.name + ",";
     }
     if (labels != "")
     {
         labels = labels.Substring(0, labels.Length - 1);
         args.Add("labels", labels);
     }
     if (SortCombo.SelectedItem != null)
         args.Add("sort", ((TextBlock)SortCombo.SelectedItem).Text.ToLower());
     else
         args.Add("sort", "created");
     return args;
 }
Esempio n. 9
0
        public override PassportsViewModel GetViewModelForIndex(FilterArgs args)
        {
            var viewModel = new PassportsViewModel
            {
                Title        = BshkaraRes.Nationalities_Title,
                SearchString = args.SearchString,
                PageSize     = args.PageSize
            };

            var query = UnitOfWork.Repository <MaidPassportDetailEntity>().Query()
                        .Include(x => x.CreatedBy)
                        .Include(x => x.UpdatedBy);

            if (!string.IsNullOrWhiteSpace(args.SearchString))
            {
                query.Filter(x => x.PassportNumber.Contains(args.SearchString));
            }

            query.Filter(x => x.IsDeleted == false);
            query.OrderBy(q => q.OrderBy(d => d.PassportNumber));

            int count;
            var items = query.GetPage(args.PageNumber, args.PageSize, out count);

            viewModel.Items = new StaticPagedList <MaidPassportDetailEntity>(items, args.PageNumber, args.PageSize, count);

            return(viewModel);
        }
    public override FilterArgs applyFilter(FilterArgs a)
    {
        float center_H, center_S, center_V, center_A;
        float avr_H, avr_S, avr_V;

        Color.RGBToHSV(a.color, out center_H, out center_S, out center_V);
        center_A = a.color.a;
        avr_S    = 1;
        avr_V    = 1;

        a.nabours.ForEach((color) =>
        {
            if (color.a == 0)
            {
                return;
            }
            float tmp_H, tmp_S, tmp_V;
            Color.RGBToHSV(color, out tmp_H, out tmp_S, out tmp_V);
            avr_S += tmp_S;
            avr_V += tmp_V;
        });
        avr_V += center_V;
        avr_S += center_S;
        float f = 1f / (a.nabours.Count + 1);

        avr_V *= f;
        avr_S *= f;
        Color x = Color.HSVToRGB(center_H, avr_S, avr_V);

        x.a     = center_A;
        a.color = x;

        return(a);
    }
Esempio n. 11
0
        private void InitFilterArgs(Dictionary <string, object> message)
        {
            FilterArgs fa = _context.FilterArgs;

            fa.ViewID = _context.ViewID;
            fa.Login  = ClientReportContext.Login.U8Login;

            if (message != null)
            {
                XmlDocument doc = new XmlDocument();
                XmlElement  xe  = doc.CreateElement("data");
                doc.AppendChild(xe);
                foreach (string key in message.Keys)
                {
                    XmlElement xei = doc.CreateElement("item");
                    xei.SetAttribute("name", key);

                    object o = message[key];
                    if (!(o is string[]))
                    {
                        xei.SetAttribute("value", o == null?"":o.ToString());
                    }
                    else
                    {
                        string[] os = o as string[];
                        xei.SetAttribute("value", os[0]);
                        xei.SetAttribute("value2", os[1]);
                    }
                    xe.AppendChild(xei);
                }
                fa.Args.Add("filteritems", doc.InnerXml);
            }
        }
Esempio n. 12
0
        public override ApiTokensViewModel GetViewModelForIndex(FilterArgs args)
        {
            var viewModel = new ApiTokensViewModel
            {
                Title        = "API keys",
                SearchString = args.SearchString,
                PageSize     = args.PageSize
            };

            var query = UnitOfWork.Repository <ApiTokenEntity>().Query()
                        .Include(x => x.User)
                        .Include(x => x.CreatedBy)
                        .Include(x => x.UpdatedBy);

            if (!string.IsNullOrWhiteSpace(args.SearchString))
            {
                query.Filter(x => x.Name.Contains(args.SearchString));
            }

            query.Filter(x => x.IsDeleted == false);

            query.OrderBy(q => q.OrderBy(x => x.Name));

            int count;
            var items = query.GetPage(args.PageNumber, args.PageSize, out count);

            viewModel.Items = new StaticPagedList <ApiTokenEntity>(items, args.PageNumber, args.PageSize, count);

            return(viewModel);
        }
Esempio n. 13
0
        override public void Process(FilterArgs args)
        {
            ItemKey contextItemKey = new ItemKey(args.ContentItem);

            if (Hide(contextItemKey))
            {
                args.HideCommand = true;
            }
        }
        /// <summary>
        /// 对列表数据追加过滤或是排序,推荐通过过滤方案进行处理,如果是特殊的强制过滤,可以在这个位置进行处理
        /// </summary>
        /// <param name="e"></param>
        public override void PrepareFilterParameter(FilterArgs e)
        {
            if (Str_Filter == "")
            {
                Act_Task_tbbMyExec();
            }

            e.AppendQueryFilter(Str_Filter);
            e.AppendQueryOrderby("");
        }
        public void Process(FilterArgs args)
        {
            //get master database
            Database database = Database.GetDatabase("master");
            if (database == null)
            {
                args.HideCommand = false;
                return;
            }

            Item deviceFolderItem = database.GetItem("/sitecore/layout/Devices");
            if (deviceFolderItem.IsNull())
            {
                args.HideCommand = false;
                return;
            }

            if (args.ContentItem.IsNull() || args.ContentItem.IsMediaItem())
            {
                args.HideCommand = false;
                return;
            }

            //iterate over devices to find layers with a layout assigned))
            foreach (Item item in deviceFolderItem.Axes.GetDescendants())
            {
                //verify that this item is of a device item
                if (item.IsNull() || !item.IsOfTemplate(CopyItemUrlMenuItem.DeviceTemplate))
                {
                    continue;
                }

                //cast to device item
                DeviceItem deviceItem = item;

                //get layout for this device
                CopyItemUrlMenuItem copyItemUrlMenuItem = new CopyItemUrlMenuItem();
                copyItemUrlMenuItem.CurrentItem = args.ContentItem;

                LayoutItem layoutItem = copyItemUrlMenuItem.GetLayout(deviceItem);

                //verify there is a layout and make sure it is not that of the fallback device.)
                if (layoutItem == null)
                {
                    continue;
                }

                args.HideCommand = false;
                return;
            }

            args.HideCommand = true;
        }
        public override void PrepareFilterParameter(FilterArgs e)
        {
            var filter = Act_SetCustFilter();

            if (this.Context.UserId.ToString() == "100560")
            {
                return;
            }
            //e.CustomFilter["FSelectAllOrg"] = true;
            e.AppendQueryFilter(filter);
            e.AppendQueryOrderby(" FCreateDate DESC");
            // this.View.ShowMessage(filter);
        }
        public override void PrepareFilterParameter(FilterArgs e)
        {
            base.PrepareFilterParameter(e);
            long        userId        = this.Model.Context.UserId;
            string      strSql        = string.Format(@"/*dialect*/ SELECT FLINKOBJECT FROM T_SEC_USER WHERE FUSERID = {0}", userId);
            long        personId      = DBUtils.ExecuteScalar <long>(this.Context, strSql, 0, null);
            List <long> salePersonIds = CRMServiceHelper.getSalerPersonids(this.Context, personId);
            var         a             = from Id in salePersonIds select Id;
            string      ids           = string.Join(",", a.ToArray());
            string      filter        = string.Format(@"F_PEJK_LEADER in ({0})", ids);

            e.FilterString = e.FilterString.IsNullOrEmpty() ? filter : e.FilterString + " and " + filter;
        }
Esempio n. 18
0
        public override BookingViewModel GetViewModelForIndex(FilterArgs args)
        {
            var viewModel = new BookingViewModel
            {
                Title        = BshkaraRes.Booking_Title,
                SearchString = args.SearchString,
                PageSize     = args.PageSize
            };

            var query = UnitOfWork.Repository <BookingEntity>().Query()
                        .Include(x => x.CreatedBy)
                        .Include(x => x.UpdatedBy);

            if (!string.IsNullOrWhiteSpace(args.SearchString))
            {
                switch (CultureHelper.GetCurrentNeutralCulture().ToLower())
                {
                case "en":
                    query.Filter(x => x.Maid.Name.En.Contains(args.SearchString));
                    break;

                case "ar":
                    query.Filter(x => x.Maid.Name.Ar.Contains(args.SearchString));
                    break;
                }
            }

            // For agency user we will show only they maid with booking status in "Processing"
            var agency = HttpContext.Current.User.Identity.GetAgency();

            if (agency != null)
            {
                query.Filter(x => x.Maid.AgencyId == agency.Id && x.BookingStatus == BookingStatus.Processing);
            }

            if (args.BookingStatus != null)
            {
                query.Filter(x => x.BookingStatus == args.BookingStatus.Value);
            }

            query.Filter(x => x.IsDeleted == false);

            query.OrderBy(q => q.OrderBy(d => d.Maid.Name.En));

            int count;
            var items = query.GetPage(args.PageNumber, args.PageSize, out count);

            viewModel.Items = new StaticPagedList <BookingEntity>(items, args.PageNumber, args.PageSize, count);

            return(viewModel);
        }
Esempio n. 19
0
        public override MaidsViewModel GetViewModelForIndex(FilterArgs args)
        {
            var viewModel = new MaidsViewModel
            {
                Title        = BshkaraRes.Maid_Title,
                SearchString = args.SearchString,
                PageSize     = args.PageSize
            };

            var query = UnitOfWork.Repository <MaidEntity>().Query()
                        .Include(x => x.Documents)
                        .Include(x => x.EmploymentHistory)
                        .Include(x => x.Languages)
                        .Include(x => x.Skills)
                        .Include(x => x.Passport)
                        .Include(x => x.CreatedBy)
                        .Include(x => x.UpdatedBy);

            if (!string.IsNullOrWhiteSpace(args.SearchString))
            {
                switch (CultureHelper.GetCurrentNeutralCulture().ToLower())
                {
                case "en":
                    query.Filter(x => x.Name.En.Contains(args.SearchString));
                    break;

                case "ar":
                    query.Filter(x => x.Name.Ar.Contains(args.SearchString));
                    break;
                }
            }

            var agency = HttpContext.Current.User.Identity.GetAgency();

            if (agency != null)
            {
                query.Filter(x => x.AgencyId == agency.Id);
            }

            query.Filter(x => x.IsDeleted == false);

            query.OrderBy(q => q.OrderBy(d => d.Name.En));

            int count;
            var items = query.GetPage(args.PageNumber, args.PageSize, out count);

            viewModel.Items = new StaticPagedList <MaidEntity>(items, args.PageNumber, args.PageSize, count);

            return(viewModel);
        }
Esempio n. 20
0
        /// <summary>
        /// 对列表数据追加过滤或是排序,推荐通过过滤方案进行处理,如果是特殊的强制过滤,可以在这个位置进行处理
        /// </summary>
        /// <param name="e"></param>
        public override void PrepareFilterParameter(FilterArgs e)
        {
            //string _userID = this.Context.UserId.ToString();
            //string _FCrmR = this.Act_GetSchRoleFilter(_userID, "or");
            //string _FilterStr = " FCreatorID='" + _userID + "' or FCrmHolder='" + _userID + "'" + _FCrmR;

            if (Str_Filter == "")
            {
                Act_ABIC_tbbMyAll();
            }
            addTimeOutFilter();
            e.AppendQueryFilter(Str_Filter);
            e.AppendQueryOrderby("");
        }
Esempio n. 21
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="srcData"></param>
        /// <param name="arges"></param>
        /// <returns></returns>
        public override double[] Process(double[] input_data, FilterArgs args)
        {
            double[] sData = base.Process(input_data, args);
            if (sData == null)
            {
                return(null);
            }
            if (!(args is MedianFilterArgs))
            {
                return(null);
            }
            MedianFilterArgs e = args as MedianFilterArgs;

            return(this.Process(sData, e));
        }
Esempio n. 22
0
        /// <summary>
        /// 执行微分计算
        /// </summary>
        /// <param name="srcData"></param>
        /// <param name="arges"></param>
        /// <returns></returns>
        public override double[] Process(double[] srcData, FilterArgs args)
        {
            double[] sData = base.Process(srcData, args);
            if (sData == null)
            {
                return(null);
            }
            if (!(args is DifferentiateFilterArgs))
            {
                return(null);
            }
            DifferentiateFilterArgs e = args as DifferentiateFilterArgs;

            return(this.Process(sData, e.Dt, e.InitialCondition, e.FinalCondition));
        }
Esempio n. 23
0
        public void Process(FilterArgs args)
        {
            //get master database
            Database database = Database.GetDatabase("master");
            if (database == null || args.ContentItem.IsNull())
            {
                args.HideCommand = false;
                return;
            }

            MultiVariantProcessor processor = new MultiVariantProcessor();
            TemplateItem templateItem = processor.GetTemplate(args.ContentItem.TemplateID.ToString(), database);

            args.HideCommand = (templateItem == null);
        }
Esempio n. 24
0
        /// <summary>
        /// 抽样
        /// </summary>
        /// <param name="srcData"></param>
        /// <param name="arges"></param>
        /// <returns></returns>
        public override double[] Process(double[] srcData, FilterArgs args)
        {
            double[] sData = base.Process(srcData, args);
            if (sData == null)
            {
                return(null);
            }
            if (!(args is SampleArgs))
            {
                return(null);
            }
            SampleArgs e = args as SampleArgs;

            return(this.SampleData(sData, e.Interval));
        }
Esempio n. 25
0
        public override void PrepareFilterParameter(FilterArgs e)
        {
            base.PrepareFilterParameter(e);
            string _filter = Act_SetCustFilter();

            e.AppendQueryFilter(_filter);
            //this.View.GetFormId();
            //var x = this.ListView.Model.DataObject["BillHead"];
            //string[] fids = this.ListView.CurrentPageRowsInfo.GetPrimaryKeyValues();
            //foreach(var fid in fids)
            //{
            //    string procInstId = WorkflowChartServiceHelper.GetProcInstIdByBillInst(this.Context, this.View.GetFormId(), fid);
            //    this.View.ShowMessage(procInstId);
            //}
        }
Esempio n. 26
0
        /// <summary>
        /// SG滤波
        /// </summary>
        /// <param name="srcData"></param>
        /// <param name="arges"></param>
        /// <returns></returns>
        public override double[] Process(double[] srcData, FilterArgs args)
        {
            double[] sData = base.Process(srcData, args);
            if (sData == null)
            {
                return(null);
            }
            if (!(args is SGFilterArgs))
            {
                return(null);
            }
            SGFilterArgs e = args as SGFilterArgs;

            return(this.Filter(sData, e.Order, e.SidePoint));
        }
 public override void PrepareFilterParameter(FilterArgs e)
 {
     base.PrepareFilterParameter(e);
     this.ListView.OpenParameter.GetCustomParameter(BOSConst.CustomBillTypeID)
     .Adaptive(obj => obj.ToChangeTypeOrDefault <string>())
     .Adaptive(val => val.IsNullOrEmptyOrWhiteSpace().False(() =>
     {
         var field = this.ListModel.BillBusinessInfo.GetBillTypeField();
         if (field == null)
         {
             return;
         }
         e.AppendQueryFilter(string.Format("{0} = '{1}'", field.Key, val));
     }));
 } //end method
Esempio n. 28
0
 /// <summary>
 /// 基类数据处理,判定输入数据有效性
 /// </summary>
 /// <param name="srcData"></param>
 /// <param name="arges"></param>
 /// <returns></returns>
 public virtual double[] Process(double[] srcData, FilterArgs args)
 {
     if (srcData == null)
     {
         return(null);
     }
     if (srcData.Length == 0)
     {
         return(null);
     }
     if (args == null)
     {
         return(null);
     }
     return(srcData);
 }
Esempio n. 29
0
        public void Process(FilterArgs args)
        {
            //get master database
            Database database = Database.GetDatabase("master");

            if (database == null || args.ContentItem.IsNull())
            {
                args.HideCommand = false;
                return;
            }

            MultiVariantProcessor processor    = new MultiVariantProcessor();
            TemplateItem          templateItem = processor.GetTemplate(args.ContentItem.TemplateID.ToString(), database);

            args.HideCommand = (templateItem == null);
        }
Esempio n. 30
0
        private void InitFilterArgs(UFGeneralFilter.FilterSrv fltsrv)
        {
            FilterArgs  fa  = _context.FilterArgs;
            XmlDocument doc = new XmlDocument();
            XmlElement  xe  = doc.CreateElement("data");

            doc.AppendChild(xe);
            for (int i = 1; i <= fltsrv.FilterList.Count; i++)
            {
                XmlElement xei = doc.CreateElement("item");
                xei.SetAttribute("name", fltsrv.FilterList[i].Key);
                xei.SetAttribute("value", fltsrv.FilterList[i].varValue);
                xei.SetAttribute("value2", fltsrv.FilterList[i].varValue2);
                xe.AppendChild(xei);
            }
            fa.Args.Add("filteritems", doc.InnerXml);
        }
Esempio n. 31
0
        // GET api/Games
        public IEnumerable <GameDTO> GetGames([FromUri] FilterArgs filters, [FromUri] PaginationArgs paginations)
        {
            if (filters == null)
            {
                filters = new FilterArgs();
            }
            if (paginations == null)
            {
                paginations = new PaginationArgs();
            }
            var games = _gameService.Get(filters, CurrentLangCode);

            paginations.TotalItems = games.Count();
            paginations.TotalPages = (paginations.TotalItems / paginations.CountPerPage) + 1;
            games = games.Skip((paginations.PageNumber - 1) * paginations.CountPerPage).Take(paginations.CountPerPage);
            return(Mapper.Map <IEnumerable <GameDTO> >(games));
        }
Esempio n. 32
0
        /// <summary>
        /// 平台处理函数
        /// </summary>
        /// <param name="srcData"></param>
        /// <param name="arges"></param>
        /// <returns></returns>
        public List <FlatInfo> Process(double[] input_data, FilterArgs args)
        {
            if (input_data == null)
            {
                return(null);
            }
            if (args == null)
            {
                return(null);
            }
            if (!(args is MedianFilterArgs))
            {
                return(null);
            }

            MedianFilterArgs arg = args as MedianFilterArgs;
            int _flat_width      = arg.FrameSize / 2 + 1;

            if (input_data.Length <= _flat_width)
            {
                return(null);
            }

            //查找平台
            List <FlatInfo> _flat_list = new List <FlatInfo>();

            List <FlatInfo> _flat1 = FindFlat(input_data.ToList(), _flat_width);

            if (_flat1 != null)
            {
                _flat_list.AddRange(_flat1);
            }

            List <FlatInfo> _flat2 = FindFlat(input_data.ToList(), _flat_width + 1);

            if (_flat2 != null)
            {
                _flat_list.AddRange(_flat2);
            }

            //List<FlatInfo> _flat3 = FindFlat(input_data.ToList(), _flat_width - 1);
            //if (_flat3 != null)
            //    _flat_list.AddRange(_flat3);

            return(_flat_list);
        }
        private void Initialize(string reportid, ReportStates reportstate, object rawfilter, bool bshowui, string url, string userid, string langid, string accid, string filterclass, string authstring, string ciyear, string curdate)
        {
            try
            {
                _reportid     = reportid;
                _reportstate  = reportstate;
                _localeid     = langid;
                this._accYear = ciyear;
                this._accId   = accid;
                this._userId  = userid;
                _reportstate  = reportstate;

                _filterargs              = new FilterArgs(_reportid, filterclass, url.Length > 0 ? null : _login.U8Login);
                _filterargs.Login        = _login != null ? _login.U8Login : null;
                _filterargs.bShowUI      = bshowui;
                _filterargs.RawFilter    = rawfilter;
                _filterargs.UFBaseLibUrl = url;
                _filterargs.IsWebFilter  = url.Length > 0;
                _filterargs.UserID       = userid;
                _filterargs.LangID       = langid;
                _filterargs.AccID        = accid;
                _filterargs.UserToken    = _usertoken;

                if (authstring != null)
                {
                    _filterargs.Args.Add("AuthString", authstring);
                }
                if (ciyear != null && ciyear != "")
                {
                    _filterargs.Args.Add("CIYear", ciyear);
                }
                if (!string.IsNullOrEmpty(curdate))
                {
                    _filterargs.Args.Add("CurDate", curdate);
                }

                if (_reportstate == ReportStates.Preview || bWebOrOutU8)//ReportStates.WebBrowse
                {
                    _filterargs.Args.Add("previeworweb", "1");
                }
            }
            catch (TargetInvocationException ex)
            {
                throw new ReportException(ex.InnerException.Message);
            }
        }
        public override void PrepareFilterParameter(FilterArgs e)
        {
            base.PrepareFilterParameter(e);
            long                    userId        = this.Model.Context.UserId;
            string                  strSql        = string.Format(@"/*dialect*/ SELECT FLINKOBJECT FROM T_SEC_USER WHERE FUSERID = {0}", userId);
            long                    personId      = DBUtils.ExecuteScalar <long>(this.Context, strSql, 0, null);
            List <long>             salePersonIds = CRMServiceHelper.getSalerPersonids(this.Context, personId);
            var                     a             = from Id in salePersonIds select Id;
            string                  ids           = string.Join(",", a.ToArray());
            string                  billNoQuery   = string.Format(@"/*dialect*/select a.FID from PEJK_SALECONTRACTS a left join PEJK_SALECONTRACTENTRY b on a.FID = b.FID where a.F_PEJK_MANAGER in ({0}) or b.F_PEJK_SALER IN ({0})", ids);
            DynamicObjectCollection doo           = DBUtils.ExecuteDynamicObject(this.View.Context, billNoQuery);

            object[] fid     = (from c in doo select c[0]).ToArray();
            string   billIds = string.Join(",", fid);
            string   filter  = string.Format(@"fid in ({0})", billIds);

            e.FilterString = e.FilterString.IsNullOrEmpty() ? filter : e.FilterString + " and " + filter;
        }
        public List <TodoList> FilterTodoLists(FilterArgs filterArgs)
        {
            IList <TodoList> todoLists = this.todoService.GetAll();

            if (!String.IsNullOrWhiteSpace(filterArgs.Name))
            {
                todoLists = todoLists.Where(tdl => tdl.Name.Contains(filterArgs.Name)).ToList();
            }

            if (filterArgs.DateFrom.HasValue)
            {
                todoLists = todoLists.Where(tdl => tdl.CreatedAt >= filterArgs.DateFrom.Value).ToList();
            }

            if (filterArgs.DateTo.HasValue)
            {
                todoLists = todoLists.Where(tdl => tdl.CreatedAt <= filterArgs.DateTo.Value).ToList();
            }

            return(todoLists.ToList());
        }
        public void Process(FilterArgs args)
        {
            //get current content item from our filter args.
            Item contentItem = args.ContentItem;

            //check if the content item is null
            if (contentItem.IsNull())
            {
                return;
            }

            //get current filter item from our filter args.
            //this will be used to pull out any filter settings.
            TemplateFilterItem filterItem = args.FilterItem;

            //check if our filter item is null
            if (filterItem.IsNull())
            {
                return;
            }

            //get our exclude templates to filter off of
            List<Item> excludeTemplates = new List<Item>();
            if (filterItem.ExcludeTemplates != null)
            {
                excludeTemplates.AddRange(filterItem.ExcludeTemplates.GetItems());
            }

            //go through each exclude filter and if our item is of an exclude template filter
            //then set hide to true and return.  Exclude will take precedence over include.
            foreach (Item excludeTemplate in excludeTemplates)
            {
                if (contentItem.IsOfTemplate(excludeTemplate.ID.ToString()))
                {
                    args.HideCommand = true;
                    return;
                }
            }

            //get our include templates to filter off of
            List<Item> includeTemplates = new List<Item>();
            if (filterItem.IncludeTemplates != null)
            {
                includeTemplates.AddRange(filterItem.IncludeTemplates.GetItems());
            }

            //if we have include templates then we need to check each template and make sure our
            //content item is at least of one of those template types.
            foreach (Item includeTemplate in includeTemplates)
            {
                if (contentItem.IsOfTemplate(includeTemplate.ID.ToString()))
                {
                    args.HideCommand = false;
                    return;
                }
            }

            //if we get here then our template was neither included or excluded.
            //if we have specified include templates, then we should hide by default
            //as we only want to show templates that were in our include list.
            if (includeTemplates.Any())
            {
                args.HideCommand = true;
                return;
            }

            //by default just include our item.  We know it wasn't excluded and we don't have
            //a specific include list
            args.HideCommand = false;
        }
        /// <summary>
        /// Method that will be called when a command item (contextual menu item, ribbon button, etc.) is about to be rendered.
        /// </summary>
        /// <param name="args"></param>
        public void Process(GetQueryStateArgs args)
        {
            //if we don't have a command context then return.  the command context will contain all the info we need.
            if (args.CommandContext == null)
            {
                return;
            }

            //get our current content item that was selected to display the menu.
            Item contentItem = null;
            if (args.CommandContext.Items != null && args.CommandContext.Items.Any())
            {
                contentItem = args.CommandContext.Items.FirstOrDefault();
            }

            //get our parent item that will contain all of the filterable commands
            Item parentMenuItem = Context.Database.GetItem(ID.Parse(CommandsParentFolderId));

            //if we didn't find our parent item we can't do anything, just return.
            if (parentMenuItem.IsNull())
            {
                return;
            }

            //get our list of menu items from our context menu parent.
            //first try to pull from cache based on the parent name,
            //otherwise get from parent item.
            Dictionary<string, object> menuItemArgs = new Dictionary<string, object> { { "ParentMenuItem", parentMenuItem } };
            Dictionary<string, Item> menuItems = CacheUtil.GetFromCacheWithParams<Dictionary<string, Item>>(parentMenuItem.Name,
                                                                                                            new TimeSpan(0, 8, 0),
                                                                                                            GetMenuItems,
                                                                                                            menuItemArgs);

            //get our command name from the current menu item
            string commandName = args.CommandName;

            //if we don't have a command name then just return
            if (string.IsNullOrEmpty(commandName))
            {
                return;
            }

            //try to get the command item by using our command name to match against the
            //list of commands pulled from the cache.  If we couldn't find one then return.
            Item rawCommandItem;
            if (!menuItems.TryGetValue(commandName.ToLowerInvariant(), out rawCommandItem))
            {
                return;
            }

            //get our command item as the proper custom item type
            CommandItem commandItem = rawCommandItem;

            //get our list of filters assigned to our command.
            MultilistField filters = commandItem.Filters;

            //if we don't have any filters then just return.
            if (filters == null)
            {
                return;
            }

            //loop through each filter, get our filter class through reflection,
            //and execute our filter.  If any filters hide our menu item, then set
            //the menu item to hidden.
            foreach (Item filterItem in filters.GetItems())
            {
                //if our filter is null then just continue
                if (filterItem.IsNull())
                {
                    continue;
                }

                //get our filter code.  This sitecore method will work only if
                //our Item has a Type field.  Any class specified in this Type
                //field will be created here.
                IFilter filter = ItemScripts.CreateObject(filterItem) as IFilter;

                //if we don't have filter code then just continue
                if (filter == null)
                {
                    continue;
                }

                //create our filter args for passing into our filter.
                //we pass the actual filter item into our filter code so it can use
                //any custom fields needed to perform the filtering.
                FilterArgs filterArgs = new FilterArgs(contentItem, filterItem);

                //call our filter
                filter.Process(filterArgs);

                //if our filter set our visibility to hidden then hide our menu item and return
                if (filterArgs.HideCommand)
                {
                    //hide our menu item.
                    args.CommandState = CommandState.Hidden;

                    //return as we don't need to do any further checking.
                    return;
                }
            }
        }