Ejemplo n.º 1
0
        private void GetBrand(int?brandSysNo, string brandName)
        {
            BrandQueryFacade serviceFacade = new BrandQueryFacade(CurrentPage);
            BrandQueryFilter queryFilter   = new BrandQueryFilter();

            if (!string.IsNullOrEmpty(brandName))
            {
                queryFilter.BrandNameLocal = brandName;
            }
            if (brandSysNo.HasValue)
            {
                queryFilter.BrandSysNo = brandSysNo;
            }

            queryFilter.PagingInfo = new ECCentral.QueryFilter.Common.PagingInfo()
            {
                PageSize  = 10,
                PageIndex = 0
            };

            serviceFacade.QueryBrands(queryFilter, (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }
                var vendorList = args.Result.Rows;
                if (vendorList != null)
                {
                    List <dynamic> rows = vendorList.ToList();
                    if (rows.Count > 0)
                    {
                        var row = rows[0];
                        this.SelectedBrandSysNo = row.SysNo.ToString();
                        this.SelectedBrandName  = row.BrandName_Ch;
                        ManufacturerSysNo       = row.ManufacturerSysNo;
                        ManufacturerName        = row.ManufacturerName;
                        if (selectedBrandCompletedHandler != null)
                        {
                            EventArgs argse = new EventArgs();
                            selectedBrandCompletedHandler(obj, args);
                        }
                    }
                    else
                    {
                        txtBrandNameLocal.Text  = "";
                        txtBrandSysNo.Text      = "";
                        this.SelectedBrandSysNo = "";
                        this.SelectedBrandName  = "";
                    }
                }
                else
                {
                    txtBrandNameLocal.Text  = "";
                    txtBrandSysNo.Text      = "";
                    this.SelectedBrandSysNo = "";
                    this.SelectedBrandName  = "";
                }
            });
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 查询品牌
        /// </summary>
        /// <returns></returns>
        public virtual DataTable QueryBrand(BrandQueryFilter queryCriteria, out int totalCount)
        {
            CustomDataCommand dataCommand = DataCommandManager.CreateCustomDataCommandFromConfig("GetBrandListByQuery");

            dataCommand.SetParameterValue("@BrandName", string.IsNullOrEmpty(queryCriteria.BrandNameLocal)?null:string.Format("%{0}%", queryCriteria.BrandNameLocal));
            dataCommand.SetParameterValue("@ManufacturerName", string.IsNullOrEmpty(queryCriteria.ManufacturerName) ? null : string.Format("%{0}%", queryCriteria.ManufacturerName));
            dataCommand.SetParameterValue("@Status", queryCriteria.Status);
            dataCommand.SetParameterValue("@BrandSysNo", queryCriteria.BrandSysNo);
            dataCommand.SetParameterValue("@ManufacturerSysNo", queryCriteria.ManufacturerSysNo);
            dataCommand.SetParameterValue("@Category1SysNo", queryCriteria.Category1SysNo);
            dataCommand.SetParameterValue("@Category2SysNo", queryCriteria.Category2SysNo);
            dataCommand.SetParameterValue("@Category3SysNo", queryCriteria.Category3SysNo);
            dataCommand.SetParameterValue("@IsAuthorized", queryCriteria.IsAuthorized);
            dataCommand.SetParameterValue("@AuthorizedStatus", queryCriteria.AuthorizedStatus);
            dataCommand.SetParameterValue("@BrandStory", queryCriteria.IsBrandStory);
            dataCommand.SetParameterValue("@SortField", queryCriteria.PagingInfo.SortBy);
            dataCommand.SetParameterValue("@PageSize", queryCriteria.PagingInfo.PageSize);
            dataCommand.SetParameterValue("@PageCurrent", queryCriteria.PagingInfo.PageIndex);
            dataCommand.SetParameterValue("@Priority", queryCriteria.Priority == "" ? null : queryCriteria.Priority);
            EnumColumnList enumList = new EnumColumnList
            {
                { "Status", typeof(ValidStatus) },
            };
            DataTable dt = new DataTable();

            dt         = dataCommand.ExecuteDataTable(enumList);
            totalCount = (int)dataCommand.GetParameterValue("@TotalCount");
            return(dt);
        }
Ejemplo n.º 3
0
        public ActionResult AjaxQueryBrandList()
        {
            BrandQueryFilter qFilter = BuildQueryFilterEntity <BrandQueryFilter>();
            var result = CommonService.QueryBrandList(qFilter);

            return(AjaxGridJson(result));
        }
