private void Button_Search_Click(object sender, RoutedEventArgs e)
 {
     if (ValidationManager.Validate(this.QuerySection))
     {
         filter   = model.ConvertVM <CategoryKeywordsQueryVM, CategoryKeywordsQueryFilter>();
         filterVM = Newegg.Oversea.Silverlight.Utilities.UtilityHelper.DeepClone <CategoryKeywordsQueryFilter>(filter);
         QueryResultGrid.QueryCriteria = this.filter;
         QueryResultGrid.Bind();
     }
 }
 public override void OnPageLoad(object sender, EventArgs e)
 {
     facade                    = new CategoryKeywordsQueryFacade(this);
     filter                    = new CategoryKeywordsQueryFilter();
     model                     = new CategoryKeywordsQueryVM();
     model.CompanyCode         = Newegg.Oversea.Silverlight.ControlPanel.Core.CPApplication.Current.CompanyCode;
     model.ChannelID           = "1";
     QuerySection.DataContext  = model;
     btnStackPanel.DataContext = model;
     base.OnPageLoad(sender, e);
 }
Beispiel #3
0
        public virtual QueryResult QueryCategoryKeywords(CategoryKeywordsQueryFilter filter)
        {
            int totalCount;
            var dataTable = ObjectFactory <IKeywordQueryDA> .Instance.QueryCategoryKeywords(filter, out totalCount);

            return(new QueryResult()
            {
                Data = dataTable,
                TotalCount = totalCount
            });
        }
        private void btnNewItem_Click(object sender, RoutedEventArgs e)
        {
            UCAddUniversalCategoryKeywords usercontrol = new UCAddUniversalCategoryKeywords();

            usercontrol.Dialog = Window.ShowDialog(ResKeywords.Title_CreateCommonKeywords, usercontrol, (obj, args) =>
            {
                filter   = model.ConvertVM <CategoryKeywordsQueryVM, CategoryKeywordsQueryFilter>();
                filterVM = Newegg.Oversea.Silverlight.Utilities.UtilityHelper.DeepClone <CategoryKeywordsQueryFilter>(filter);
                QueryResultGrid.QueryCriteria = this.filter;
                QueryResultGrid.Bind();
            });
        }
        /// <summary>
        /// 查询分类关键字
        /// </summary>
        /// <param name="callback"></param>
        public void QueryCategoryKeywords(CategoryKeywordsQueryFilter filter, int PageSize, int PageIndex, string SortField, EventHandler <RestClientEventArgs <dynamic> > callback)
        {
            filter.PageInfo = new ECCentral.QueryFilter.Common.PagingInfo()
            {
                PageSize  = PageSize,
                PageIndex = PageIndex,
                SortBy    = SortField
            };
            string relativeUrl = "/MKTService/KeywordsInfo/QueryCategoryKeywords";

            restClient.QueryDynamicData(relativeUrl, filter, callback);
        }
Beispiel #6
0
        /// <summary>
        /// 查询分类关键字
        /// </summary>
        /// <param name="filter"></param>
        /// <param name="totalCount"></param>
        /// <returns></returns>
        public DataTable QueryCategoryKeywords(CategoryKeywordsQueryFilter filter, out int totalCount)
        {
            PagingInfoEntity pagingEntity = new PagingInfoEntity();

            if (filter.PageInfo == null)
            {
                pagingEntity = null;
            }
            else
            {
                pagingEntity.SortField     = filter.PageInfo.SortBy;
                pagingEntity.MaximumRows   = filter.PageInfo.PageSize;
                pagingEntity.StartRowIndex = filter.PageInfo.PageIndex * filter.PageInfo.PageSize;
            }


            var cmd = DataCommandManager.CreateCustomDataCommandFromConfig("Keyword_QueryCategoryKeywordsList");

            using (var sqlBuilder = new DynamicQuerySqlBuilder(cmd.CommandText, cmd, pagingEntity, "A.SysNo DESC"))
            {
                //sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "ChannelID", DbType.String, "@ChannelID", QueryConditionOperatorType.Equal, filter.ChannelID);

                sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "B.Category1SysNo", DbType.String, "@C1SysNo", QueryConditionOperatorType.Equal, filter.Category1SysNo);
                sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "B.Category2SysNo", DbType.String, "@C2SysNo", QueryConditionOperatorType.Equal, filter.Category2SysNo);
                sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "B.Category3SysNo", DbType.String, "@C3SysNo", QueryConditionOperatorType.Equal, filter.Category3SysNo);
                sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "A.CompanyCode", DbType.String, "@CompanyCode", QueryConditionOperatorType.Equal, filter.CompanyCode);

                cmd.CommandText = sqlBuilder.BuildQuerySql();
                var dt = cmd.ExecuteDataTable();
                totalCount = Convert.ToInt32(cmd.GetParameterValue("@TotalCount"));

                ECCentral.Service.MKT.IDataAccess.ICategoryKeywordsDA keywordDA = ObjectFactory <ECCentral.Service.MKT.IDataAccess.ICategoryKeywordsDA> .Instance;
                foreach (DataRow dr in dt.Rows)
                {
                    StringBuilder str  = new StringBuilder();
                    List <string> list = keywordDA.GetKeywordsProperty(dr["PropertyKeywords"].ToString());
                    if (list != null)
                    {
                        foreach (string s in list)
                        {
                            str.Append(s).Append(' ');
                        }
                    }
                    dr["PropertyKeywords"] = str.ToString().TrimEnd(' ');
                }
                return(dt);
            }
        }
        /// <summary>
        /// 数据全部导出
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void QueryResultGrid_ExportAllClick(object sender, EventArgs e)
        {
            if (filterVM == null || this.QueryResultGrid.TotalCount < 1)
            {
                Window.Alert(ResKeywords.Information_ExportFailed);
                return;
            }
            ColumnSet col = new ColumnSet(this.QueryResultGrid);

            filter          = model.ConvertVM <CategoryKeywordsQueryVM, CategoryKeywordsQueryFilter>();
            filter.PageInfo = new ECCentral.QueryFilter.Common.PagingInfo()
            {
                PageSize  = ConstValue.MaxRowCountLimit,
                PageIndex = 0,
                SortBy    = string.Empty
            };

            //col.Insert(0, "ProductId", ResRMAReports.Excel_ProductID, 20) .SetWidth("ProductName", 30);
            facade.ExportExcelFile(filterVM, new ColumnSet[] { col });
        }
        public void ExportExcelFile(CategoryKeywordsQueryFilter filter, ColumnSet[] columns)
        {
            string relativeUrl = "/MKTService/KeywordsInfo/QueryCategoryKeywords";

            restClient.ExportFile(relativeUrl, filter, columns);
        }