Exemplo n.º 1
0
        //public List<VendorAgentInfo> LoadVendorAgentInfoList(VendorInfo vendorInfo)
        //{
        //    DataCommand dataCommand = DataCommandManager.GetDataCommand("GetManufacturerByVendorSysNo");
        //    dataCommand.SetParameterValue("@VendorSysNo", vendorInfo.SysNo);
        //    List<VendorAgentInfo> list = dataCommand.ExecuteEntityList<VendorAgentInfo>();
        //    //反序列化SaleRules的XML
        //    list.ForEach(delegate(VendorAgentInfo agentInfo)
        //    {
        //        agentInfo.IsNeedConfirmOrder = agentInfo.IsNeedConfirmOrder ?? false;
        //        agentInfo.VendorCommissionInfo.SaleRuleEntity = new VendorStagedSaleRuleEntity();
        //        if (!string.IsNullOrEmpty(agentInfo.VendorCommissionInfo.StagedSaleRuleItemsXml))
        //        {
        //            StringReader xmlReader = new StringReader(agentInfo.VendorCommissionInfo.StagedSaleRuleItemsXml);
        //            XmlSerializer xmlSerializer = new XmlSerializer(typeof(VendorStagedSaleRuleEntity));
        //            VendorStagedSaleRuleEntity saleRuleEntity = xmlSerializer.Deserialize(xmlReader) as VendorStagedSaleRuleEntity;
        //            if (null != saleRuleEntity)
        //            {
        //                agentInfo.VendorCommissionInfo.SaleRuleEntity = saleRuleEntity;
        //            }
        //        }
        //    });
        //    return list;
        //}
        //public VendorInfo LoadVendorInfo(int vendorSysNo)
        //{
        //    VendorInfo returnVendorInfo = new VendorInfo();
        //    CustomDataCommand dataCommand = DataCommandManager.CreateCustomDataCommandFromConfig("QueryVendorbySysNoRequestRank");
        //    using (DynamicQuerySqlBuilder sqlBuilder = new DynamicQuerySqlBuilder(dataCommand.CommandText, dataCommand, null, "SysNo desc"))
        //    {
        //        sqlBuilder.ConditionConstructor.AddCondition(QueryConditionRelationType.AND, "V.SysNo",
        //        DbType.Int32, "@SysNo", QueryConditionOperatorType.Equal, vendorSysNo);
        //        dataCommand.CommandText = sqlBuilder.BuildQuerySql();
        //        returnVendorInfo = dataCommand.ExecuteEntity<VendorInfo>();

        //        return returnVendorInfo;
        //    }
        //}
        public static VendorAgentInfo CreateVendorCommissionInfo(VendorAgentInfo vendorAgentInfo, int vendorSysNo, string createUserName)
        {
            DataCommand command = DataCommandManager.GetDataCommand("CreateVendorCommissionRule");

            var sb = new StringBuilder();

            using (StringWriter sw = new StringWriter(sb))
            {
                if (vendorAgentInfo.VendorCommissionInfo != null)
                {
                    XmlSerializer xs = new XmlSerializer(typeof(VendorStagedSaleRuleEntity));
                    xs.Serialize(sw, vendorAgentInfo.VendorCommissionInfo.SaleRuleEntity);
                    command.SetParameterValue("@OrderCommissionFee", vendorAgentInfo.VendorCommissionInfo.OrderCommissionAmt);
                    command.SetParameterValue("@DeliveryFee", vendorAgentInfo.VendorCommissionInfo.DeliveryFee);
                    command.SetParameterValue("@RentFee", vendorAgentInfo.VendorCommissionInfo.RentFee);
                }
                else
                {
                    command.SetParameterValue("@OrderCommissionFee", DBNull.Value);
                    command.SetParameterValue("@DeliveryFee", DBNull.Value);
                    command.SetParameterValue("@RentFee", DBNull.Value);
                }
            }
            command.SetParameterValue("@VendorManufacturerSysNo", vendorAgentInfo.AgentSysNo);
            command.SetParameterValue("@InUser", createUserName);
            command.SetParameterValue("@EditUser", createUserName);
            command.SetParameterValue("@SalesRule", sb.ToString());
            command.SetParameterValue("@CompanyCode", vendorAgentInfo.CompanyCode);
            command.ExecuteNonQuery();
            return(vendorAgentInfo);
        }
Exemplo n.º 2
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();
        }
Exemplo n.º 3
0
        public static VendorAgentInfo UpdateVendorManufacturerInfo(VendorAgentInfo p, int sellerSysNo)
        {
            DataCommand command = DataCommandManager.GetDataCommand("UpdateVendorManufacturerInfo");

            command.SetParameterValue("@VendorSysNo", sellerSysNo);
            //command.SetParameterValue("@ManufacturerSysNo", DBNull.Value);
            command.SetParameterValue("@C2SysNo", p.C2SysNo);
            command.SetParameterValue("@AgentLevel", p.AgentLevel);
            command.SetParameterValue("@Status", p.Status);
            command.SetParameterValue("@C3SysNo", p.C3SysNo.Value);
            command.SetParameterValue("@SysNo", p.AgentSysNo.Value);
            command.SetParameterValue("@CompanyCode", p.CompanyCode);

            return(command.ExecuteEntity <VendorAgentInfo>());
        }