Ejemplo n.º 4
0
        public void QueryAllBrand(EventHandler <RestClientEventArgs <dynamic> > callback)
        {
            BrandQueryFilter filter = new BrandQueryFilter();

            filter.Status     = ValidStatus.Active;
            filter.PagingInfo = new PagingInfo
            {
                PageSize  = 100000,
                PageIndex = 0
            };

            string relativeUrl = "/IMService/Brand/QueryBrand";

            restClient_IM.QueryDynamicData(relativeUrl, filter,
                                           (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }

                if (!(args == null || args.Result == null || args.Result.Rows == null))
                {
                    foreach (var item in args.Result.Rows)
                    {
                        item.IsChecked = false;
                    }
                }
                callback(obj, args);
            }
                                           );
        }
Ejemplo n.º 5
0
        public UCBrandQuery()
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(UCBrandQuery_Loaded);

            serviceFacade = new BrandQueryFacade(CurrentPage);
            queryFilter   = new BrandQueryFilter();
        }
Ejemplo n.º 6
0
        static void Main(string[] args)
        {
            //初始化商家代理商品的数据,商家编号在appsetting的配置中
            //所有的代理级别都是原厂
            //init c3
            Console.WriteLine("init c3...");
            List <Nesoft.SellerPortal.Entity.Product.CategoryInfo> c1 = ProductMaintainService.GetAllCategory1List();
            List <Nesoft.SellerPortal.Entity.Product.CategoryInfo> c2 = new List <Nesoft.SellerPortal.Entity.Product.CategoryInfo>();
            List <Nesoft.SellerPortal.Entity.Product.CategoryInfo> c3 = new List <Nesoft.SellerPortal.Entity.Product.CategoryInfo>();

            c1.ForEach(p => c2.AddRange(ProductMaintainService.GetAllCategory2List(p.SysNo)));
            c2.ForEach(p => c3.AddRange(ProductMaintainService.GetAllCategory3List(p.SysNo)));
            Console.WriteLine("C3 total is : {0}", c3.Count);

            //init brand

            Console.WriteLine("init brand...");
            BrandQueryFilter filter = new BrandQueryFilter();

            filter.Status    = ValidStatus.Active;
            filter.PageIndex = 0;
            filter.PageSize  = 100000;

            var brands = CommonService.QueryBrandList(filter);

            Console.WriteLine("brand total is : {0}", brands.ResultList.Count);

            brands.ResultList.ForEach(b =>
            {
                c3.ForEach(c =>
                {
                    VendorAgentInfo agent = new VendorAgentInfo();
                    agent.C3SysNo         = c.SysNo;
                    agent.C3Name          = c.CategoryName;
                    //agent.C2SysNo = 10;
                    agent.AgentLevel = "原厂";
                    agent.BrandInfo  = new BrandInfo
                    {
                        SysNo          = b.SysNo,
                        BrandNameLocal = b.BrandNameLocal
                    };
                    agent.Status      = VendorAgentStatus.Draft;
                    agent.CompanyCode = "8601";

                    AppendToSeller(new List <VendorAgentInfo> {
                        agent
                    });
                });
            });

            Console.ReadKey();
        }
Ejemplo n.º 7
0
        public static QueryResult <BrandInfo> QueryBrandList(BrandQueryFilter queryFilter)
        {
            CustomDataCommand dataCommand = DataCommandManager.CreateCustomDataCommandFromConfig("GetBrandInfo");

            using (var sqlBuilder = new DynamicQuerySqlBuilder(dataCommand.CommandText, dataCommand, queryFilter, "c.SysNo DESC"))
            {
                if (queryFilter.Status.HasValue)
                {
                    if (queryFilter.Status.Value.ToString().Equals("Active"))
                    {
                        sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND,
                                                                     "c.Status",
                                                                     DbType.StringFixedLength, "@Status",
                                                                     QueryConditionOperatorType.Equal,
                                                                     "A");
                    }
                    else
                    {
                        sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND,
                                                                     "c.Status",
                                                                     DbType.StringFixedLength, "@Status",
                                                                     QueryConditionOperatorType.Equal,
                                                                     "D");
                    }
                }
                sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND,
                                                             "c.BrandName_Ch",
                                                             DbType.String, "@BrandName_Ch",
                                                             QueryConditionOperatorType.Like,
                                                             queryFilter.BrandName);
                sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND,
                                                             "m.ManufacturerName",
                                                             DbType.String, "@ManufacturerName",
                                                             QueryConditionOperatorType.Like,
                                                             queryFilter.ManufacturerName);
                dataCommand.CommandText = sqlBuilder.BuildQuerySql();
                List <BrandInfo> resultList = dataCommand.ExecuteEntityList <BrandInfo>();
                int totalCount = Convert.ToInt32(dataCommand.GetParameterValue("@TotalCount"));

                return(new QueryResult <BrandInfo>()
                {
                    PageInfo = new PageInfo()
                    {
                        PageIndex = queryFilter.PageIndex,
                        PageSize = queryFilter.PageSize,
                        TotalCount = totalCount,
                        SortBy = queryFilter.SortFields
                    },
                    ResultList = resultList
                });
            }
        }