Exemplo n.º 4
0
        public static VendorAgentInfo CreateVendorManufacturerInfo(VendorAgentInfo vendorAgentInfo, int vendorSysNo)
        {
            DataCommand command = DataCommandManager.GetDataCommand("CreateVendorManufacturer");

            command.SetParameterValue("@VendorSysNo", vendorSysNo);
            command.SetParameterValue("@C2SysNo", vendorAgentInfo.C2SysNo);
            command.SetParameterValue("@AgentLevel", vendorAgentInfo.AgentLevel);
            command.SetParameterValue("@Status", vendorAgentInfo.Status);
            command.SetParameterValue("@C3SysNo", vendorAgentInfo.C3SysNo.Value);
            if (vendorAgentInfo.BrandInfo != null && vendorAgentInfo.BrandInfo.SysNo.HasValue)
            {
                command.SetParameterValue("@BrandSysNo", vendorAgentInfo.BrandInfo.SysNo.Value);
            }
            else
            {
                command.SetParameterValue("@BrandSysNo", DBNull.Value);
            }
            command.SetParameterValue("@CompanyCode", vendorAgentInfo.CompanyCode);

            return(command.ExecuteEntity <VendorAgentInfo>());
        }
Exemplo n.º 5
0
        //[ValidateInput(false)]
        public ActionResult AjaxSaveStoreAgentProduct()
        {
            List <VendorAgentInfo> agent = new List <VendorAgentInfo>();
            var data      = SerializationUtility.JsonDeserialize2 <List <VendorAgentInfo> >(Request.Form["data"]);
            var isRequest = bool.Parse(Request.Form["isRequest"]);

            data.ForEach(p =>
            {
                p.CompanyCode = CurrUser.CompanyCode;
                //p.Status = VendorAgentStatus.Draft;
            });
            var sellerSysNo = CurrUser.SellerSysNo;
            var sellerName  = CurrUser.SellerName;

            if (data[0].C3SysNo.HasValue && data[0].C3SysNo.Value != 0)
            {
                agent = data;
            }
            else if (data[0].C2SysNo.HasValue && data[0].C2SysNo.Value != 0)
            {
                var c3 = ProductMaintainService.GetAllCategory3List(data[0].C2SysNo.Value);
                c3.ForEach(p =>
                {
                    VendorAgentInfo temp = new VendorAgentInfo();
                    temp.AgentLevel      = data[0].AgentLevel;
                    temp.BrandInfo       = new BrandInfo
                    {
                        SysNo          = data[0].BrandInfo.SysNo,
                        BrandNameLocal = data[0].BrandInfo.BrandNameLocal
                    };
                    temp.Status      = data[0].Status;
                    temp.C2SysNo     = data[0].C2SysNo;
                    temp.C2Name      = data[0].C2Name;
                    temp.C3SysNo     = p.SysNo;
                    temp.C3Name      = p.CategoryName;
                    temp.CompanyCode = data[0].CompanyCode;
                    agent.Add(temp);
                });
                var originAgentInfo = StoreService.QueryStoreAgentInfos(sellerSysNo);
                agent.RemoveAll(p => originAgentInfo.Any(q => q.C3Name == p.C3Name &&
                                                         q.BrandInfo.SysNo == p.BrandInfo.SysNo));
            }
            else if (data[0].C1SysNo.HasValue && data[0].C1SysNo.Value != 0)
            {
                List <ECommerce.Entity.Product.CategoryInfo> c2list = ProductMaintainService.GetAllCategory2List(data[0].C1SysNo.Value);
                for (int n = 0; n < c2list.Count; n++)
                {
                    List <ECommerce.Entity.Product.CategoryInfo> c3list = ProductMaintainService.GetAllCategory3List(c2list[n].SysNo);
                    for (int i = 0; i < c3list.Count; i++)
                    {
                        VendorAgentInfo temp = new VendorAgentInfo();
                        temp.AgentLevel = data[0].AgentLevel;
                        temp.BrandInfo  = new BrandInfo {
                            SysNo = data[0].BrandInfo.SysNo, BrandNameLocal = data[0].BrandInfo.BrandNameLocal
                        };
                        temp.Status      = data[0].Status;
                        temp.C2SysNo     = data[0].C2SysNo;
                        temp.C2Name      = data[0].C2Name;
                        temp.C3SysNo     = c3list[i].SysNo;
                        temp.C3Name      = c3list[i].CategoryName;
                        temp.CompanyCode = data[0].CompanyCode;
                        agent.Add(temp);
                    }
                }

                var originAgentInfo = StoreService.QueryStoreAgentInfos(sellerSysNo);
                agent.RemoveAll(p => originAgentInfo.Any(q => q.C3Name == p.C3Name &&
                                                         q.BrandInfo.SysNo == p.BrandInfo.SysNo));
            }

            StoreService.SaveStoreAgentProduct(agent, sellerSysNo, sellerName, isRequest);
            return(Json(new { Success = true, Message = LanguageHelper.GetText("操作成功"), Data = StoreService.QueryStoreAgentInfos(CurrUser.SellerSysNo) }));
        }