Ejemplo n.º 8
0
        public QueryResult QueryBrandInfo(BrandQueryFilter request)
        {
            if (request == null)
            {
                throw new BizException(ResouceManager.GetMessageString("IM.Brand", "BrandCondtionIsNull"));
            }
            int totalCount;
            var dataTable = ObjectFactory <IBrandQueryDA> .Instance.QueryBrandInfo(request, out totalCount);

            return(new QueryResult()
            {
                Data = dataTable,
                TotalCount = totalCount
            });
        }
        private void btnChooseManufacturer_Click(object sender, RoutedEventArgs e)
        {
            UCManufacturerQuery selectDialog = new UCManufacturerQuery();

            selectDialog.Dialog = CPApplication.Current.CurrentPage.Context.Window.ShowDialog("查询代理厂商", selectDialog, (obj, args) =>
            {
                if (args.DialogResult == Newegg.Oversea.Silverlight.Controls.Components.DialogResultType.OK)
                {
                    DynamicXml getSelectedManufacturer = args.Data as DynamicXml;
                    if (null != getSelectedManufacturer)
                    {
                        this.SelectedManufacturerSysNo = getSelectedManufacturer["SysNo"].ToString();
                        this.SelectedManufacturerName  = getSelectedManufacturer["ManufacturerNameLocal"].ToString();

                        BrandQueryFilter requestBrand = new BrandQueryFilter()
                        {
                            ManufacturerSysNo = int.Parse(SelectedManufacturerSysNo),
                            ManufacturerName  = SelectedManufacturerName,
                            PagingInfo        = new QueryFilter.Common.PagingInfo()
                            {
                                PageIndex = 0, PageSize = 1
                            }
                        };
                        serviceFacade.QueryBrands(requestBrand, (obj2, args2) =>
                        {
                            if (args2.FaultsHandle())
                            {
                                return;
                            }
                            var brandList = args2.Result.Rows;
                            if (null != brandList)
                            {
                                try
                                {
                                    SelectedBrandSysNo = null != brandList[0]["SysNo"] ? brandList[0]["SysNo"].ToString() : string.Empty;
                                    SelectedBrandName  = brandList[0]["BrandName_Ch"];
                                }
                                catch
                                {
                                    SelectedBrandSysNo = null;
                                    SelectedBrandName  = null;
                                }
                            }
                        });
                    }
                }
            }, new Size(750, 500));
        }
Ejemplo n.º 10
0
        public UCBrandQuery(string manufacturerSysNo, string manufacuturerName)
        {
            InitializeComponent();
            this.Loaded += new RoutedEventHandler(UCBrandQuery_Loaded);

            serviceFacade = new VendorManufacturerFacade(CurrentPage);
            queryFilter   = new BrandQueryFilter();

            if (null == manufacturerSysNo || string.IsNullOrEmpty(manufacturerSysNo))
            {
                queryFilter.ManufacturerSysNo = null;
            }
            else
            {
                queryFilter.ManufacturerSysNo = int.Parse(manufacturerSysNo);
            }
            queryFilter.ManufacturerName  = (string.IsNullOrEmpty(manufacuturerName) ? string.Empty : manufacuturerName);
            this.txtManufacturerName.Text = queryFilter.ManufacturerName;
        }
Ejemplo n.º 11
0
        public DataTable QueryBrandInfo(BrandQueryFilter queryCriteria, out int totalCount)
        {
            CustomDataCommand dataCommand = DataCommandManager.CreateCustomDataCommandFromConfig("GetBrandInfo");
            var pagingInfo = new PagingInfoEntity
            {
                SortField     = queryCriteria.PagingInfo.SortBy,
                StartRowIndex = queryCriteria.PagingInfo.PageIndex * queryCriteria.PagingInfo.PageSize,
                MaximumRows   = queryCriteria.PagingInfo.PageSize
            };

            using (var sqlBuilder = new DynamicQuerySqlBuilder(dataCommand.CommandText, dataCommand, pagingInfo, "C.SysNo DESC"))
            {
                if (queryCriteria.Status != null)
                {
                    sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND,
                                                                 "C.Status",
                                                                 DbType.StringFixedLength, "@Status",
                                                                 QueryConditionOperatorType.Equal,
                                                                 queryCriteria.Status.Value);
                }
                sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND,
                                                             "c.BrandName_Ch",
                                                             DbType.String, "@BrandName_Ch",
                                                             QueryConditionOperatorType.Like,
                                                             queryCriteria.BrandNameLocal);
                sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND,
                                                             "m.ManufacturerName",
                                                             DbType.String, "@ManufacturerName",
                                                             QueryConditionOperatorType.Like,
                                                             queryCriteria.ManufacturerName);
                dataCommand.CommandText = sqlBuilder.BuildQuerySql();
                EnumColumnList enumList = new EnumColumnList
                {
                    { "Status", typeof(ValidStatus) },
                };
                DataTable dt = new DataTable();
                dt         = dataCommand.ExecuteDataTable(enumList);
                totalCount = (int)dataCommand.GetParameterValue("@TotalCount");
                return(dt);
            }
        }
Ejemplo n.º 12
0
        public void QueryBrand(EventHandler <RestClientEventArgs <dynamic> > callback)
        {
            //BrandQueryVM model = new BrandQueryVM();
            //model.Status = ValidStatus.Active;
            //model.AuthorizedStatus = AuthorizedStatus.Active;
            int              PageSize  = int.MaxValue;
            int              PageIndex = 0;
            string           SortField = "case when Brand.Priority is null then 1 else 0 end,Brand.Priority";
            BrandQueryFilter filter    = new BrandQueryFilter();

            //filter.Status = ValidStatus.Active;
            //filter.AuthorizedStatus = AuthorizedStatus.Active;
            filter.PagingInfo = new PagingInfo
            {
                PageSize  = PageSize,
                PageIndex = PageIndex,
                SortBy    = SortField
            };

            string relativeUrl = "/IMService/Brand/QueryBrand";

            restClient.QueryDynamicData(relativeUrl, filter,
                                        (obj, args) =>
            {
                if (args.FaultsHandle())
                {
                    return;
                }

                //if (!(args == null || args.Result == null || args.Result.Rows == null))
                //{
                //    foreach (var item in args.Result.Rows)
                //    {
                //        item.IsChecked = false;
                //    }
                //}
                callback(obj, args);
            }
                                        );
        }
Ejemplo n.º 13
0
 public static QueryResult <BrandInfo> QueryBrandList(BrandQueryFilter queryFilter)
 {
     return(CommonDA.QueryBrandList(queryFilter));
 }
Ejemplo n.º 14
0
 void UCBrandPicker_Loaded(object sender, RoutedEventArgs e)
 {
     serviceFacade = new BrandQueryFacade(CurrentPage);
     queryFilter   = new BrandQueryFilter();
     this.Loaded  -= UCBrandPicker_Loaded;
 }
Ejemplo n.º 15
0
        public void QueryBrands(BrandQueryFilter request, EventHandler <RestClientEventArgs <dynamic> > callback)
        {
            string relativeUrl = "/IMService/Brand/QueryBrand";

            restClient.QueryDynamicData(relativeUrl, request, callback);
        }
        private void txtManufacturerSysNo_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Enter)
            {
                int manufacturerSysNo = 0;
                if (!int.TryParse(this.txtManufacturerSysNo.Text.Trim(), out manufacturerSysNo))
                {
                    CurrentWindow.Alert("无效的厂商编号!");
                    this.SelectedManufacturerName  = null;
                    this.SelectedManufacturerSysNo = null;
                    this.txtManufacturerSysNo.Text = string.Empty;
                    return;
                }

                serviceFacade.QueryManufacturerBySysNo(manufacturerSysNo.ToString(), (obj, args) =>
                {
                    if (args.FaultsHandle())
                    {
                        return;
                    }
                    if (args.Result.ManufacturerNameLocal == null)
                    {
                        CurrentWindow.Alert("无效的厂商编号!");
                        this.SelectedManufacturerName  = null;
                        this.SelectedManufacturerSysNo = null;
                        this.txtManufacturerSysNo.Text = string.Empty;
                        return;
                    }
                    this.SelectedManufacturerSysNo = args.Result.SysNo.Value.ToString();
                    this.SelectedManufacturerName  = args.Result.ManufacturerNameLocal.Content;

                    BrandQueryFilter requestBrand = new BrandQueryFilter()
                    {
                        ManufacturerSysNo = int.Parse(SelectedManufacturerSysNo),
                        ManufacturerName  = SelectedManufacturerName,
                        PagingInfo        = new QueryFilter.Common.PagingInfo()
                        {
                            PageIndex = 0, PageSize = 1
                        }
                    };
                    serviceFacade.QueryBrands(requestBrand, (obj2, args2) =>
                    {
                        if (args2.FaultsHandle())
                        {
                            return;
                        }
                        var brandList = args2.Result.Rows;
                        if (null != brandList)
                        {
                            try
                            {
                                SelectedBrandSysNo = null != brandList[0]["SysNo"] ? brandList[0]["SysNo"].ToString() : string.Empty;
                                SelectedBrandName  = brandList[0]["BrandName_Ch"];
                            }
                            catch
                            {
                                SelectedBrandName  = null;
                                SelectedBrandSysNo = null;
                            }
                        }
                    });
                });
            }
        }