/// <summary> /// 测试OrderAttribute /// </summary> /// <returns>新建的OrderAttribute对象</returns> public OrderAttribute OrderAttributeTest() { MemberOrganization oOrg = new MemberOrganization { Code = GetRandCode() }; oLiveEntities.MemberOrganizations.Add(oOrg); MemberChannel oChannel = new MemberChannel { Code = GetRandCode() }; oLiveEntities.MemberChannels.Add(oChannel); GeneralResource oGeneralResource = new GeneralResource { }; MemberRole oRole = new MemberRole { Organization = oOrg, Code = GetRandCode(), Name = oGeneralResource }; oLiveEntities.MemberRoles.Add(oRole); MemberUser oUser = new MemberUser { Organization = oOrg, Role = oRole, Channel = oChannel, LoginName = GetRandCode(), Passcode = GetRandCode(), SaltKey = "88888888" }; oLiveEntities.MemberUsers.Add(oUser); OrderInformation oOrderInformation = new OrderInformation { Organization = oOrg, Channel = oChannel, User = oUser, Code = GetRandCode() }; oLiveEntities.OrderInformations.Add(oOrderInformation); GeneralOptional oOptional = new GeneralOptional { Organization = oOrg, Code = GetRandCode() }; oLiveEntities.GeneralOptionals.Add(oOptional); OrderAttribute oAttribute = new OrderAttribute { Order = oOrderInformation, Optional = oOptional }; oLiveEntities.OrderAttributes.Add(oAttribute); oLiveEntities.SaveChanges(); return oAttribute; }
/// <summary> /// 支持数据库事务处理的更新程序段 /// </summary> public void MemberTest() { try { // 创建数据库事务 using (var scope = new TransactionScope()) { // 创建EF实体 using (var oLiveEntities = new LiveEntities(ConfigHelper.LiveConnection.Connection)) { MemberChannel oOrgan1 = new MemberChannel { Code = "Channel_C" }; MemberOrganization oOrgan2 = new MemberOrganization { Code = "Organ_C" }; oLiveEntities.MemberChannels.Add(oOrgan1); oLiveEntities.MemberOrganizations.Add(oOrgan2); // 此处,数据库中事实上没有保存 oLiveEntities.SaveChanges(); } // 提交事务,数据库物理写入 scope.Complete(); Debug.WriteLine("Submit Completed"); } } catch (TransactionAbortedException ex) { Console.WriteLine("TransactionAbortedException Message: {0}", ex.Message); } catch (ApplicationException ex) { Console.WriteLine("ApplicationException Message: {0}", ex.Message); } GC.Collect(); }
/// <summary> /// 导入组织定义 /// </summary> /// <param name="sExcelFile"></param> /// <param name="sSheetName"></param> public void ImportOrganizations(string sExcelFile, string sSheetName) { try { ExcelData oExcel = new ExcelData(sExcelFile, sSheetName); DataColumn colCode = oExcel.ExcelTable.Columns["代码"]; DataColumn colOstatus = oExcel.ExcelTable.Columns["状态"]; DataColumn colOtype = oExcel.ExcelTable.Columns["类型"]; DataColumn colExCode = oExcel.ExcelTable.Columns["扩展代码"]; DataColumn colExType = oExcel.ExcelTable.Columns["扩展类型"]; DataColumn colExTypeCode = oExcel.ExcelTable.Columns["类型代码"]; DataColumn colParent = oExcel.ExcelTable.Columns["上级"]; DataColumn colTerminal = oExcel.ExcelTable.Columns["末级"]; DataColumn colFullNameCN = oExcel.ExcelTable.Columns["中文完整名称"]; DataColumn colFullNameUS = oExcel.ExcelTable.Columns["英文完整名称"]; DataColumn colShortNameCN = oExcel.ExcelTable.Columns["中文简称"]; DataColumn colShortNameUS = oExcel.ExcelTable.Columns["英文简称"]; DataColumn colLocation = oExcel.ExcelTable.Columns["地区"]; DataColumn colFullAddress = oExcel.ExcelTable.Columns["完整地址"]; DataColumn colPostCode = oExcel.ExcelTable.Columns["邮政编码"]; DataColumn colContact = oExcel.ExcelTable.Columns["联系人"]; DataColumn colCellPhone = oExcel.ExcelTable.Columns["手机"]; DataColumn colWorkPhone = oExcel.ExcelTable.Columns["电话"]; DataColumn colWorkFax = oExcel.ExcelTable.Columns["传真"]; DataColumn colEmail = oExcel.ExcelTable.Columns["电子邮件"]; DataColumn colHomeUrl = oExcel.ExcelTable.Columns["主页"]; DataColumn colBrief = oExcel.ExcelTable.Columns["简介"]; DataColumn colIntroduction = oExcel.ExcelTable.Columns["介绍"]; DataColumn colPuPolicy = oExcel.ExcelTable.Columns["PU编码规则"]; DataColumn colSkuPolicy = oExcel.ExcelTable.Columns["SKU编码规则"]; DataColumn colBarcodePolicy = oExcel.ExcelTable.Columns["条码编码规则"]; DataColumn colRemark = oExcel.ExcelTable.Columns["备注"]; foreach (DataRow row in oExcel.ExcelTable.Rows) { string sCode = row[colCode].ToString(); byte nStatus; Byte.TryParse(row[colOstatus].ToString(), out nStatus); byte nType; Byte.TryParse(row[colOtype].ToString(), out nType); string sExCode = row[colExCode].ToString(); byte nExType; Byte.TryParse(row[colExType].ToString(), out nExType); string sExTypeCode = row[colExTypeCode].ToString(); var oExType = (from c in dbEntity.GeneralStandardCategorys where c.Ctype == nExType && c.Code == sExTypeCode select c).FirstOrDefault(); string sParent = row[colParent].ToString(); var oParent = (from m in dbEntity.MemberOrganizations where m.Code == sParent && m.Otype == (byte)ModelEnum.OrganizationType.CORPORATION select m).FirstOrDefault(); bool bLeaf = row[colTerminal].ToString() == "1" ? true : false; GeneralResource oFullName = new GeneralResource(ModelEnum.ResourceType.STRING, 2052, row[colFullNameCN].ToString(), 1033, row[colFullNameUS].ToString()); GeneralResource oShortName = new GeneralResource(ModelEnum.ResourceType.STRING, 2052, row[colShortNameCN].ToString(), 1033, row[colShortNameUS].ToString()); string sLocation = row[colLocation].ToString(); var oLocation = (from r in dbEntity.GeneralRegions where r.Code == sLocation select r).FirstOrDefault(); string sFullAddress = row[colFullAddress].ToString(); string sPostCode = row[colPostCode].ToString(); string sContact = row[colContact].ToString(); string sCellPhone = row[colCellPhone].ToString(); string sWorkPhone = row[colWorkPhone].ToString(); string sWorkFax = row[colWorkFax].ToString(); string sEmail = row[colEmail].ToString(); string sHomeUrl = row[colHomeUrl].ToString(); string sBrief = row[colBrief].ToString(); string sIntroduction = row[colIntroduction].ToString(); string sPuPolicy = row[colPuPolicy].ToString(); string sSkuPolicy = row[colSkuPolicy].ToString(); string sBarcodePolicy = row[colBarcodePolicy].ToString(); string sRemark = row[colRemark].ToString(); switch ((ModelEnum.OrganizationType)nType) { case ModelEnum.OrganizationType.CORPORATION: var oOrgan = (from o in dbEntity.MemberOrganizations where o.Code == sCode && o.Otype == nType select o).FirstOrDefault(); if (oOrgan == null) { oOrgan = new MemberOrganization { Code = sCode, Otype = nType }; dbEntity.MemberOrganizations.Add(oOrgan); } oOrgan.Ostatus = nStatus; oOrgan.ExCode = sExCode; oOrgan.ExtendType = oExType; oOrgan.Parent = oParent; oOrgan.Terminal = bLeaf; if (oOrgan.FullName == null) oOrgan.FullName = oFullName; else oOrgan.FullName.SetResource(ModelEnum.ResourceType.STRING, oFullName); if (oOrgan.ShortName == null) oOrgan.ShortName = oShortName; else oOrgan.ShortName.SetResource(ModelEnum.ResourceType.STRING, oShortName); oOrgan.Location = oLocation; oOrgan.FullAddress = sFullAddress; oOrgan.PostCode = sPostCode; oOrgan.Contact = sContact; oOrgan.CellPhone = sCellPhone; oOrgan.WorkPhone = sWorkPhone; oOrgan.WorkFax = sWorkFax; oOrgan.Email = sEmail; oOrgan.HomeUrl = sHomeUrl; oOrgan.Brief = sBrief; if (!String.IsNullOrEmpty(sIntroduction)) { if (oOrgan.Introduction == null) oOrgan.Introduction = new GeneralLargeObject(2052, sIntroduction); else oOrgan.Introduction.SetLargeObject(2052, sIntroduction); } oOrgan.ProdCodePolicy = sPuPolicy; oOrgan.SkuCodePolicy = sSkuPolicy; oOrgan.BarcodePolicy = sBarcodePolicy; oOrgan.Remark = sRemark; dbEntity.SaveChanges(); break; case ModelEnum.OrganizationType.CHANNEL: var oChannel = (from o in dbEntity.MemberChannels where o.Code == sCode && o.Otype == nType select o).FirstOrDefault(); if (oChannel == null) { oChannel = new MemberChannel { Code = sCode, Otype = nType }; dbEntity.MemberChannels.Add(oChannel); } oChannel.Ostatus = nStatus; oChannel.ExCode = sExCode; oChannel.ExtendType = oExType; oChannel.Parent = oParent; oChannel.Terminal = bLeaf; if (oChannel.FullName == null) oChannel.FullName = oFullName; else oChannel.FullName.SetResource(ModelEnum.ResourceType.STRING, oFullName); if (oChannel.ShortName == null) oChannel.ShortName = oShortName; else oChannel.ShortName.SetResource(ModelEnum.ResourceType.STRING, oShortName); oChannel.Location = oLocation; oChannel.FullAddress = sFullAddress; oChannel.PostCode = sPostCode; oChannel.Contact = sContact; oChannel.CellPhone = sCellPhone; oChannel.WorkPhone = sWorkPhone; oChannel.WorkFax = sWorkFax; oChannel.Email = sEmail; oChannel.HomeUrl = sHomeUrl; oChannel.Brief = sBrief; if (!String.IsNullOrEmpty(sIntroduction)) { if (oChannel.Introduction == null) oChannel.Introduction = new GeneralLargeObject(2052, sIntroduction); else oChannel.Introduction.SetLargeObject(2052, sIntroduction); } oChannel.ProdCodePolicy = sPuPolicy; oChannel.SkuCodePolicy = sSkuPolicy; oChannel.BarcodePolicy = sBarcodePolicy; oChannel.Remark = sRemark; dbEntity.SaveChanges(); break; case ModelEnum.OrganizationType.SHIPPER: var oShipper = (from o in dbEntity.ShippingInformations where o.Code == sCode && o.Otype == nType select o).FirstOrDefault(); if (oShipper == null) { oShipper = new ShippingInformation { Code = sCode, Otype = nType }; dbEntity.ShippingInformations.Add(oShipper); } oShipper.Ostatus = nStatus; oShipper.ExCode = sExCode; oShipper.ExtendType = oExType; oShipper.Parent = oParent; oShipper.Terminal = bLeaf; if (oShipper.FullName == null) oShipper.FullName = oFullName; else oShipper.FullName.SetResource(ModelEnum.ResourceType.STRING, oFullName); if (oShipper.ShortName == null) oShipper.ShortName = oShortName; else oShipper.ShortName.SetResource(ModelEnum.ResourceType.STRING, oShortName); oShipper.Location = oLocation; oShipper.FullAddress = sFullAddress; oShipper.PostCode = sPostCode; oShipper.Contact = sContact; oShipper.CellPhone = sCellPhone; oShipper.WorkPhone = sWorkPhone; oShipper.WorkFax = sWorkFax; oShipper.Email = sEmail; oShipper.HomeUrl = sHomeUrl; oShipper.Brief = sBrief; if (!String.IsNullOrEmpty(sIntroduction)) { if (oShipper.Introduction == null) oShipper.Introduction = new GeneralLargeObject(2052, sIntroduction); else oShipper.Introduction.SetLargeObject(2052, sIntroduction); } oShipper.ProdCodePolicy = sPuPolicy; oShipper.SkuCodePolicy = sSkuPolicy; oShipper.BarcodePolicy = sBarcodePolicy; oShipper.Remark = sRemark; dbEntity.SaveChanges(); break; case ModelEnum.OrganizationType.SUPPLIER: var oSupplier = (from o in dbEntity.PurchaseSuppliers where o.Code == sCode && o.Otype == nType select o).FirstOrDefault(); if (oSupplier == null) { oSupplier = new PurchaseSupplier { Code = sCode, Otype = nType }; dbEntity.PurchaseSuppliers.Add(oSupplier); } oSupplier.Ostatus = nStatus; oSupplier.ExCode = sExCode; oSupplier.ExtendType = oExType; oSupplier.Parent = oParent; oSupplier.Terminal = bLeaf; if (oSupplier.FullName == null) oSupplier.FullName = oFullName; else oSupplier.FullName.SetResource(ModelEnum.ResourceType.STRING, oFullName); if (oSupplier.ShortName == null) oSupplier.ShortName = oShortName; else oSupplier.ShortName.SetResource(ModelEnum.ResourceType.STRING, oShortName); oSupplier.Location = oLocation; oSupplier.FullAddress = sFullAddress; oSupplier.PostCode = sPostCode; oSupplier.Contact = sContact; oSupplier.CellPhone = sCellPhone; oSupplier.WorkPhone = sWorkPhone; oSupplier.WorkFax = sWorkFax; oSupplier.Email = sEmail; oSupplier.HomeUrl = sHomeUrl; oSupplier.Brief = sBrief; if (!String.IsNullOrEmpty(sIntroduction)) { if (oSupplier.Introduction == null) oSupplier.Introduction = new GeneralLargeObject(2052, sIntroduction); else oSupplier.Introduction.SetLargeObject(2052, sIntroduction); } oSupplier.ProdCodePolicy = sPuPolicy; oSupplier.SkuCodePolicy = sSkuPolicy; oSupplier.BarcodePolicy = sBarcodePolicy; oSupplier.Remark = sRemark; dbEntity.SaveChanges(); break; case ModelEnum.OrganizationType.WAREHOUSE: var oWarehouse = (from o in dbEntity.WarehouseInformations where o.Code == sCode && o.Otype == nType select o).FirstOrDefault(); if (oWarehouse == null) { oWarehouse = new WarehouseInformation { Code = sCode, Otype = nType }; dbEntity.WarehouseInformations.Add(oWarehouse); } oWarehouse.Ostatus = nStatus; oWarehouse.ExCode = sExCode; oWarehouse.ExtendType = oExType; oWarehouse.Parent = oParent; oWarehouse.Terminal = bLeaf; if (oWarehouse.FullName == null) oWarehouse.FullName = oFullName; else oWarehouse.FullName.SetResource(ModelEnum.ResourceType.STRING, oFullName); if (oWarehouse.ShortName == null) oWarehouse.ShortName = oShortName; else oWarehouse.ShortName.SetResource(ModelEnum.ResourceType.STRING, oShortName); oWarehouse.Location = oLocation; oWarehouse.FullAddress = sFullAddress; oWarehouse.PostCode = sPostCode; oWarehouse.Contact = sContact; oWarehouse.CellPhone = sCellPhone; oWarehouse.WorkPhone = sWorkPhone; oWarehouse.WorkFax = sWorkFax; oWarehouse.Email = sEmail; oWarehouse.HomeUrl = sHomeUrl; oWarehouse.Brief = sBrief; if (!String.IsNullOrEmpty(sIntroduction)) { if (oWarehouse.Introduction == null) oWarehouse.Introduction = new GeneralLargeObject(2052, sIntroduction); else oWarehouse.Introduction.SetLargeObject(2052, sIntroduction); } oWarehouse.ProdCodePolicy = sPuPolicy; oWarehouse.SkuCodePolicy = sSkuPolicy; oWarehouse.BarcodePolicy = sBarcodePolicy; oWarehouse.Remark = sRemark; dbEntity.SaveChanges(); break; } if (Utility.ConfigHelper.GlobalConst.IsDebug) Debug.WriteLine("{0} {1} {2}", this.ToString(), sCode, oFullName.Matter); } oEventBLL.WriteEvent(String.Format("导入MemberOrganization成功: {0} {1}", sExcelFile, sSheetName), ModelEnum.ActionLevel.GENERIC, ModelEnum.ActionSource.SYSTEM, this.ToString()); } catch (Exception ex) { oEventBLL.WriteEvent(String.Format("导入MemberOrganization错误: {0} {1} {2}", sExcelFile, sSheetName, ex.Message), ModelEnum.ActionLevel.ERROR, ModelEnum.ActionSource.SYSTEM, this.ToString()); } }
private void Test(MemberOrganization oOrgan, MemberChannel oChannel, ProductOnTemplate oTemplate, ProductInformation oProduct, List<Object> oItemList = null) { Debug.WriteLine(oOrgan.Code); Debug.WriteLine(oChannel.Code); Debug.WriteLine(oTemplate.Code); Debug.WriteLine(oProduct.Code + oProduct.Name.Matter); foreach (Dictionary<string, object> item in oItemList) { Debug.WriteLine(item["Status"].ToString()); ProductInfoItem oInfoItem = (ProductInfoItem)item["SkuItem"]; Debug.WriteLine(oInfoItem.Code + oInfoItem.FullName.Matter); GeneralMeasureUnit oUnit = (GeneralMeasureUnit)item["Unit"]; Debug.WriteLine(oUnit.Code); GeneralMeasureUnit oCurrency1 = (GeneralMeasureUnit)item["Currency1"]; if (oCurrency1 != null) Debug.WriteLine(oCurrency1.Code); } }
public static void RunOnce() { try { // 创建数据库事务 using (var scope = new TransactionScope()) { // 创建EF实体 using (var oLiveEntities = new LiveEntities(ConfigHelper.LiveConnection.Connection)) { #region GeneralConfig配置参数 GeneralConfig oConfig_System = new GeneralConfig { // 系统配置参数 Code = "SYSTEM", StrValue = "System", Remark = "一级菜单(系统配置参数)", ChildItems = new List<GeneralConfig> { // 系统启用日期 new GeneralConfig { Code = "StartDate", Ctype = (byte)ModelEnum.ConfigParamType.DATETIME, DateValue = DateTimeOffset.Now, Remark = "二级菜单(系统启用日期)" }, // 国家统计局最新行政区划 new GeneralConfig { Code = "LastRegionDefine", Ctype = (byte)ModelEnum.ConfigParamType.DATETIME, DateValue = new DateTimeOffset(2010, 12, 31, 0, 0, 0, TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now)), Remark = "最新县及县以上行政区划代码(截止2010年12月31日);http://www.stats.gov.cn/tjbz/xzqhdm/t20110726_402742468.htm" }, // Session 名称 new GeneralConfig { Code = "SessionName", StrValue = "ZhuchaoSession", Remark = "二级菜单(Session名称)" }, // Cookie 名称 new GeneralConfig { Code ="CookieName", StrValue = "ZhuchaoCookie", Remark = "二级菜单(Cookie名称)" } } }; GeneralConfig oConfig_Code = new GeneralConfig { // 代码生成器参数 Code = "CODE", StrValue = "Code", Remark = "一级菜单(代码生成器参数)", ChildItems = new List<GeneralConfig> { // 字符代码前缀 new GeneralConfig { Code = "CodePrefix_C", Ctype = (byte)ModelEnum.ConfigParamType.STRING, StrValue = "C", Remark = "二级菜单(字符代码前缀,每个数据库不一样,中国C,美国U,欧洲E)" }, // 数字代码前缀 new GeneralConfig { Code = "CodePrefix_N", Ctype = (byte)ModelEnum.ConfigParamType.STRING, StrValue = "1", Remark = "二级菜单(数字代码前缀,每个数据库不一样,中国1,美国2,欧洲3)" }, // 错误报告代码 GeneralErrorReport.Code new GeneralConfig { Code = "ErrorReportCode", Ctype = (byte)ModelEnum.ConfigParamType.INTEGER, IntValue = 0, Remark = "二级菜单(错误报告代码)" }, // 待办事项代码 GeneralTodoList.Code new GeneralConfig { Code = "TodoListCode", Ctype = (byte)ModelEnum.ConfigParamType.INTEGER, IntValue = 0, Remark = "二级菜单(待办事项代码)" }, // 采购单号 PurchaseInformation.Code new GeneralConfig { Code = "PurchaseCode", Ctype = (byte)ModelEnum.ConfigParamType.INTEGER, IntValue = 0, Remark = "二级菜单(采购单号,递增,不可跳号)" }, // 质检单号 PurchaseInspection.Code new GeneralConfig { Code ="InspectionCode", Ctype = (byte)ModelEnum.ConfigParamType.INTEGER, IntValue = 0, Remark = "二级菜单(质检单号,递增,不可跳号)" }, // 入库单号 WarehouseStockIn.Code new GeneralConfig { Code ="StockInCode", Ctype = (byte)ModelEnum.ConfigParamType.INTEGER, IntValue = 0, Remark = "二级菜单(入库单号,递增,不可跳号)" }, // 出库单号 WarehouseStockOut.Code new GeneralConfig { Code ="StockOutCode", Ctype = (byte)ModelEnum.ConfigParamType.INTEGER, IntValue = 0, Remark = "二级菜单(出库单号,递增,不可跳号)" }, // 移库单号 WarehouseMoving.Code new GeneralConfig { Code ="MovingCode", Ctype = (byte)ModelEnum.ConfigParamType.INTEGER, IntValue = 0, Remark = "二级菜单(移库单号,递增,不可跳号)" }, // 盘点单号 WarehouseInventory.Code new GeneralConfig { Code ="InventoryCode", Ctype = (byte)ModelEnum.ConfigParamType.INTEGER, IntValue = 0, Remark = "二级菜单(盘点单号,递增,不可跳号)" }, // 订单号 OrderInformation.Code new GeneralConfig { Code ="OrderCode", Ctype = (byte)ModelEnum.ConfigParamType.INTEGER, IntValue = 0, Remark = "二级菜单(订单号,递增,不可跳号)" }, // 应付单号 FinancePayment.Code new GeneralConfig { Code ="PaymentCode", Ctype = (byte)ModelEnum.ConfigParamType.INTEGER, IntValue = 0, Remark = "二级菜单(应付号,递增,不可跳号)" } } }; oLiveEntities.GeneralConfigs.Add(oConfig_System); oLiveEntities.GeneralConfigs.Add(oConfig_Code); oLiveEntities.SaveChanges(); Debug.WriteLine("LiveAzure.Models.General.InitialiseDatabase.RunOnce: GeneralConfig 配置参数"); #endregion #region GeneralStandardCategory标准分类 #region 标准组织类别 GeneralStandardCategory oStandardOrganization = new GeneralStandardCategory { Ctype = (byte)ModelEnum.StandardCategoryType.ORGANIZATION, Code = "Standard", Remark = "标准组织类型", Name = new GeneralResource { Culture = 2052, Matter = "标准组织", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Standard Organization" } } } }; #endregion #region 渠道类别 GeneralStandardCategory oChannelType01 = new GeneralStandardCategory { Ctype = (byte)ModelEnum.StandardCategoryType.CHANNEL, Code = "OfficialWeb", Remark = "官网", Name = new GeneralResource { Culture = 2052, Matter = "正式官网", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Official Website" } } } }; GeneralStandardCategory oChannelType02 = new GeneralStandardCategory { Ctype = (byte)ModelEnum.StandardCategoryType.CHANNEL, Code = "Taobao", Remark = "淘宝店,包括淘宝旗舰店和专营店等", Name = new GeneralResource { Culture = 2052, Matter = "淘宝店", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Taobao" } } } }; GeneralStandardCategory oChannelType03 = new GeneralStandardCategory { Ctype = (byte)ModelEnum.StandardCategoryType.CHANNEL, Code = "Paipai", Remark = "拍拍店", Name = new GeneralResource { Culture = 2052, Matter = "拍拍店", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Paipai" } } } }; GeneralStandardCategory oChannelType04 = new GeneralStandardCategory { Ctype = (byte)ModelEnum.StandardCategoryType.CHANNEL, Code = "Sina", Remark = "新浪商城", Name = new GeneralResource { Culture = 2052, Matter = "新浪商城", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Sina Mall" } } } }; GeneralStandardCategory oChannelType05 = new GeneralStandardCategory { Ctype = (byte)ModelEnum.StandardCategoryType.CHANNEL, Code = "tg.com.cn", Remark = "齐家网", Name = new GeneralResource { Culture = 2052, Matter = "齐家网", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Qijia" } } } }; GeneralStandardCategory oChannelType06 = new GeneralStandardCategory { Ctype = (byte)ModelEnum.StandardCategoryType.CHANNEL, Code = "360buy", Remark = "京东商城", Name = new GeneralResource { Culture = 2052, Matter = "京东商城", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "360buy" } } } }; GeneralStandardCategory oChannelType07 = new GeneralStandardCategory { Ctype = (byte)ModelEnum.StandardCategoryType.CHANNEL, Code = "dangdang", Remark = "当当网", Name = new GeneralResource { Culture = 2052, Matter = "当当网", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "dangdang" } } } }; #endregion #region 入库类型 GeneralStandardCategory oStockInType01 = new GeneralStandardCategory { Ctype = (byte)ModelEnum.StandardCategoryType.STOCKIN, Code = "PurchaseIn", Remark = "大货入库类型", Name = new GeneralResource { Culture = 2052, Matter = "大货入库", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Bulk In" } } } }; GeneralStandardCategory oStockInType02 = new GeneralStandardCategory { Ctype = (byte)ModelEnum.StandardCategoryType.STOCKIN, Code = "ReturnIn", Remark = "退货入库类型", Name = new GeneralResource { Culture = 2052, Matter = "退货入库", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Return In" } } } }; GeneralStandardCategory oStockInType03 = new GeneralStandardCategory { Ctype = (byte)ModelEnum.StandardCategoryType.STOCKIN, Code = "InventoryProfit", Remark = "盘盈入库类型", Name = new GeneralResource { Culture = 2052, Matter = "盘盈", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Inventory Profit" } } } }; GeneralStandardCategory oStockInType04 = new GeneralStandardCategory { Ctype = (byte)ModelEnum.StandardCategoryType.STOCKIN, Code = "AdjustStockIn", Remark = "调整入库类型", Name = new GeneralResource { Culture = 2052, Matter = "调整入库", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Adjust Stock In" } } } }; GeneralStandardCategory oStockInType05 = new GeneralStandardCategory { Ctype = (byte)ModelEnum.StandardCategoryType.STOCKIN, Code = "MoveIn", Remark = "移入库类型", Name = new GeneralResource { Culture = 2052, Matter = "移入库", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Move In" } } } }; #endregion #region 出库类型 GeneralStandardCategory oStockOutType01 = new GeneralStandardCategory { Ctype = (byte)ModelEnum.StandardCategoryType.STOCKOUT, Code = "Sale", Remark = "销售出库类型", Name = new GeneralResource { Culture = 2052, Matter = "销售出库", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Sale" } } } }; GeneralStandardCategory oStockOutType01b = new GeneralStandardCategory { Ctype = (byte)ModelEnum.StandardCategoryType.STOCKOUT, Code = "Resend", Remark = "销售补发货出库类型", Name = new GeneralResource { Culture = 2052, Matter = "销售补发/换货", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Resend/Change" } } } }; GeneralStandardCategory oStockOutType02 = new GeneralStandardCategory { Ctype = (byte)ModelEnum.StandardCategoryType.STOCKOUT, Code = "ReturnSupplier", Remark = "采购退货出库类型", Name = new GeneralResource { Culture = 2052, Matter = "采购退货", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Return Supplier" } } } }; GeneralStandardCategory oStockOutType03 = new GeneralStandardCategory { Ctype = (byte)ModelEnum.StandardCategoryType.STOCKOUT, Code = "Discard", Remark = "报废出库类型", Name = new GeneralResource { Culture = 2052, Matter = "报废", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Discard" } } } }; GeneralStandardCategory oStockOutType04 = new GeneralStandardCategory { Ctype = (byte)ModelEnum.StandardCategoryType.STOCKOUT, Code = "InventoryLosses", Remark = "盘亏出库类型", Name = new GeneralResource { Culture = 2052, Matter = "盘亏", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Inventory Losses" } } } }; GeneralStandardCategory oStockOutType05 = new GeneralStandardCategory { Ctype = (byte)ModelEnum.StandardCategoryType.STOCKOUT, Code = "Adjust Stock Out", Remark = "调整出库类型", Name = new GeneralResource { Culture = 2052, Matter = "调整出库", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Adjust Stock Out" } } } }; GeneralStandardCategory oStockOutType06 = new GeneralStandardCategory { Ctype = (byte)ModelEnum.StandardCategoryType.STOCKOUT, Code = "MoveOut", Remark = "移出库类型", Name = new GeneralResource { Culture = 2052, Matter = "移出库", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Move Out" } } } }; GeneralStandardCategory oStockOutType07 = new GeneralStandardCategory { Ctype = (byte)ModelEnum.StandardCategoryType.STOCKOUT, Code = "InternalUse", Remark = "内部领用出库类型", Name = new GeneralResource { Culture = 2052, Matter = "内部领用出库", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Internal Use" } } } }; #endregion oLiveEntities.GeneralStandardCategorys.Add(oStandardOrganization); oLiveEntities.GeneralStandardCategorys.Add(oChannelType01); oLiveEntities.GeneralStandardCategorys.Add(oChannelType02); oLiveEntities.GeneralStandardCategorys.Add(oChannelType03); oLiveEntities.GeneralStandardCategorys.Add(oChannelType04); oLiveEntities.GeneralStandardCategorys.Add(oChannelType05); oLiveEntities.GeneralStandardCategorys.Add(oChannelType06); oLiveEntities.GeneralStandardCategorys.Add(oChannelType07); oLiveEntities.GeneralStandardCategorys.Add(oStockInType01); oLiveEntities.GeneralStandardCategorys.Add(oStockInType02); oLiveEntities.GeneralStandardCategorys.Add(oStockInType03); oLiveEntities.GeneralStandardCategorys.Add(oStockInType04); oLiveEntities.GeneralStandardCategorys.Add(oStockInType05); oLiveEntities.GeneralStandardCategorys.Add(oStockOutType01); oLiveEntities.GeneralStandardCategorys.Add(oStockOutType01b); oLiveEntities.GeneralStandardCategorys.Add(oStockOutType02); oLiveEntities.GeneralStandardCategorys.Add(oStockOutType03); oLiveEntities.GeneralStandardCategorys.Add(oStockOutType04); oLiveEntities.GeneralStandardCategorys.Add(oStockOutType05); oLiveEntities.GeneralStandardCategorys.Add(oStockOutType06); oLiveEntities.GeneralStandardCategorys.Add(oStockOutType07); oLiveEntities.SaveChanges(); Debug.WriteLine("LiveAzure.Models.General.InitialiseDatabase.RunOnce: GeneralStandardCategory 标准分类"); #endregion #region GeneralMeasureUnit 主要计量单位 GeneralMeasureUnit oUnitPiece = new GeneralMeasureUnit { Utype = (byte)ModelEnum.MeasureUnit.PIECE, Code = "PCS", Remark = "个/件", Name = new GeneralResource { Culture = 2052, Matter = "个", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Piece" } } } }; GeneralMeasureUnit oUnitKG = new GeneralMeasureUnit { Utype = (byte)ModelEnum.MeasureUnit.WEIGHT, Code = "KG", Remark = "千克/公斤", Name = new GeneralResource { Culture = 2052, Matter = "千克", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "KG" } } } }; GeneralMeasureUnit oUnitG = new GeneralMeasureUnit { Utype = (byte)ModelEnum.MeasureUnit.WEIGHT, Code = "G", Remark = "克", Name = new GeneralResource { Culture = 2052, Matter = "克", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "G" } } } }; GeneralMeasureUnit oUnitPound = new GeneralMeasureUnit { Utype = (byte)ModelEnum.MeasureUnit.WEIGHT, Code = "Pound", Remark = "英磅", Name = new GeneralResource { Culture = 2052, Matter = "英磅", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Pound" } } } }; GeneralMeasureUnit oUnitCube = new GeneralMeasureUnit { Utype = (byte)ModelEnum.MeasureUnit.VOLUME, Code = "CUBE", Remark = "平方米", Name = new GeneralResource { Culture = 2052, Matter = "立方米", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Cube Meter" } } } }; GeneralMeasureUnit oUnitLitre = new GeneralMeasureUnit { Utype = (byte)ModelEnum.MeasureUnit.FLUID, Code = "Litre", Remark = "升", Name = new GeneralResource { Culture = 2052, Matter = "升", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Litre" } } } }; GeneralMeasureUnit oUnitGallon = new GeneralMeasureUnit { Utype = (byte)ModelEnum.MeasureUnit.FLUID, Code = "Gallon", Remark = "加仑", Name = new GeneralResource { Culture = 2052, Matter = "加仑", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Gallon" } } } }; GeneralMeasureUnit oUnitSquare = new GeneralMeasureUnit { Utype = (byte)ModelEnum.MeasureUnit.AREA, Code = "Square", Remark = "平方米", Name = new GeneralResource { Culture = 2052, Matter = "平方米", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Square Meter" } } } }; GeneralMeasureUnit oUnitSF = new GeneralMeasureUnit { Utype = (byte)ModelEnum.MeasureUnit.AREA, Code = "SF", Remark = "平方英尺", Name = new GeneralResource { Culture = 2052, Matter = "平方英尺", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Square Feet" } } } }; GeneralMeasureUnit oUnitMeter = new GeneralMeasureUnit { Utype = (byte)ModelEnum.MeasureUnit.LINEAR, Code = "Meter", Remark = "米", Name = new GeneralResource { Culture = 2052, Matter = "米", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Meter" } } } }; GeneralMeasureUnit oUnitFeet = new GeneralMeasureUnit { Utype = (byte)ModelEnum.MeasureUnit.LINEAR, Code = "Feet", Remark = "英尺", Name = new GeneralResource { Culture = 2052, Matter = "英尺", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Feet" } } } }; GeneralMeasureUnit oUnitRMB = new GeneralMeasureUnit { Utype = (byte)ModelEnum.MeasureUnit.CURRENCY, Code = (new CultureInfo("zh-CN")).NumberFormat.CurrencySymbol, Remark = "人民币", Name = new GeneralResource { Culture = 2052, Matter = "人民币", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "RMB" } } } }; GeneralMeasureUnit oUnitUSD = new GeneralMeasureUnit { Utype = (byte)ModelEnum.MeasureUnit.CURRENCY, Code = (new CultureInfo("en-US")).NumberFormat.CurrencySymbol, Remark = "美元", Name = new GeneralResource { Culture = 2052, Matter = "美元", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "USD" } } } }; GeneralMeasureUnit oUnitEUR = new GeneralMeasureUnit { Utype = (byte)ModelEnum.MeasureUnit.CURRENCY, Code = (new CultureInfo("fr-FR")).NumberFormat.CurrencySymbol, Remark = "欧元", Name = new GeneralResource { Culture = 2052, Matter = "欧元", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "EUR" } } } }; GeneralMeasureUnit oUnitGRP = new GeneralMeasureUnit { Utype = (byte)ModelEnum.MeasureUnit.CURRENCY, Code = (new CultureInfo("en-GB")).NumberFormat.CurrencySymbol, Remark = "英镑", Name = new GeneralResource { Culture = 2052, Matter = "英镑", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "GRP" } } } }; oLiveEntities.GeneralMeasureUnits.Add(oUnitPiece); oLiveEntities.GeneralMeasureUnits.Add(oUnitKG); oLiveEntities.GeneralMeasureUnits.Add(oUnitG); oLiveEntities.GeneralMeasureUnits.Add(oUnitPound); oLiveEntities.GeneralMeasureUnits.Add(oUnitCube); oLiveEntities.GeneralMeasureUnits.Add(oUnitLitre); oLiveEntities.GeneralMeasureUnits.Add(oUnitGallon); oLiveEntities.GeneralMeasureUnits.Add(oUnitSquare); oLiveEntities.GeneralMeasureUnits.Add(oUnitSF); oLiveEntities.GeneralMeasureUnits.Add(oUnitMeter); oLiveEntities.GeneralMeasureUnits.Add(oUnitFeet); oLiveEntities.GeneralMeasureUnits.Add(oUnitRMB); oLiveEntities.GeneralMeasureUnits.Add(oUnitUSD); oLiveEntities.GeneralMeasureUnits.Add(oUnitEUR); oLiveEntities.GeneralMeasureUnits.Add(oUnitGRP); oLiveEntities.SaveChanges(); Debug.WriteLine("LiveAzure.Models.General.InitialiseDatabase.RunOnce: GeneralMeasureUnit 主要计量单位"); #endregion #region GeneralCultureUnit 默认语言和计量单位 GeneralCultureUnit oCultureZHCN = new GeneralCultureUnit { // 中文(中国) Culture = 2052, // zh-CN Piece = oUnitPiece, Weight = oUnitKG, Volume = oUnitCube, Fluid = oUnitLitre, Area = oUnitSquare, Linear = oUnitMeter, Currency = oUnitRMB }; GeneralCultureUnit oCultureENUS = new GeneralCultureUnit { // 英语(美国) Culture = 1033, // en-US Piece = oUnitPiece, Weight = oUnitPound, Volume = oUnitCube, Fluid = oUnitGallon, Area = oUnitSF, Linear = oUnitFeet, Currency = oUnitUSD }; GeneralCultureUnit oCultureENGB = new GeneralCultureUnit { // 英语(英国) Culture = 2057, // en-GB Piece = oUnitPiece, Weight = oUnitPound, Volume = oUnitCube, Fluid = oUnitGallon, Area = oUnitSF, Linear = oUnitFeet, Currency = oUnitGRP }; GeneralCultureUnit oCultureFRFR = new GeneralCultureUnit { // 法文(法国) Culture = 1036, // fr-FR Piece = oUnitPiece, Weight = oUnitKG, Volume = oUnitCube, Fluid = oUnitLitre, Area = oUnitSquare, Linear = oUnitMeter, Currency = oUnitEUR }; GeneralCultureUnit oCultureDEDE = new GeneralCultureUnit { // 德文(德国) Culture = 1031, // de-DE Piece = oUnitPiece, Weight = oUnitKG, Volume = oUnitCube, Fluid = oUnitLitre, Area = oUnitSquare, Linear = oUnitMeter, Currency = oUnitEUR }; oLiveEntities.GeneralCultureUnits.Add(oCultureZHCN); oLiveEntities.GeneralCultureUnits.Add(oCultureENUS); oLiveEntities.GeneralCultureUnits.Add(oCultureENGB); oLiveEntities.GeneralCultureUnits.Add(oCultureFRFR); oLiveEntities.GeneralCultureUnits.Add(oCultureDEDE); oLiveEntities.SaveChanges(); Debug.WriteLine("LiveAzure.Models.General.InitialiseDatabase.RunOnce: GeneralCultureUnit 默认语言和计量单位"); #endregion #region 预定义第一个组织、两个渠道、第一个仓库、两个角色由触发器生成 // 第一个组织 MemberOrganization oFirstOrgan = new MemberOrganization { Code = "Zhuchao", Ostatus = (byte)ModelEnum.OrganizationStatus.VALID, ExtendType = oStandardOrganization, // 标准组织 Terminal = true, FullName = new GeneralResource { Culture = 2052, Matter = "上海筑巢信息科技有限公司", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Shanghai Zhuchao Information Technologo Co., Ltd." } } }, ShortName = new GeneralResource { Culture = 2052, Matter = "筑巢", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Zhuchao" } } }, FullAddress = "上海市嘉定区马陆镇丰功路958号", PostCode = "201801", Contact = "伯鉴", CellPhone = "13816626660", WorkPhone = "(86)21-60831660", WorkFax = "(86)21-60831657", Email = "*****@*****.**", HomeUrl = "http://www.zhuchao.com" }; // 第一个官网渠道 MemberChannel oFirstChannel = new MemberChannel { Code = "ZCWEB001", Ostatus = (byte)ModelEnum.OrganizationStatus.VALID, ExtendType = oChannelType01, // 官网 Terminal = true, FullName = new GeneralResource { Culture = 2052, Matter = "筑巢官网", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Zhuchao Website" } } }, ShortName = new GeneralResource { Culture = 2052, Matter = "筑巢官网", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Zhuchao Website" } } }, FullAddress = "上海市嘉定区马陆镇丰功路958号", PostCode = "201801", Contact = "伯鉴", CellPhone = "13816626660", WorkPhone = "(86)21-60831660", WorkFax = "(86)21-60831657", Email = "*****@*****.**", HomeUrl = "http://www.zhuchao.com" }; // 第二个淘宝专营店渠道 MemberChannel oSecondChannel = new MemberChannel { Code = "ZCTB001", Ostatus = (byte)ModelEnum.OrganizationStatus.VALID, ExtendType = oChannelType02, // 淘宝网 Terminal = true, FullName = new GeneralResource { Culture = 2052, Matter = "淘宝专营店", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Taobao 专营店" } } }, ShortName = new GeneralResource { Culture = 2052, Matter = "淘宝专营店", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Taobao 专营店" } } }, FullAddress = "上海市嘉定区马陆镇丰功路958号", PostCode = "201801", Contact = "伯鉴", CellPhone = "13816626660", WorkPhone = "(86)21-60831660", WorkFax = "(86)21-60831657", Email = "*****@*****.**", HomeUrl = "http://www.zhuchao.com.cn" }; // 组织和渠道关联 MemberOrgChannel oOrganChannel1 = new MemberOrgChannel { Organization = oFirstOrgan, Channel = oFirstChannel, Cstatus = (byte)ModelEnum.GenericStatus.VALID }; MemberOrgChannel oOrganChannel2 = new MemberOrgChannel { Organization = oFirstOrgan, Channel = oSecondChannel, Cstatus = (byte)ModelEnum.GenericStatus.VALID, // RemoteUrl = "http://gw.api.tbsandbox.com/router/rest", // 沙箱地址 RemoteUrl = "http://gw.api.taobao.com/router/rest", // 正式地址 ConfigKey = "12176743", SecretKey = "a9e366dde6816c2866e4f60af62162ca", SessionKey = "23767603b359d0623b84b6963b5507db8f6b3_1" }; // 组织支持的默认语言 MemberOrgCulture oOrganCulture01 = new MemberOrgCulture { Organization = oFirstOrgan, Ctype = (byte)ModelEnum.CultureType.LANGUAGE, Culture = oCultureZHCN }; MemberOrgCulture oOrganCulture02 = new MemberOrgCulture { Organization = oFirstOrgan, Ctype = (byte)ModelEnum.CultureType.LANGUAGE, Culture = oCultureENUS }; MemberOrgCulture oOrganCulture03 = new MemberOrgCulture { Organization = oFirstOrgan, Ctype = (byte)ModelEnum.CultureType.CURRENCY, Currency = oUnitRMB }; // 第一个仓库及其支持的渠道 WarehouseInformation oWarehouse = new WarehouseInformation { Code = "ZCWH001", Ostatus = (byte)ModelEnum.OrganizationStatus.VALID, Parent = oFirstOrgan, Terminal = true, FullName = new GeneralResource { Culture = 2052, Matter = "上海丰功路仓库", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Shanghai Fenggong Road" } } }, ShortName = new GeneralResource { Culture = 2052, Matter = "上海丰功路仓库", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Shanghai Fenggong Road" } } }, FullAddress = "上海市嘉定区马陆镇丰功路958号", PostCode = "201801", Contact = "伯鉴", CellPhone = "13816626660", WorkPhone = "(86)21-60831660", WorkFax = "(86)21-60831657", Email = "*****@*****.**", HomeUrl = "http://www.zhuchao.com", Channels = new List<MemberOrgChannel> { new MemberOrgChannel { Channel = oFirstChannel, Cstatus = (byte)ModelEnum.GenericStatus.VALID } } }; oLiveEntities.MemberOrgChannels.Add(oOrganChannel1); oLiveEntities.MemberOrgChannels.Add(oOrganChannel2); oLiveEntities.MemberOrgCultures.Add(oOrganCulture01); oLiveEntities.MemberOrgCultures.Add(oOrganCulture02); oLiveEntities.MemberOrgCultures.Add(oOrganCulture03); oLiveEntities.WarehouseInformations.Add(oWarehouse); oLiveEntities.SaveChanges(); Debug.WriteLine("LiveAzure.Models.General.InitialiseDatabase.RunOnce: 预定义第一个组织、两个渠道、第一个仓库、角色由触发器生成"); #endregion #region 管理员角色,第一个管理员用户,第一个测试用户 MemberRole oAdminRole = new MemberRole { Organization = oFirstOrgan, Code = "Supervisor", // 唯一的一个超级管理员角色,不需要任何权限 Parent = oLiveEntities.MemberRoles.Where(r => r.Code == "Internal" && r.OrgID == oFirstOrgan.Gid).FirstOrDefault(), Name = new GeneralResource { Culture = 2052, Matter = "超级管理员", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Supervisor" } } }, Remark = "超级管理员" }; // 第一个用户 MemberUser oAdminUser = new MemberUser { Organization = oFirstOrgan, Role = oAdminRole, Channel = oFirstChannel, LoginName = "admin", Ustatus = (byte)ModelEnum.UserStatus.VALID, NickName = "admin", FirstName = "System", LastName = "Admin", DisplayName = "System Admin", Culture = oCultureENUS,//天佑 Passcode = "izhuchao.com" }; //测试用户Tester 测试用 MemberUser oTester = new MemberUser { Organization = oFirstOrgan, Role = oLiveEntities.MemberRoles.Single(r => (r.OrgID == oFirstOrgan.Gid && r.Code == "Internal")), Channel = oFirstChannel, LoginName = "test", Ustatus = (byte)ModelEnum.UserStatus.VALID, NickName = "test", FirstName = "System", LastName = "Tester", DisplayName = "System Tester", Culture = oCultureZHCN, Passcode = "izhuchao.com" }; oLiveEntities.MemberUsers.Add(oAdminUser); oLiveEntities.MemberUsers.Add(oTester); oLiveEntities.SaveChanges(); Debug.WriteLine("LiveAzure.Models.General.InitialiseDatabase.RunOnce: 预定义超级管理员角色,第一个管理员和测试用户"); #endregion #region GeneralProgram 程序定义 #region 首页 GeneralProgram oProgramHome = new GeneralProgram { Code = "HomeHomePage", Parent = null, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "首页", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Home" } } }, ProgUrl = "/Home/HomePage" }; #endregion #region 系统菜单 GeneralProgram oProgramSys = new GeneralProgram { Code = "System", Parent = null, Terminal = false, Name = new GeneralResource { Culture = 2052, Matter = "系统", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "System" } } }, ProgUrl = "" }; GeneralProgram oProgramSys01 = new GeneralProgram { Code = "ConfigIndex", Parent = oProgramSys, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "配置参数", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Config Parameters" } } }, ProgUrl = "/Config/Index", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableEdit", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; GeneralProgram oProgramSys02 = new GeneralProgram { Code = "ProgramIndex", Parent = oProgramSys, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "程序定义", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Program Define" } } }, ProgUrl = "/Program/Index", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableEdit", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; GeneralProgram oProgramSys03 = new GeneralProgram { Code = "RegionIndex", Parent = oProgramSys, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "地区维护", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Region Define" } } }, ProgUrl = "/Region/Index", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableEdit", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; GeneralProgram oProgramSys04 = new GeneralProgram { Code = "CategoryIndex", Parent = oProgramSys, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "分类管理", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Category Define" } } }, ProgUrl = "/Category/Index", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableEditPrivate", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑私有分类", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit Private" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } }, new GeneralProgNode { Code = "EnableEditStandard", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑标准分类", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit Standard" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; GeneralProgram oProgramSys05 = new GeneralProgram { Code = "OptionalIndex", Parent = oProgramSys, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "属性管理", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Attribute Manage" } } }, ProgUrl = "/Optional/Index", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableEdit", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; GeneralProgram oProgramSys06 = new GeneralProgram { Code = "ConfigUnit", Parent = oProgramSys, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "计量单位", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Measure Unit" } } }, ProgUrl = "/Config/MeasureUnit", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableEdit", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; GeneralProgram oProgramSys07 = new GeneralProgram { Code = "ConfigCulture", Parent = oProgramSys, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "语言文化", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Culture Manage" } } }, ProgUrl = "/Config/Culture", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableEdit", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; GeneralProgram oProgramSys08 = new GeneralProgram { Code = "ConfigMessage", Parent = oProgramSys, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "消息队列", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Message" } } }, ProgUrl = "/Config/Message", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableSend", Name = new GeneralResource { Culture = 2052, Matter = "允许发短信", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Send" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; GeneralProgram oProgramSys11 = new GeneralProgram { Code = "ConfigErrorReport", Parent = oProgramSys, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "错误报告", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Error Report" } } }, ProgUrl = "/Config/ErrorReport" }; GeneralProgram oProgramSys12 = new GeneralProgram { Code = "ConfigAction", Parent = oProgramSys, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "事件日志", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Action Event" } } }, ProgUrl = "/Config/Action" }; GeneralProgram oProgramSys13 = new GeneralProgram { Code = "ConfigShortcut", Parent = oProgramSys, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "快捷方式", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Shortcut" } } }, ProgUrl = "/Config/Shortcut" }; #endregion #region 会员菜单 GeneralProgram oProgramMem = new GeneralProgram { Code = "Member", Parent = null, Terminal = false, Name = new GeneralResource { Culture = 2052, Matter = "会员", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Member" } } }, ProgUrl = "" }; GeneralProgram oProgramMem01 = new GeneralProgram { Code = "OrganizationIndex", Parent = oProgramMem, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "组织管理", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Organization Manage" } } }, ProgUrl = "/Organization/Index", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableEdit", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; GeneralProgram oProgramMem02 = new GeneralProgram { Code = "OrganizationChannel", Parent = oProgramMem, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "渠道管理", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Channel Manage" } } }, ProgUrl = "/Organization/ChannelIndex", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableEdit", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; GeneralProgram oProgramMem03 = new GeneralProgram { Code = "MemberRole", Parent = oProgramMem, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "角色管理", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Role Manage" } } }, ProgUrl = "/User/MemberRole", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableEdit", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; GeneralProgram oProgramMem04 = new GeneralProgram { Code = "UserIndex", Parent = oProgramMem, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "用户管理", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "User Manage" } } }, ProgUrl = "/User/Index", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableEdit", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; GeneralProgram oProgramMem05 = new GeneralProgram { Code = "UserPrivilege", Parent = oProgramMem, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "用户授权", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "User Privilege" } } }, ProgUrl = "/Privilege/Index", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableEdit", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; GeneralProgram oProgramMem06 = new GeneralProgram { Code = "UserPoint", Parent = oProgramMem, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "用户积分", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "User Point" } } }, ProgUrl = "/User/Point" }; GeneralProgram oProgramMem07 = new GeneralProgram { Code = "UserLevel", Parent = oProgramMem, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "用户级别", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "User Level" } } }, ProgUrl = "/User/Level" }; #endregion #region 商品菜单 GeneralProgram oProgramProd = new GeneralProgram { Code = "Product", Parent = null, Terminal = false, Name = new GeneralResource { Culture = 2052, Matter = "商品", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Product" } } }, ProgUrl = "" }; GeneralProgram oProgramProd01 = new GeneralProgram { Code = "ProductIndex", Parent = oProgramProd, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "商品列表", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Product List" } } }, ProgUrl = "/Product/Index", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableEdit", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; GeneralProgram oProgramProd02 = new GeneralProgram { Code = "ProductGallery", Parent = oProgramProd, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "图片处理", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Product Gallery" } } }, ProgUrl = "/Product/Gallery", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableEdit", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; GeneralProgram oProgramProd03 = new GeneralProgram { Code = "ProductImport", Parent = oProgramProd, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "批量导入", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Product Import" } } }, ProgUrl = "/Product/Import" }; GeneralProgram oProgramProd04 = new GeneralProgram { Code = "ProductValidation", Parent = oProgramProd, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "数据验证", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Product Validation" } } }, ProgUrl = "/Product/Validation" }; GeneralProgram oProgramProd05 = new GeneralProgram { Code = "OnSaleIndex", Parent = oProgramProd, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "商品上架", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Product On Sale" } } }, ProgUrl = "/Product/OnSaleIndex", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnablePrepare", Name = new GeneralResource { Culture = 2052, Matter = "允许制表(编辑)", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Prepare (Edit)" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } }, new GeneralProgNode { Code = "EnableApprove", Name = new GeneralResource { Culture = 2052, Matter = "允许确认(上架)", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Confirm (On Sale)" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; GeneralProgram oProgramProd06 = new GeneralProgram { Code = "OnSaleTemplate", Parent = oProgramProd, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "上架模板", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "On Sale Template" } } }, ProgUrl = "/Product/OnSaleTemplate", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableEdit", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; GeneralProgram oProgramProd07 = new GeneralProgram { Code = "ProductCodePolicy", Parent = oProgramProd, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "代码规则", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Code Policy" } } }, ProgUrl = "/Product/CodePolicy", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableEdit", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; #endregion #region 采购菜单 GeneralProgram oProgramPur = new GeneralProgram { Code = "Purchase", Parent = null, Terminal = false, Name = new GeneralResource { Culture = 2052, Matter = "采购", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Purchase" } } }, ProgUrl = "" }; GeneralProgram oProgramPur01 = new GeneralProgram { Code = "PurchaseIndex", Parent = oProgramPur, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "采购单据", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Purchase List" } } }, ProgUrl = "/Purchase/Index", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnablePrepare", Name = new GeneralResource { Culture = 2052, Matter = "允许制表(编辑)", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Prepare (Edit)" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } }, new GeneralProgNode { Code = "EnableApprove", Name = new GeneralResource { Culture = 2052, Matter = "允许确认", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Confirm" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } }, new GeneralProgNode { Code = "EnableClose", Name = new GeneralResource { Culture = 2052, Matter = "允许结算", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Close" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; GeneralProgram oProgramPur02 = new GeneralProgram { Code = "PurchaseQuality", Parent = oProgramPur, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "质量检查", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Quality Control" } } }, ProgUrl = "/Purchase/Quality", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableEdit", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; GeneralProgram oProgramPur03 = new GeneralProgram { Code = "OrganizationSupplier", Parent = oProgramPur, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "供应商", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Supplier" } } }, ProgUrl = "/Organization/SupplierIndex", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableEdit", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; #endregion #region 仓库菜单 GeneralProgram oProgramWh = new GeneralProgram { Code = "Warehouse", Parent = null, Terminal = false, Name = new GeneralResource { Culture = 2052, Matter = "仓库", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Warehouse" } } }, ProgUrl = "" }; GeneralProgram oProgramWh01 = new GeneralProgram { Code = "OrganizationWarehouse", Parent = oProgramWh, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "仓库列表", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Warehouse List" } } }, ProgUrl = "/Organization/WarehouseIndex", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableEdit", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; GeneralProgram oProgramWh02 = new GeneralProgram { Code = "WarehouseIndex", Parent = oProgramWh, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "库存总账", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Warehouse Ledger" } } }, ProgUrl = "/Warehouse/Index", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableEdit", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑(冻结)", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit (Lock)" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; GeneralProgram oProgramWh03 = new GeneralProgram { Code = "WarehouseStockIn", Parent = oProgramWh, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "入库记录", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Stock In" } } }, ProgUrl = "/Warehouse/StockIn", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnablePrint", Name = new GeneralResource { Culture = 2052, Matter = "允许打印", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Print" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } }, new GeneralProgNode { Code = "EnablePrepare", Name = new GeneralResource { Culture = 2052, Matter = "允许制表(编辑)", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Prepare (Edit)" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } }, new GeneralProgNode { Code = "EnableApprove", Name = new GeneralResource { Culture = 2052, Matter = "允许确认", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Confirm" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; GeneralProgram oProgramWh04 = new GeneralProgram { Code = "WarehouseStockOut", Parent = oProgramWh, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "出库记录", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Stock Out" } } }, ProgUrl = "/Warehouse/StockOut", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnablePrint", Name = new GeneralResource { Culture = 2052, Matter = "允许打印", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Print" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } }, new GeneralProgNode { Code = "EnablePrepare", Name = new GeneralResource { Culture = 2052, Matter = "允许制表(编辑)", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Prepare (Edit)" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } }, new GeneralProgNode { Code = "EnableApprove", Name = new GeneralResource { Culture = 2052, Matter = "允许确认(扫描/发货)", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Confirm (Scan/Delivery)" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } }, new GeneralProgNode { Code = "EnableSignFor", Name = new GeneralResource { Culture = 2052, Matter = "允许签收", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow SignFor" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; GeneralProgram oProgramWh05 = new GeneralProgram { Code = "WarehouseMoving", Parent = oProgramWh, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "移库申请", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Moving" } } }, ProgUrl = "/Warehouse/Moving", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnablePrepare", Name = new GeneralResource { Culture = 2052, Matter = "允许制表(编辑)", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Prepare (Edit)" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } }, new GeneralProgNode { Code = "EnableApprove", Name = new GeneralResource { Culture = 2052, Matter = "允许确认", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Confirm" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; GeneralProgram oProgramWh06 = new GeneralProgram { Code = "WarehouseInventory", Parent = oProgramWh, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "盘点记录", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Inventory" } } }, ProgUrl = "/Warehouse/Inventory", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnablePrepare", Name = new GeneralResource { Culture = 2052, Matter = "允许制表(编辑)", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Prepare (Edit)" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } }, new GeneralProgNode { Code = "EnableApprove", Name = new GeneralResource { Culture = 2052, Matter = "允许确认", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Confirm" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } }, new GeneralProgNode { Code = "EnableSnapshot", Name = new GeneralResource { Culture = 2052, Matter = "允许仓库快照", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Snapshot" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; GeneralProgram oProgramWh07 = new GeneralProgram { Code = "WarehouseShelf", Parent = oProgramWh, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "货架管理", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Warehouse Shelf" } } }, ProgUrl = "/Warehouse/Shelf", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableEditShelf", Name = new GeneralResource { Culture = 2052, Matter = "允许定义货架", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit Shelf" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } }, new GeneralProgNode { Code = "EnableEditLock", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑冻结", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit Lock" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } }, Remark = "包括WarehouseSkuShelf" }; GeneralProgram oProgramWh08 = new GeneralProgram { Code = "WarehouseRegion", Parent = oProgramWh, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "送达地区", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Support Region" } } }, ProgUrl = "/Warehouse/Region", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableEdit", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; GeneralProgram oProgramWh09 = new GeneralProgram { Code = "WarehouseShipping", Parent = oProgramWh, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "承运商", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Support Shipping" } } }, ProgUrl = "/Warehouse/Shipping", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableEdit", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; #endregion #region 订单菜单 GeneralProgram oProgramOrd = new GeneralProgram { Code = "Order", Parent = null, Terminal = false, Name = new GeneralResource { Culture = 2052, Matter = "订单", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Order" } } }, ProgUrl = "" }; GeneralProgram oProgramOrd01 = new GeneralProgram { Code = "OrderIndex", Parent = oProgramOrd, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "订单列表", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Order List" } } }, ProgUrl = "/Order/Index", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableNew", Name = new GeneralResource { Culture = 2052, Matter = "允许新建订单", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow New Order" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } }, new GeneralProgNode { Code = "EnableConfig", Name = new GeneralResource { Culture = 2052, Matter = "允许确认订单", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Confirm Order" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } }, new GeneralProgNode { Code = "EnableArrange", Name = new GeneralResource { Culture = 2052, Matter = "允许排单", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Arrange" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } }, new GeneralProgNode { Code = "EnableClose", Name = new GeneralResource { Culture = 2052, Matter = "允许结算", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Close" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } }, new GeneralProgNode { Code = "EnableCancel", Name = new GeneralResource { Culture = 2052, Matter = "允许取消", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Cancel" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } }, new GeneralProgNode { Code = "EnablePayment", Name = new GeneralResource { Culture = 2052, Matter = "允许收/付款", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Payment" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } }, new GeneralProgNode { Code = "EnableEditAddress", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑地址", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit Address" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } }, new GeneralProgNode { Code = "EnableEditPrice", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑价格", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit Price" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; GeneralProgram oProgramOrd02 = new GeneralProgram { Code = "OrderConfirm", Parent = oProgramOrd, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "订单确认", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Order Confirm" } } }, ProgUrl = "/Order/Confirm", Remark = "跳转到/Order/Index?Confirm=待确认,使用OrderIndex的权限" }; GeneralProgram oProgramOrd03 = new GeneralProgram { Code = "OrderPolicy", Parent = oProgramOrd, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "订单策略", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Order Policy" } } }, ProgUrl = "/Order/Policy", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableEdit", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } }, Remark = "包括拆单,自动处理等策略" }; GeneralProgram oProgramOrd04 = new GeneralProgram { Code = "PromotionIndex", Parent = oProgramOrd, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "促销管理", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Promotion" } } }, ProgUrl = "/Promotion/Index" }; #endregion #region 承运菜单 GeneralProgram oProgramShip = new GeneralProgram { Code = "Shipping", Parent = null, Terminal = false, Name = new GeneralResource { Culture = 2052, Matter = "承运", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Shipping" } } }, ProgUrl = "" }; GeneralProgram oProgramShip01 = new GeneralProgram { Code = "OrganizationShipper", Parent = oProgramShip, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "承运商列表", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Shipper List" } } }, ProgUrl = "/Organization/ShippingIndex", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableEdit", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; GeneralProgram oProgramShip02 = new GeneralProgram { Code = "ShippingRegion", Parent = oProgramShip, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "承运商地区", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Shipper Region" } } }, ProgUrl = "/Shipping/ShipperRegion", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableEdit", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; GeneralProgram oProgramShip03 = new GeneralProgram { Code = "ShippingIndex", Parent = oProgramShip, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "面单管理", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Shipper Envelope" } } }, ProgUrl = "/Shipping/Index", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableEdit", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; #endregion #region 财务菜单 GeneralProgram oProgramFin = new GeneralProgram { Code = "Finance", Parent = null, Terminal = false, Name = new GeneralResource { Culture = 2052, Matter = "财务", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Finance" } } }, ProgUrl = "" }; GeneralProgram oProgramFin01 = new GeneralProgram { Code = "FinanceIndex", Parent = oProgramFin, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "付款方式", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Payment Type" } } }, ProgUrl = "/Finance/Index", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableEdit", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; GeneralProgram oProgramFin02 = new GeneralProgram { Code = "FinanceInvoice", Parent = oProgramFin, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "发票管理", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Invoice" } } }, ProgUrl = "/Finance/Invoice", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableEdit", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; GeneralProgram oProgramFin03 = new GeneralProgram { Code = "FinancePayable", Parent = oProgramFin, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "应付款", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Account Payable" } } }, ProgUrl = "/Finance/Payable", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableEdit", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; #endregion #region 商城管理 GeneralProgram oProgramMall = new GeneralProgram { Code = "Mall", Parent = null, Terminal = false, Name = new GeneralResource { Culture = 2052, Matter = "商城", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Mall" } } }, ProgUrl = "" }; GeneralProgram oProgramMall01 = new GeneralProgram { Code = "MallIndex", Parent = oProgramMall, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "内容管理", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Mall Content" } } }, ProgUrl = "/Mall/Index", Remark = "包括发布", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableEdit", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; GeneralProgram oProgramMall02 = new GeneralProgram { Code = "MallPosition", Parent = oProgramMall, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "位置定义", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Art Position" } } }, ProgUrl = "/Mall/Position", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableEdit", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } } }; GeneralProgram oProgramMall03 = new GeneralProgram { Code = "MallSetting", Parent = oProgramMall, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "商城配置", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Mall Setting" } } }, ProgUrl = "/Mall/Setting", ProgramNodes = new List<GeneralProgNode> { new GeneralProgNode { Code = "EnableEdit", Name = new GeneralResource { Culture = 2052, Matter = "允许编辑", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Allow Edit" } } }, InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX, Optional = new GeneralResource { Culture = 2052, Matter = "0|否,1|是", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "0|No,1|Yes" } } } } }, Remark = "包括热门关键词,商品收藏,关注,友情链接,敏感词,黑名单等" }; GeneralProgram oProgramMall04 = new GeneralProgram { Code = "MallClick", Parent = oProgramMall, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "点击统计", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Click Statistics" } } }, ProgUrl = "/Mall/Click" }; #endregion #region 知识 GeneralProgram oProgramKnow = new GeneralProgram { Code = "Knowledge", Parent = null, Terminal = false, Name = new GeneralResource { Culture = 2052, Matter = "知识", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Knowledge" } } }, ProgUrl = "" }; #endregion #region 报表集合 GeneralProgram oProgramRpt = new GeneralProgram { Code = "Report", Parent = null, Terminal = false, Name = new GeneralResource { Culture = 2052, Matter = "报表", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Report" } } }, ProgUrl = "" }; GeneralProgram oProgramRpt01 = new GeneralProgram { Code = "ReportSales", Parent = oProgramRpt, Terminal = false, Name = new GeneralResource { Culture = 2052, Matter = "销售报表", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Sales Report" } } }, ProgUrl = "" }; GeneralProgram oProgramRpt0101 = new GeneralProgram { Code = "ReportSalesDaily", Parent = oProgramRpt01, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "日销售报表", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Sales Daily Report" } } }, ProgUrl = "/Report/Sales/Daily" }; GeneralProgram oProgramRpt02 = new GeneralProgram { Code = "ReportWarehouse", Parent = oProgramRpt, Terminal = false, Name = new GeneralResource { Culture = 2052, Matter = "库存报表", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Warehouse Report" } } }, ProgUrl = "/Report/Warehouse/Analysis" }; GeneralProgram oProgramRpt0201 = new GeneralProgram { Code = "ReportWarehouseStock", Parent = oProgramRpt02, Terminal = true, Name = new GeneralResource { Culture = 2052, Matter = "库存分析表", ResourceItems = new List<GeneralResItem> { new GeneralResItem { Culture = 1033, Matter = "Warehouse Stock" } } }, ProgUrl = "/Report/Warehouse/Analysis" }; #endregion oLiveEntities.GeneralPrograms.Add(oProgramHome); oLiveEntities.GeneralPrograms.Add(oProgramSys01); oLiveEntities.GeneralPrograms.Add(oProgramSys02); oLiveEntities.GeneralPrograms.Add(oProgramSys03); oLiveEntities.GeneralPrograms.Add(oProgramSys04); oLiveEntities.GeneralPrograms.Add(oProgramSys05); oLiveEntities.GeneralPrograms.Add(oProgramSys06); oLiveEntities.GeneralPrograms.Add(oProgramSys07); oLiveEntities.GeneralPrograms.Add(oProgramSys08); oLiveEntities.GeneralPrograms.Add(oProgramSys11); oLiveEntities.GeneralPrograms.Add(oProgramSys12); oLiveEntities.GeneralPrograms.Add(oProgramSys13); oLiveEntities.GeneralPrograms.Add(oProgramMem01); oLiveEntities.GeneralPrograms.Add(oProgramMem02); oLiveEntities.GeneralPrograms.Add(oProgramMem03); oLiveEntities.GeneralPrograms.Add(oProgramMem04); oLiveEntities.GeneralPrograms.Add(oProgramMem05); oLiveEntities.GeneralPrograms.Add(oProgramMem06); oLiveEntities.GeneralPrograms.Add(oProgramMem07); oLiveEntities.GeneralPrograms.Add(oProgramProd01); oLiveEntities.GeneralPrograms.Add(oProgramProd02); oLiveEntities.GeneralPrograms.Add(oProgramProd03); oLiveEntities.GeneralPrograms.Add(oProgramProd04); oLiveEntities.GeneralPrograms.Add(oProgramProd05); oLiveEntities.GeneralPrograms.Add(oProgramProd06); oLiveEntities.GeneralPrograms.Add(oProgramProd07); oLiveEntities.GeneralPrograms.Add(oProgramPur01); oLiveEntities.GeneralPrograms.Add(oProgramPur02); oLiveEntities.GeneralPrograms.Add(oProgramPur03); oLiveEntities.GeneralPrograms.Add(oProgramWh01); oLiveEntities.GeneralPrograms.Add(oProgramWh02); oLiveEntities.GeneralPrograms.Add(oProgramWh03); oLiveEntities.GeneralPrograms.Add(oProgramWh04); oLiveEntities.GeneralPrograms.Add(oProgramWh05); oLiveEntities.GeneralPrograms.Add(oProgramWh06); oLiveEntities.GeneralPrograms.Add(oProgramWh07); oLiveEntities.GeneralPrograms.Add(oProgramWh08); oLiveEntities.GeneralPrograms.Add(oProgramWh09); oLiveEntities.GeneralPrograms.Add(oProgramOrd01); oLiveEntities.GeneralPrograms.Add(oProgramOrd02); oLiveEntities.GeneralPrograms.Add(oProgramOrd03); oLiveEntities.GeneralPrograms.Add(oProgramOrd04); oLiveEntities.GeneralPrograms.Add(oProgramShip01); oLiveEntities.GeneralPrograms.Add(oProgramShip02); oLiveEntities.GeneralPrograms.Add(oProgramShip03); oLiveEntities.GeneralPrograms.Add(oProgramFin01); oLiveEntities.GeneralPrograms.Add(oProgramFin02); oLiveEntities.GeneralPrograms.Add(oProgramFin03); oLiveEntities.GeneralPrograms.Add(oProgramMall01); oLiveEntities.GeneralPrograms.Add(oProgramMall02); oLiveEntities.GeneralPrograms.Add(oProgramMall03); oLiveEntities.GeneralPrograms.Add(oProgramMall04); oLiveEntities.GeneralPrograms.Add(oProgramKnow); oLiveEntities.GeneralPrograms.Add(oProgramRpt0101); oLiveEntities.GeneralPrograms.Add(oProgramRpt0201); oLiveEntities.SaveChanges(); Debug.WriteLine("LiveAzure.Models.General.InitialiseDatabase.RunOnce: GeneralProgram 程序定义"); #endregion #region MemberPrivilege 权限(测试用) //用户1程序权限 MemberPrivilege oMemberPrivilegeProgram = new MemberPrivilege { User = oTester, Ptype = 0,// 0: 程序 PrivilegeItems = new List<MemberPrivItem> { new MemberPrivItem { RefID = oProgramHome.Gid }, new MemberPrivItem { RefID = oProgramSys01.Gid }, new MemberPrivItem { RefID = oProgramSys02.Gid } } }; oLiveEntities.MemberPrivileges.Add(oMemberPrivilegeProgram); oLiveEntities.SaveChanges(); Debug.WriteLine("LiveAzure.Models.General.InitialiseDatabase.RunOnce: MemberPrivilege 权限(测试用)"); #endregion } // 提交事务,数据库物理写入 scope.Complete(); } } catch (TransactionAbortedException ex) { Debug.WriteLine("LiveAzure.Models.General.InitialiseDatabase: TransactionAbortedException Message: {0}", ex.Message); } catch (ApplicationException ex) { Debug.WriteLine("LiveAzure.Models.General.InitialiseDatabase: ApplicationException Message: {0}", ex.Message); } GC.Collect(); }
/// <summary> /// 从淘宝中间表生成系统订单 /// </summary> /// <param name="organ"></param> /// <param name="channel"></param> /// <see cref=""/> /// <returns>0转换成功,数值表示失败计数</returns> public int GenerateOrderFromTaobao(MemberOrganization organ, MemberChannel channel) { string strUserPrefix = Utility.ConfigHelper.GlobalConst.GetSetting("TaobaoUserPrefix"); int nFailCount = 0; // 转换失败计数器 string strFailTids = ""; var oTbOrders = (from o in dbEntity.ExTaobaoOrders.Include("TaobaoOrderItems") where o.Transfered == false && o.status == "WAIT_SELLER_SEND_GOODS" && o.OrgID == organ.Gid && o.ChlID == channel.Gid select o).ToList(); foreach (var oTrade in oTbOrders) { try { // 创建数据库事务 using (var scope = new TransactionScope()) { string strTid = oTrade.tid.ToString(); var oOrder = (from o in dbEntity.OrderInformations where o.OrgID == organ.Gid && o.ChlID == channel.Gid && o.LinkCode == strTid select o).FirstOrDefault(); bool bSuccess = false; if (oOrder == null) { // 查询和新建用户 string strLoginName = strUserPrefix + oTrade.buyer_nick; var oUser = (from u in dbEntity.MemberUsers where u.LoginName == strLoginName select u).FirstOrDefault(); if (oUser == null) { oUser = new MemberUser { Organization = organ, Role = dbEntity.MemberRoles.Where(r => r.OrgID == organ.Gid && r.Code == "Public").FirstOrDefault(), Channel = channel, LoginName = strLoginName, Ustatus = (byte)ModelEnum.UserStatus.VALID, NickName = oTrade.buyer_nick, DisplayName = oTrade.buyer_nick, Passcode = String.IsNullOrEmpty(oTrade.receiver_mobile) ? oTrade.receiver_phone : oTrade.receiver_mobile, Culture = dbEntity.GeneralCultureUnits.Where(c => c.Culture == 2052).FirstOrDefault(), Email = oTrade.buyer_email }; } // 匹配地区 var oLocation = (from r in dbEntity.GeneralRegions where r.Code == "CHN" // 中国 select r).FirstOrDefault(); var oProvince = (from r in dbEntity.GeneralRegions where r.Parent.Code == "CHN" && (r.ShortName == oTrade.receiver_state || r.Map01 == oTrade.receiver_state) select r).FirstOrDefault(); if (oProvince != null) { oLocation = oProvince; // 匹配到省 var oCity = (from r in dbEntity.GeneralRegions where r.aParent == oProvince.Gid && (r.ShortName == oTrade.receiver_city || r.Map01 == oTrade.receiver_city) select r).FirstOrDefault(); if (oCity != null) { oLocation = oCity; // 匹配到市 var oDistrict = (from r in dbEntity.GeneralRegions where r.aParent == oCity.Gid && (r.ShortName == oTrade.receiver_district || r.Map01 == oTrade.receiver_district) select r).FirstOrDefault(); if (oDistrict != null) oLocation = oDistrict; // 匹配到区 } } // 支付方式 -- 支付宝 var oPayType = (from p in dbEntity.FinancePayTypes where p.Deleted == false && p.OrgID == organ.Gid && p.Code == "alipay" select p).FirstOrDefault(); // 货币 -- 人民币 var oCurrency = (from u in dbEntity.GeneralMeasureUnits where u.Deleted == false && u.Code == "¥" && u.Utype == (byte)ModelEnum.MeasureUnit.CURRENCY select u).FirstOrDefault(); // 创建订单主表 oOrder = new OrderInformation { Organization = organ, Channel = channel, User = oUser, LinkCode = strTid, Ostatus = (byte)ModelEnum.OrderStatus.NONE, TransType = (oTrade.type == "cod") ? (byte)ModelEnum.TransType.COD : (byte)ModelEnum.TransType.SECURED, PayType = oPayType, PayNote = oTrade.alipay_no, // Pieces = oTrade.num, Currency = oCurrency, SaleAmount = Decimal.Parse(oTrade.total_fee), // ExecuteAmount = Decimal.Parse(oTrade.payment) - Decimal.Parse(oTrade.post_fee), ShippingFee = Decimal.Parse(oTrade.post_fee), MoneyPaid = Decimal.Parse(oTrade.payment), // Differ = 0, PaidTime = new DateTimeOffset(oTrade.pay_time.Value, TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now)), Consignee = oTrade.receiver_name, Location = oLocation, FullAddress = oTrade.receiver_state + oTrade.receiver_city + oTrade.receiver_district + oTrade.receiver_address, PostCode = oTrade.receiver_zip, Telephone = oTrade.receiver_phone, Mobile = oTrade.receiver_mobile, Email = oTrade.buyer_email, PostComment = oTrade.buyer_memo, LeaveWord = oTrade.seller_memo }; // 子订单实付金额。精确到2位小数,单位:元。如:200.07,表示:200元7分。计算公式如下:payment = price * num + adjust_fee - discount_fee + post_fee // (邮费,单笔子订单时子订单实付金额包含邮费,多笔子订单时不包含邮费); // 对于退款成功的子订单,由于主订单的优惠分摊金额,会造成该字段可能不为0.00元。建议使用退款前的实付金额减去退款单中的实际退款金额计算。 bool bSingleProduct = (oTrade.TaobaoOrderItems.Count() == 1); decimal nTotalQty = 0m; // 商品总数量,标准计量单位 decimal nItemAmount = 0m; // 商品总金额 // 创建订单从表 foreach (var item in oTrade.TaobaoOrderItems) { // 先找OnSale.Code确定是否为pu-parts模式,SKU号对应不上时,必须判断转换失败 var oParts = (from s in dbEntity.ProductOnSales.Include("Product") where s.Deleted == false && s.OrgID == organ.Gid && s.ChlID == channel.Gid && s.Code == item.outer_sku_id && s.Mode == (byte)ModelEnum.ProductMode.PU_PARTS orderby s.Ostatus descending select s).FirstOrDefault(); if (oParts == null) { // PU-SKU 模式,只导入一个OnItem加入订单 var oOnSku = (from s in dbEntity.ProductOnItems.Include("SkuItem").Include("OnSale") where s.OnSale.Deleted == false && s.Deleted == false && s.OnSale.Mode == (byte)ModelEnum.ProductMode.PU_SKU && s.OnSale.OrgID == organ.Gid && s.OnSale.ChlID == channel.Gid && s.SkuItem.Code == item.outer_sku_id orderby s.OnSale.Ostatus descending, s.OnSale.CreateTime descending select s).FirstOrDefault(); var oOnPrice = (from p in dbEntity.ProductOnUnitPrices.Include("MarketPrice").Include("SalePrice") where p.Deleted == false && p.OnSkuID == oOnSku.Gid // oOnSku空,则直接到catch记录错误 orderby p.IsDefault descending, p.CreateTime descending select p).FirstOrDefault(); // 计量单位转换,进位法 decimal nQuantity = Decimal.Parse(item.num.ToString()); decimal nPercent = Decimal.Parse("1" + new string('0', oOnPrice.Percision)); nQuantity = Math.Ceiling(nQuantity * oOnPrice.UnitRatio * nPercent) / nPercent; decimal nPayment = Decimal.Parse(item.payment); // 单笔子订单时子订单实付金额包含邮费,多笔子订单时不包含邮费 if (bSingleProduct) nPayment -= oOrder.ShippingFee; OrderItem oOrderItem = new OrderItem { OnSkuItem = oOnSku, SkuItem = oOnSku.SkuItem, Name = item.title, Quantity = nQuantity, MarketPrice = oOnPrice.MarketPrice.GetResource(oOrder.Currency.Gid), SalePrice = oOnPrice.SalePrice.GetResource(oOrder.Currency.Gid), ExecutePrice = Math.Round(nPayment / nQuantity, 2), Remark = String.Format("淘宝:{0} | {1} | {2} | {3}", item.num, item.payment, item.discount_fee, item.adjust_fee) }; // 统计与误差计算 nTotalQty += nQuantity; nItemAmount += oOrderItem.ExecutePrice * nQuantity; oOrder.OrderItems.Add(oOrderItem); } else { // PU-Parts模式,需要将所有OnItem加入订单,只第一个商品有价格,其他商品价格为零 var oPartItems = (from i in dbEntity.ProductOnItems.Include("SkuItem").Include("OnSale") where i.Deleted == false && i.OnSaleID == oParts.Gid select i).ToList(); bool bIsFirst = true; decimal nQuantity = Decimal.Parse(item.num.ToString()); decimal nPayment = Decimal.Parse(item.payment); // 单笔子订单时子订单实付金额包含邮费,多笔子订单时不包含邮费 if (bSingleProduct) nPayment -= oOrder.ShippingFee; foreach (var oOnSku in oPartItems) { var oOnPrice = (from p in dbEntity.ProductOnUnitPrices.Include("MarketPrice").Include("SalePrice") where p.Deleted == false && p.OnSkuID == oOnSku.Gid // oOnSku空,则直接到catch记录错误 orderby p.IsDefault descending select p).FirstOrDefault(); // decimal nItemQty = oOnSku.SetQuantity * nQuantity; // 不使用套装数量,使用转换算法 // 计量单位转换,进位法 decimal nPercent = Decimal.Parse("1" + new string('0', oOnPrice.Percision)); decimal nItemQty = Math.Ceiling(nQuantity * oOnPrice.UnitRatio * nPercent) / nPercent; OrderItem oOrderItem = new OrderItem { OnSkuItem = oOnSku, SkuItem = oOnSku.SkuItem, Name = oOnSku.FullName.GetResource(2052), Quantity = nItemQty, MarketPrice = oOnPrice.MarketPrice.GetResource(oOrder.Currency.Gid), SalePrice = oOnPrice.SalePrice.GetResource(oOrder.Currency.Gid), ExecutePrice = (bIsFirst) ? Math.Round(nPayment / nItemQty, 2) : 0m, // 第一个商品有价格,其他商品没有价格 Remark = String.Format("淘宝:{0} | {1} | {2} | {3} | {4}", item.title, item.num, item.payment, item.discount_fee, item.adjust_fee) }; // 统计与误差计算 nTotalQty += nItemQty; nItemAmount += oOrderItem.ExecutePrice * nItemQty; oOrder.OrderItems.Add(oOrderItem); bIsFirst = false; } } } oOrder.Pieces = nTotalQty; oOrder.ExecuteAmount = nItemAmount; oOrder.Differ = oOrder.MoneyPaid - oOrder.ShippingFee - nItemAmount; // 误差 dbEntity.OrderInformations.Add(oOrder); dbEntity.SaveChanges(); // 更新淘宝订单转换成功状态 oTrade.OrderID = oOrder.Gid; oTrade.Transfered = true; dbEntity.SaveChanges(); // 创建已收款记录 FinancePayment oFinance = new FinancePayment { Organization = organ, PayTo = (byte)ModelEnum.PayDirection.TO_CORPBANK, Pstatus = (byte)ModelEnum.PayStatus.PAID, RefType = (byte)ModelEnum.NoteType.ORDER, RefID = oOrder.Gid, Reason = String.Format("支付宝:{0}", oTrade.alipay_no), PayDate = new DateTimeOffset(oTrade.pay_time.Value, TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now)), Currency = oOrder.Currency, Amount = oOrder.MoneyPaid, Remark = String.Format("淘宝订单:{0}", oTrade.tid) }; dbEntity.FinancePayments.Add(oFinance); // 索取发票 if (!String.IsNullOrEmpty(oTrade.invoice_name)) { FinanceInvoice oInvoice = new FinanceInvoice { OrderInfo = oOrder, Code = oOrder.Gid.ToString("N"), Title = oTrade.invoice_name, Amount = oOrder.MoneyPaid }; dbEntity.FinanceInvoices.Add(oInvoice); } dbEntity.SaveChanges(); bSuccess = true; } else { // TODO Warning nFailCount++; strFailTids += String.Format("{0},", oTrade.tid); } scope.Complete(); if (bSuccess) { oEventBLL.WriteEvent(String.Format("淘宝订单转换成功: {0}, {1}", oOrder.Code, oTrade.tid), ModelEnum.ActionLevel.GENERIC, ModelEnum.ActionSource.ORDER, this.ToString()); } } } catch { nFailCount++; strFailTids += String.Format("{0},", oTrade.tid); } } if (nFailCount > 0) { oEventBLL.WriteEvent(String.Format("淘宝订单转换失败: {0}", strFailTids), ModelEnum.ActionLevel.ERROR, ModelEnum.ActionSource.ORDER, this.ToString()); } return nFailCount; }
/// <summary> /// 测试ProductOnSale /// </summary> /// <returns>新建的ProductOnSale对象</returns> public ProductOnSale ProductOnSaleTest() { MemberOrganization oOrg = new MemberOrganization { Code = GetRandCode() }; oLiveEntities.MemberOrganizations.Add(oOrg); GeneralResource oName = new GeneralResource { }; oLiveEntities.GeneralResources.Add(oName); ProductInformation oProduct = new ProductInformation { Organization = oOrg, Code = GetRandCode(), Name = oName }; oLiveEntities.ProductInformations.Add(oProduct); MemberChannel oChannel = new MemberChannel { Code = GetRandCode() }; oLiveEntities.MemberChannels.Add(oChannel); GeneralResource oName2 = new GeneralResource { }; oLiveEntities.GeneralResources.Add(oName2); ProductOnSale oProductOnSale = new ProductOnSale { Product = oProduct, Channel = oChannel, Name = oName2, Code = GetRandCode() }; oLiveEntities.ProductOnSales.Add(oProductOnSale); oLiveEntities.SaveChanges(); return oProductOnSale; }
/// <summary> /// ProductOnItem /// </summary> public ProductOnItem ProductOnItemTest() { GeneralResource oResource = new GeneralResource { }; oLiveEntities.GeneralResources.Add(oResource); MemberOrganization oOrg = new MemberOrganization { Code = GetRandCode() }; oLiveEntities.MemberOrganizations.Add(oOrg); ProductInformation oProd = new ProductInformation { Code = GetRandCode(), Organization = oOrg, Name = oResource }; oLiveEntities.ProductInformations.Add(oProd); MemberChannel mChl = new MemberChannel { Code = GetRandCode() }; oLiveEntities.MemberChannels.Add(mChl); MemberOrgChannel oOChl = new MemberOrgChannel { Organization = oOrg, Channel = mChl }; oLiveEntities.MemberOrgChannels.Add(oOChl); ProductOnSale onSale = new ProductOnSale { Code = GetRandCode(), Product = oProd, Channel = mChl, Name = oResource }; oLiveEntities.ProductOnSales.Add(onSale); ProductInfoItem oSku = new ProductInfoItem { Code = GetRandCode(), Organization = oOrg, Product = oProd }; oLiveEntities.ProductInfoItems.Add(oSku); ProductOnItem oOnSku = new ProductOnItem { OnSale = onSale, SkuItem = oSku }; oLiveEntities.ProductOnItems.Add(oOnSku); oLiveEntities.SaveChanges(); return oOnSku; }
public void OrderItemTest() { ProductOnItem oSku = ProductOnItemTest(); GeneralResource res = new GeneralResource { }; oLiveEntities.GeneralResources.Add(res); MemberOrganization org = new MemberOrganization { Code = GetRandCode() }; oLiveEntities.MemberOrganizations.Add(org); MemberRole role = new MemberRole { Name = res, Code = GetRandCode(), Organization = org }; oLiveEntities.MemberRoles.Add(role); MemberChannel mChl = new MemberChannel { Code = GetRandCode() }; oLiveEntities.MemberChannels.Add(mChl); MemberUser user = new MemberUser { Organization = org, Channel = mChl, Role = role, LoginName = "*****@*****.**", Passcode = "5425425425", SaltKey = "343134" }; oLiveEntities.MemberUsers.Add(user); OrderInformation oInfo = new OrderInformation { Organization = org, Channel = mChl, Code = GetRandCode(), User = user }; oLiveEntities.OrderInformations.Add(oInfo); oLiveEntities.SaveChanges(); OrderItem oItem = new OrderItem { OnSkuID = oSku.Gid, Order = oInfo }; oLiveEntities.OrderItems.Add(oItem); oLiveEntities.SaveChanges(); }
//===================================================================== public void InsertTestData() { //res 表中添加角色 GeneralResource resRole = new GeneralResource { Code = GetRandCode(), Matter = "General User", Culture = 2052 }; oLiveEntities.GeneralResources.Add(resRole); //res 表中添加组织全名 GeneralResource resOrg = new GeneralResource { Code = GetRandCode(), Matter = "筑巢信息科技有限公司", Culture = 2052 }; oLiveEntities.GeneralResources.Add(resOrg); //res 表中添加组织简称 GeneralResource resShort = new GeneralResource { Code = GetRandCode(), Matter = "筑巢", Culture = 2052 }; oLiveEntities.GeneralResources.Add(resShort); //res 表中添加数据 GeneralResource resData = new GeneralResource { Code = GetRandCode(), Culture = 2052, Matter = "A Test" }; oLiveEntities.GeneralResources.Add(resData); GeneralResource resProg0 = new GeneralResource { Code = GetRandCode(), Culture = 2052, Matter = "Config" }; oLiveEntities.GeneralResources.Add(resProg0); //res 表中添加程序定义 GeneralResource resProg1 = new GeneralResource { Code = GetRandCode(), Matter = "generalProperty", Culture = 2052 }; oLiveEntities.GeneralResources.Add(resProg1); //res 表中添加程序定义 GeneralResource resProg2 = new GeneralResource { Code = GetRandCode(), Matter = "Units", Culture = 2052 }; oLiveEntities.GeneralResources.Add(resProg2); //res 表中添加程序定义 GeneralResource resProg3 = new GeneralResource { Code = GetRandCode(), Matter = "Classification", Culture = 2052 }; oLiveEntities.GeneralResources.Add(resProg3); //res 表中添加程序定义 GeneralResource resProg4 = new GeneralResource { Code = GetRandCode(), Matter = "Organization", Culture = 2052 }; oLiveEntities.GeneralResources.Add(resProg4); //unit表中添加数据 GeneralMeasureUnit oUnit = new GeneralMeasureUnit { Utype = 2, Code = GetRandCode(), Name = resData }; oLiveEntities.GeneralMeasureUnits.Add(oUnit); //unit表中添加数据 GeneralMeasureUnit oUnit0 = new GeneralMeasureUnit { Utype = 6, Code = GetRandCode(), Name = resData }; oLiveEntities.GeneralMeasureUnits.Add(oUnit0); //文化表中添加数据 GeneralCultureUnit culture = new GeneralCultureUnit { Piece = oUnit, Weight = oUnit0, Culture = 2052 }; oLiveEntities.GeneralCultureUnits.Add(culture); //组织表中添加数据 MemberOrganization org = new MemberOrganization { Code = GetRandCode(), FullName = resOrg, ShortName = resShort, WorkPhone = "15121040098", HomeUrl = "http://www.zhuchao.com" }; oLiveEntities.MemberOrganizations.Add(org); MemberOrganization chl = new MemberOrganization { Code = GetRandCode(), FullName = resOrg, ShortName = resShort, WorkPhone = "15121040098", HomeUrl = "http://www.zhuchao.com" }; oLiveEntities.MemberOrganizations.Add(chl); //角色表中添加数据 MemberRole role = new MemberRole { Name = resRole, Code = GetRandCode(), Organization = org }; oLiveEntities.MemberRoles.Add(role); //新建渠道 MemberChannel mChl = new MemberChannel { Code = GetRandCode(), CellPhone = "4525254254", Email = "*****@*****.**", }; oLiveEntities.MemberChannels.Add(mChl); MemberOrgChannel oChl = new MemberOrgChannel { Organization = org, Channel = mChl }; oLiveEntities.MemberOrgChannels.Add(oChl); //添加用户 MemberUser user = new MemberUser { Organization = org, Channel = mChl, Role = role, LoginName = GetRandCode() + "@qq.com", Passcode = GetRandCode() }; oLiveEntities.MemberUsers.Add(user); //添加用户 MemberUser user0 = new MemberUser { Organization = org, Channel = mChl, Role = role, LoginName = "*****@*****.**", Passcode = "123" }; oLiveEntities.MemberUsers.Add(user0); //添加程序定义 GeneralProgram prog = new GeneralProgram { Name = resProg0, Code = GetRandCode() }; oLiveEntities.GeneralPrograms.Add(prog); //添加程序定义 GeneralProgram prog0 = new GeneralProgram { Name = resProg1, Code = GetRandCode() }; oLiveEntities.GeneralPrograms.Add(prog0); //添加程序定义 GeneralProgram prog1 = new GeneralProgram { Name = resProg2, Code = GetRandCode(), Parent = prog }; oLiveEntities.GeneralPrograms.Add(prog1); //添加程序定义 GeneralProgram prog2 = new GeneralProgram { Name = resProg3, Code = GetRandCode(), Parent = prog }; oLiveEntities.GeneralPrograms.Add(prog2); //添加程序定义 GeneralProgram prog3 = new GeneralProgram { Name = resProg4, Code = GetRandCode(), Parent = prog }; oLiveEntities.GeneralPrograms.Add(prog3); //添加程序定义 GeneralProgram prog5 = new GeneralProgram { Name = resProg4, Code = GetRandCode(), Parent = prog1 }; oLiveEntities.GeneralPrograms.Add(prog5); //res 表中添加程序定义 GeneralResource resnode = new GeneralResource { Code = "resnode", Matter = "功能节点1", Culture = 2052 }; oLiveEntities.GeneralResources.Add(resProg1); GeneralResource resoptional = new GeneralResource { Code = "resnodeoption", Matter = "0|不显示,1|显示", Culture = 2052 }; oLiveEntities.GeneralResources.Add(resProg1); //添加程序功能定义 GeneralProgNode progNode = new GeneralProgNode { Program = prog, Code = "prognode", Name = resnode, Optional = resoptional, InputMode = 1 }; oLiveEntities.GeneralProgNodes.Add(progNode); oLiveEntities.SaveChanges(); //添加权限控制 MemberPrivilege prol = new MemberPrivilege { User = user0, Ptype = 0 }; oLiveEntities.MemberPrivileges.Add(prol); //添加权限控制 MemberPrivilege prol0 = new MemberPrivilege { User = user0, Ptype = 1 }; oLiveEntities.MemberPrivileges.Add(prol0); MemberPrivItem prinode = new MemberPrivItem { Privilege = prol0, RefID = progNode.Gid, NodeValue = "1" }; oLiveEntities.MemberPrivItems.Add(prinode); //添加权限控制明细 MemberPrivItem prolItem = new MemberPrivItem { Privilege = prol, RefID = prog.Gid }; oLiveEntities.MemberPrivItems.Add(prolItem); //添加权限控制明细 MemberPrivItem prolItem0 = new MemberPrivItem { Privilege = prol, RefID = prog0.Gid }; oLiveEntities.MemberPrivItems.Add(prolItem0); //添加权限控制明细 MemberPrivItem prolItem1 = new MemberPrivItem { Privilege = prol, RefID = prog1.Gid }; oLiveEntities.MemberPrivItems.Add(prolItem1); //添加权限控制明细 MemberPrivItem prolItem2 = new MemberPrivItem { Privilege = prol, RefID = prog2.Gid }; oLiveEntities.MemberPrivItems.Add(prolItem2); oLiveEntities.SaveChanges(); }
/// <summary> /// 保存组织 /// </summary> /// <param name="oOrganization"></param> public void SaveEditOrgDetail(OrganizationBase oBackModel) { if (oBackModel.Gid != Guid.Empty)//编辑保存 { OrganizationBase oOldOrganization = new OrganizationBase { FullName = NewResource(ModelEnum.ResourceType.STRING, oBackModel.aParent), ShortName = NewResource(ModelEnum.ResourceType.STRING, oBackModel.aParent) }; switch (oBackModel.Otype) { case 0: oOldOrganization = dbEntity.MemberOrganizations.Include("FullName").Include("ShortName").Where(o => o.Gid == oBackModel.Gid).FirstOrDefault(); break; case 1: oOldOrganization = dbEntity.MemberChannels.Include("FullName").Include("ShortName").Where(c => c.Gid == oBackModel.Gid).FirstOrDefault(); break; case 2: oOldOrganization = dbEntity.WarehouseInformations.Include("FullName").Include("ShortName").Where(c => c.Gid == oBackModel.Gid).FirstOrDefault(); break; case 3: oOldOrganization = dbEntity.PurchaseSuppliers.Include("FullName").Include("ShortName").Where(c => c.Gid == oBackModel.Gid).FirstOrDefault(); break; case 4: oOldOrganization = dbEntity.ShippingInformations.Include("FullName").Include("ShortName").Where(c => c.Gid == oBackModel.Gid).FirstOrDefault(); break; } oOldOrganization.FullName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.FullName); oOldOrganization.ShortName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.ShortName); oOldOrganization.Code = oBackModel.Code; oOldOrganization.ExCode = oBackModel.ExCode; oOldOrganization.Ostatus = oBackModel.Ostatus; oOldOrganization.Otype = oBackModel.Otype; oOldOrganization.ExType = oBackModel.ExType; oOldOrganization.Terminal = oBackModel.Terminal; oOldOrganization.aLocation = oBackModel.aLocation; oOldOrganization.FullAddress = oBackModel.FullAddress; oOldOrganization.PostCode = oBackModel.PostCode; oOldOrganization.Contact = oBackModel.Contact; oOldOrganization.CellPhone = oBackModel.CellPhone; oOldOrganization.WorkPhone = oBackModel.WorkPhone; oOldOrganization.WorkFax = oBackModel.WorkFax; oOldOrganization.Email = oBackModel.Email; oOldOrganization.HomeUrl = oBackModel.HomeUrl; oOldOrganization.Sorting = oBackModel.Sorting; oOldOrganization.Brief = oBackModel.Brief; oOldOrganization.Remark = oBackModel.Remark; } else//添加保存 { switch (oBackModel.Otype) { case 0: break; case 1: MemberChannel oNewMemberChannel = dbEntity.MemberChannels.Include("FullName").Include("ShortName").Where(o => o.Code == oBackModel.Code).FirstOrDefault(); if (oNewMemberChannel != null)//原来存在,则是编辑 { oNewMemberChannel.Deleted = false; oNewMemberChannel.FullName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.FullName); oNewMemberChannel.ShortName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.ShortName); //oNewMemberChannel.Code = oBackModel.Code; oNewMemberChannel.ExCode = oBackModel.ExCode; oNewMemberChannel.Ostatus = oBackModel.Ostatus; //oNewMemberChannel.Otype = oBackModel.Otype; oNewMemberChannel.ExType = oBackModel.ExType; oNewMemberChannel.Terminal = oBackModel.Terminal; oNewMemberChannel.aLocation = oBackModel.aLocation; oNewMemberChannel.FullAddress = oBackModel.FullAddress; oNewMemberChannel.PostCode = oBackModel.PostCode; oNewMemberChannel.Contact = oBackModel.Contact; oNewMemberChannel.CellPhone = oBackModel.CellPhone; oNewMemberChannel.WorkPhone = oBackModel.WorkPhone; oNewMemberChannel.WorkFax = oBackModel.WorkFax; oNewMemberChannel.Email = oBackModel.Email; oNewMemberChannel.HomeUrl = oBackModel.HomeUrl; oNewMemberChannel.Sorting = oBackModel.Sorting; oNewMemberChannel.Brief = oBackModel.Brief; oNewMemberChannel.Remark = oBackModel.Remark; } else { oNewMemberChannel = new MemberChannel { FullName = NewResource(ModelEnum.ResourceType.STRING), ShortName = NewResource(ModelEnum.ResourceType.STRING) }; oNewMemberChannel.FullName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.FullName); oNewMemberChannel.ShortName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.ShortName); oNewMemberChannel.Code = oBackModel.Code; oNewMemberChannel.ExCode = oBackModel.ExCode; oNewMemberChannel.Ostatus = oBackModel.Ostatus; oNewMemberChannel.Otype = oBackModel.Otype; oNewMemberChannel.ExType = oBackModel.ExType; oNewMemberChannel.Terminal = oBackModel.Terminal; oNewMemberChannel.aLocation = oBackModel.aLocation; oNewMemberChannel.FullAddress = oBackModel.FullAddress; oNewMemberChannel.PostCode = oBackModel.PostCode; oNewMemberChannel.Contact = oBackModel.Contact; oNewMemberChannel.CellPhone = oBackModel.CellPhone; oNewMemberChannel.WorkPhone = oBackModel.WorkPhone; oNewMemberChannel.WorkFax = oBackModel.WorkFax; oNewMemberChannel.Email = oBackModel.Email; oNewMemberChannel.HomeUrl = oBackModel.HomeUrl; oNewMemberChannel.Sorting = oBackModel.Sorting; oNewMemberChannel.Brief = oBackModel.Brief; oNewMemberChannel.Remark = oBackModel.Remark; dbEntity.MemberChannels.Add(oNewMemberChannel); } break; case 2: WarehouseInformation oNewWarehouse = dbEntity.WarehouseInformations.Include("FullName").Include("ShortName").Where(w => w.Code == oBackModel.Code).FirstOrDefault(); if (oNewWarehouse != null) { oNewWarehouse.Deleted = false; oNewWarehouse.FullName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.FullName); oNewWarehouse.ShortName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.ShortName); //oNewWarehouse.aParent = oBackModel.aParent; //oNewWarehouse.Code = oBackModel.Code; oNewWarehouse.ExCode = oBackModel.ExCode; oNewWarehouse.Ostatus = oBackModel.Ostatus; //oNewWarehouse.Otype = oBackModel.Otype; oNewWarehouse.ExType = oBackModel.ExType; oNewWarehouse.Terminal = oBackModel.Terminal; oNewWarehouse.aLocation = oBackModel.aLocation; oNewWarehouse.FullAddress = oBackModel.FullAddress; oNewWarehouse.PostCode = oBackModel.PostCode; oNewWarehouse.Contact = oBackModel.Contact; oNewWarehouse.CellPhone = oBackModel.CellPhone; oNewWarehouse.WorkPhone = oBackModel.WorkPhone; oNewWarehouse.WorkFax = oBackModel.WorkFax; oNewWarehouse.Email = oBackModel.Email; oNewWarehouse.HomeUrl = oBackModel.HomeUrl; oNewWarehouse.Sorting = oBackModel.Sorting; oNewWarehouse.Brief = oBackModel.Brief; oNewWarehouse.Remark = oBackModel.Remark; } else { oNewWarehouse = new WarehouseInformation { FullName = NewResource(ModelEnum.ResourceType.STRING, oBackModel.aParent), ShortName = NewResource(ModelEnum.ResourceType.STRING, oBackModel.aParent) }; oNewWarehouse.FullName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.FullName); oNewWarehouse.ShortName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.ShortName); oNewWarehouse.aParent = oBackModel.aParent; oNewWarehouse.Code = oBackModel.Code; oNewWarehouse.ExCode = oBackModel.ExCode; oNewWarehouse.Ostatus = oBackModel.Ostatus; oNewWarehouse.Otype = oBackModel.Otype; oNewWarehouse.ExType = oBackModel.ExType; oNewWarehouse.Terminal = oBackModel.Terminal; oNewWarehouse.aLocation = oBackModel.aLocation; oNewWarehouse.FullAddress = oBackModel.FullAddress; oNewWarehouse.PostCode = oBackModel.PostCode; oNewWarehouse.Contact = oBackModel.Contact; oNewWarehouse.CellPhone = oBackModel.CellPhone; oNewWarehouse.WorkPhone = oBackModel.WorkPhone; oNewWarehouse.WorkFax = oBackModel.WorkFax; oNewWarehouse.Email = oBackModel.Email; oNewWarehouse.HomeUrl = oBackModel.HomeUrl; oNewWarehouse.Sorting = oBackModel.Sorting; oNewWarehouse.Brief = oBackModel.Brief; oNewWarehouse.Remark = oBackModel.Remark; dbEntity.WarehouseInformations.Add(oNewWarehouse); } break; case 3: PurchaseSupplier oNewPurchaseSupplier = dbEntity.PurchaseSuppliers.Include("FullName").Include("ShortName").Where(s => s.Code == oBackModel.Code).FirstOrDefault(); if (oNewPurchaseSupplier != null) { oNewPurchaseSupplier.Deleted = false; oNewPurchaseSupplier.FullName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.FullName); oNewPurchaseSupplier.ShortName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.ShortName); //oNewPurchaseSupplier.aParent = oBackModel.aParent; //oNewPurchaseSupplier.Code = oBackModel.Code; oNewPurchaseSupplier.ExCode = oBackModel.ExCode; oNewPurchaseSupplier.Ostatus = oBackModel.Ostatus; //oNewPurchaseSupplier.Otype = oBackModel.Otype; oNewPurchaseSupplier.ExType = oBackModel.ExType; oNewPurchaseSupplier.Terminal = oBackModel.Terminal; oNewPurchaseSupplier.aLocation = oBackModel.aLocation; oNewPurchaseSupplier.FullAddress = oBackModel.FullAddress; oNewPurchaseSupplier.PostCode = oBackModel.PostCode; oNewPurchaseSupplier.Contact = oBackModel.Contact; oNewPurchaseSupplier.CellPhone = oBackModel.CellPhone; oNewPurchaseSupplier.WorkPhone = oBackModel.WorkPhone; oNewPurchaseSupplier.WorkFax = oBackModel.WorkFax; oNewPurchaseSupplier.Email = oBackModel.Email; oNewPurchaseSupplier.HomeUrl = oBackModel.HomeUrl; oNewPurchaseSupplier.Sorting = oBackModel.Sorting; oNewPurchaseSupplier.Brief = oBackModel.Brief; oNewPurchaseSupplier.Remark = oBackModel.Remark; } else { oNewPurchaseSupplier = new PurchaseSupplier { FullName = NewResource(ModelEnum.ResourceType.STRING, oBackModel.aParent), ShortName = NewResource(ModelEnum.ResourceType.STRING, oBackModel.aParent) }; oNewPurchaseSupplier.FullName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.FullName); oNewPurchaseSupplier.ShortName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.ShortName); oNewPurchaseSupplier.aParent = oBackModel.aParent; oNewPurchaseSupplier.Code = oBackModel.Code; oNewPurchaseSupplier.ExCode = oBackModel.ExCode; oNewPurchaseSupplier.Ostatus = oBackModel.Ostatus; oNewPurchaseSupplier.Otype = oBackModel.Otype; oNewPurchaseSupplier.ExType = oBackModel.ExType; oNewPurchaseSupplier.Terminal = oBackModel.Terminal; oNewPurchaseSupplier.aLocation = oBackModel.aLocation; oNewPurchaseSupplier.FullAddress = oBackModel.FullAddress; oNewPurchaseSupplier.PostCode = oBackModel.PostCode; oNewPurchaseSupplier.Contact = oBackModel.Contact; oNewPurchaseSupplier.CellPhone = oBackModel.CellPhone; oNewPurchaseSupplier.WorkPhone = oBackModel.WorkPhone; oNewPurchaseSupplier.WorkFax = oBackModel.WorkFax; oNewPurchaseSupplier.Email = oBackModel.Email; oNewPurchaseSupplier.HomeUrl = oBackModel.HomeUrl; oNewPurchaseSupplier.Sorting = oBackModel.Sorting; oNewPurchaseSupplier.Brief = oBackModel.Brief; oNewPurchaseSupplier.Remark = oBackModel.Remark; dbEntity.PurchaseSuppliers.Add(oNewPurchaseSupplier); } break; case 4: ShippingInformation oNewShippingInformations = dbEntity.ShippingInformations.Include("FullName").Include("ShortName").Where(s => s.Code == oBackModel.Code).FirstOrDefault(); if (oNewShippingInformations != null) { oNewShippingInformations.Deleted = false; oNewShippingInformations.FullName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.FullName); oNewShippingInformations.ShortName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.ShortName); //oNewShippingInformations.aParent = oBackModel.aParent; //oNewShippingInformations.Code = oBackModel.Code; oNewShippingInformations.ExCode = oBackModel.ExCode; oNewShippingInformations.Ostatus = oBackModel.Ostatus; //oNewShippingInformations.Otype = oBackModel.Otype; oNewShippingInformations.ExType = oBackModel.ExType; oNewShippingInformations.Terminal = oBackModel.Terminal; oNewShippingInformations.aLocation = oBackModel.aLocation; oNewShippingInformations.FullAddress = oBackModel.FullAddress; oNewShippingInformations.PostCode = oBackModel.PostCode; oNewShippingInformations.Contact = oBackModel.Contact; oNewShippingInformations.CellPhone = oBackModel.CellPhone; oNewShippingInformations.WorkPhone = oBackModel.WorkPhone; oNewShippingInformations.WorkFax = oBackModel.WorkFax; oNewShippingInformations.Email = oBackModel.Email; oNewShippingInformations.HomeUrl = oBackModel.HomeUrl; oNewShippingInformations.Sorting = oBackModel.Sorting; oNewShippingInformations.Brief = oBackModel.Brief; oNewShippingInformations.Remark = oBackModel.Remark; } else { oNewShippingInformations = new ShippingInformation { FullName = NewResource(ModelEnum.ResourceType.STRING, oBackModel.aParent), ShortName = NewResource(ModelEnum.ResourceType.STRING, oBackModel.aParent) }; oNewShippingInformations.FullName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.FullName); oNewShippingInformations.ShortName.SetResource(ModelEnum.ResourceType.STRING, oBackModel.ShortName); oNewShippingInformations.aParent = oBackModel.aParent; oNewShippingInformations.Code = oBackModel.Code; oNewShippingInformations.ExCode = oBackModel.ExCode; oNewShippingInformations.Ostatus = oBackModel.Ostatus; oNewShippingInformations.Otype = oBackModel.Otype; oNewShippingInformations.ExType = oBackModel.ExType; oNewShippingInformations.Terminal = oBackModel.Terminal; oNewShippingInformations.aLocation = oBackModel.aLocation; oNewShippingInformations.FullAddress = oBackModel.FullAddress; oNewShippingInformations.PostCode = oBackModel.PostCode; oNewShippingInformations.Contact = oBackModel.Contact; oNewShippingInformations.CellPhone = oBackModel.CellPhone; oNewShippingInformations.WorkPhone = oBackModel.WorkPhone; oNewShippingInformations.WorkFax = oBackModel.WorkFax; oNewShippingInformations.Email = oBackModel.Email; oNewShippingInformations.HomeUrl = oBackModel.HomeUrl; oNewShippingInformations.Sorting = oBackModel.Sorting; oNewShippingInformations.Brief = oBackModel.Brief; oNewShippingInformations.Remark = oBackModel.Remark; dbEntity.ShippingInformations.Add(oNewShippingInformations); } break; } } dbEntity.SaveChanges(); }
public string ProductTemplateOnSale(MemberOrganization oOrgan, MemberChannel oChannel, ProductOnTemplate oTemplate, ProductInformation oProduct, List<Object> oItemList = null) { //判断是否存在SKU列表,如果不存在SKU列表,则只添加产品上架相关的信息; //否则既添加产品上架信息,还要添加SKU上架表的信息。 ProductOnSale oProductOnsale; Guid currentOnsaleGid; Guid productGid = oProduct.Gid; Guid onSaleChID = oChannel.Gid; Guid onSaleOrgID = oOrgan.Gid; //ProductInformation oProduct = dbEntity.ProductInformations.Include("SkuItems").Where(p => p.Gid == productGid && p.Deleted == false).FirstOrDefault(); String productOnsaleCode = oProduct.Code; ProductOnSale productOnsale = dbEntity.ProductOnSales.Where(p => p.ProdID == productGid && p.ChlID == onSaleChID && p.Code == productOnsaleCode).FirstOrDefault(); //为新上架商品 if (productOnsale == null) { oProductOnsale = new ProductOnSale(); #region 模板上架ProductOnsale表信息添加 oProductOnsale.ProdID = productGid; oProductOnsale.OrgID = onSaleChID; oProductOnsale.ChlID = onSaleChID; oProductOnsale.Code = productOnsaleCode; oProductOnsale.Ostatus = 1; oProductOnsale.aName = (Guid)oProduct.aName; oProductOnsale.Mode = oProduct.Mode; //=====市场价以及销售价====== //========================= //oProductOnsale.CanSplit = oProduct.Block; oProductOnsale.aBrief = oProduct.aBrief; oProductOnsale.aMatter = oProduct.aMatter; dbEntity.ProductOnSales.Add(oProductOnsale); dbEntity.SaveChanges(); //当前上架商品的OnsaleID currentOnsaleGid = oProductOnsale.Gid; #endregion #region 模板上架ProductOnItems表信息添加 Guid marketPriceGid; Guid salePriceGid; //保存SKU的信息,如果存在SKU if (oItemList != null) { foreach (Dictionary<string, object> item in oItemList) { //保存进入ProductOnItem表 ProductInfoItem oInfoItem = (ProductInfoItem)item["SkuItem"]; ProductOnItem oNewProductItem = new ProductOnItem(); oNewProductItem.OnSaleID = currentOnsaleGid; oNewProductItem.SkuID = oInfoItem.Gid; oNewProductItem.aFullName = oInfoItem.aFullName; oNewProductItem.aShortName = oInfoItem.aShortName; dbEntity.ProductOnItems.Add(oNewProductItem); dbEntity.SaveChanges(); //获取当前保存的OnSKUID Guid currentOnSKUGid = oNewProductItem.Gid; GeneralMeasureUnit oUnit = (GeneralMeasureUnit)item["Unit"]; Guid currentUnitGid = oUnit.Gid; GeneralMeasureUnit oCurrency1 = (GeneralMeasureUnit)item["Currency1"]; //第一个价格不存在则认为添加失败 if (oCurrency1 != null) { GeneralResource oMarketCash = new GeneralResource(); oMarketCash.Rtype = (byte)ModelEnum.ResourceType.MONEY; oMarketCash.Currency = oCurrency1.Gid; oMarketCash.Cash = (decimal)item["MarketPrice1"]; GeneralResource oSaleCash = new GeneralResource(); oSaleCash.Rtype = (byte)ModelEnum.ResourceType.MONEY; oSaleCash.Currency = oCurrency1.Gid; oSaleCash.Cash = (decimal)item["SalePrice1"]; dbEntity.GeneralResources.Add(oMarketCash); dbEntity.GeneralResources.Add(oSaleCash); dbEntity.SaveChanges(); marketPriceGid = oMarketCash.Gid; salePriceGid = oSaleCash.Gid; GeneralMeasureUnit oCurrency2 = (GeneralMeasureUnit)item["Currency2"]; if (oCurrency2 != null) { GeneralResItem oMarketResItem1 = new GeneralResItem(); oMarketResItem1.ResID = marketPriceGid; oMarketResItem1.Currency = oCurrency2.Gid; oMarketResItem1.Cash = (decimal)item["MarketPrice2"]; GeneralResItem oSaleResItem1 = new GeneralResItem(); oSaleResItem1.ResID = salePriceGid; oSaleResItem1.Currency = oCurrency2.Gid; oSaleResItem1.Cash = (decimal)item["SalePrice2"]; dbEntity.GeneralResItems.Add(oMarketResItem1); dbEntity.GeneralResItems.Add(oSaleResItem1); dbEntity.SaveChanges(); } GeneralMeasureUnit oCurrency3 = (GeneralMeasureUnit)item["Currency3"]; if (oCurrency3 != null) { GeneralResItem oMarketResItem2 = new GeneralResItem(); oMarketResItem2.ResID = marketPriceGid; oMarketResItem2.Currency = oCurrency3.Gid; oMarketResItem2.Cash = (decimal)item["MarketPrice3"]; GeneralResItem oSaleResItem2 = new GeneralResItem(); oSaleResItem2.ResID = salePriceGid; oSaleResItem2.Currency = oCurrency3.Gid; oSaleResItem2.Cash = (decimal)item["SalePrice3"]; dbEntity.GeneralResItems.Add(oMarketResItem2); dbEntity.GeneralResItems.Add(oSaleResItem2); dbEntity.SaveChanges(); } GeneralMeasureUnit oCurrency4 = (GeneralMeasureUnit)item["Currency4"]; if (oCurrency3 != null) { GeneralResItem oMarketResItem3 = new GeneralResItem(); oMarketResItem3.ResID = marketPriceGid; oMarketResItem3.Currency = oCurrency3.Gid; oMarketResItem3.Cash = (decimal)item["MarketPrice4"]; GeneralResItem oSaleResItem3 = new GeneralResItem(); oSaleResItem3.ResID = salePriceGid; oSaleResItem3.Currency = oCurrency3.Gid; oSaleResItem3.Cash = (decimal)item["SalePrice4"]; dbEntity.GeneralResItems.Add(oMarketResItem3); dbEntity.GeneralResItems.Add(oSaleResItem3); dbEntity.SaveChanges(); } //添加到UnitPrice表里 ProductOnUnitPrice oProductOnUnitPrice = new ProductOnUnitPrice(); oProductOnUnitPrice.OnSkuID = currentOnSKUGid; oProductOnUnitPrice.aShowUnit = currentUnitGid; oProductOnUnitPrice.aMarketPrice = marketPriceGid; oProductOnUnitPrice.aSalePrice = salePriceGid; oProductOnUnitPrice.UnitRatio = (decimal)item["Ratio"]; oProductOnUnitPrice.Percision = (byte)item["Percision"]; dbEntity.ProductOnUnitPrices.Add(oProductOnUnitPrice); dbEntity.SaveChanges(); } } } else { for (int i = 0; i < oProduct.SkuItems.Count; i++) { ProductOnItem oNewProductItem = new ProductOnItem(); oNewProductItem.OnSaleID = currentOnsaleGid; oNewProductItem.SkuID = oProduct.SkuItems.ElementAt(i).Gid; oNewProductItem.aFullName = oProduct.SkuItems.ElementAt(i).aFullName; oNewProductItem.aShortName = oProduct.SkuItems.ElementAt(i).aShortName; dbEntity.ProductOnItems.Add(oNewProductItem); dbEntity.SaveChanges(); //加入价套信息 Guid stdUnitGid = oProduct.SkuItems.ElementAt(i).StdUnit; ProductOnUnitPrice oNewUnitPrice = new ProductOnUnitPrice(); oNewUnitPrice.OnSkuID = oNewProductItem.Gid; oNewUnitPrice.aShowUnit = stdUnitGid; GeneralResource oMarketCash = new GeneralResource(); oMarketCash.Rtype = (byte)ModelEnum.ResourceType.MONEY; oMarketCash.Currency = oProduct.SkuItems.ElementAt(i).MarketPrice.Currency; oMarketCash.Cash = oProduct.SkuItems.ElementAt(i).MarketPrice.Cash; GeneralResource oSaleCash = new GeneralResource(); oSaleCash.Rtype = (byte)ModelEnum.ResourceType.MONEY; oSaleCash.Currency = oProduct.SkuItems.ElementAt(i).SuggestPrice.Currency; oSaleCash.Cash = oProduct.SkuItems.ElementAt(i).SuggestPrice.Cash; dbEntity.GeneralResources.Add(oMarketCash); dbEntity.GeneralResources.Add(oSaleCash); dbEntity.SaveChanges(); marketPriceGid = oMarketCash.Gid; salePriceGid = oSaleCash.Gid; oNewUnitPrice.aMarketPrice = marketPriceGid; oNewUnitPrice.aSalePrice = salePriceGid; Guid oldMarketGid = oProduct.SkuItems.ElementAt(i).MarketPrice.Gid; List<GeneralResItem> listMarketPrice = dbEntity.GeneralResItems.Where(p => p.ResID == oldMarketGid && p.Deleted == false).ToList(); for (int j = 0; j < listMarketPrice.Count; j++) { GeneralResItem newMarketPrice = new GeneralResItem(); newMarketPrice.ResID = marketPriceGid; newMarketPrice.Currency = listMarketPrice.ElementAt(j).Currency; newMarketPrice.Cash = listMarketPrice.ElementAt(j).Cash; dbEntity.GeneralResItems.Add(newMarketPrice); dbEntity.SaveChanges(); } Guid oldSaleGid = oProduct.SkuItems.ElementAt(i).SuggestPrice.Gid; List<GeneralResItem> listSalePrice = dbEntity.GeneralResItems.Where(p => p.ResID == oldSaleGid && p.Deleted == false).ToList(); for (int j = 0; j < listSalePrice.Count; j++) { GeneralResItem newSalePrice = new GeneralResItem(); newSalePrice.ResID = salePriceGid; newSalePrice.Currency = listSalePrice.ElementAt(j).Currency; newSalePrice.Cash = listSalePrice.ElementAt(j).Cash; dbEntity.GeneralResItems.Add(newSalePrice); dbEntity.SaveChanges(); } dbEntity.ProductOnUnitPrices.Add(oNewUnitPrice); dbEntity.SaveChanges(); } } #endregion #region 根据数据库中取出的模板对上架商品进行赋值 Guid onSaleTemplateGid = oTemplate.Gid; ProductOnTemplate oCurrentTemplate = dbEntity.ProductOnTemplates.Where(p => p.Gid == onSaleTemplateGid && p.Deleted == false).FirstOrDefault(); if (oCurrentTemplate != null) { string strShipPolicy = oCurrentTemplate.ShipPolicy; string strPayPolicy = oCurrentTemplate.PayPolicy; string strRelation = oCurrentTemplate.Relation; string strLevelDiscount = oCurrentTemplate.LevelDiscount; //将承运商信息和地区信息存入数据库 Guid onSaleShippingGid = new Guid(); string[] shippingInfo = strShipPolicy.Split(';'); for (int i = 0; i < shippingInfo.Count(); i++) { string[] currentShipAndAreaInfo = shippingInfo[i].Split(':'); //承运商代码 string currentShipCode = currentShipAndAreaInfo[0].Split('|')[0]; //承运商权重 string currentShipWeight = currentShipAndAreaInfo[0].Split('|')[1]; //承运商计费方案 string currentShipSolution = currentShipAndAreaInfo[0].Split('|')[2]; //承运商地区信息 string[] currentShipAreaList = currentShipAndAreaInfo[1].Split(','); //保存承运商信息 //如果承运商信息不为空,保存信息;否则不做操作。 if (currentShipAndAreaInfo[0] != "") { ProductOnShipping oNewProductOnShipping = new ProductOnShipping(); oNewProductOnShipping.OnSaleID = currentOnsaleGid; byte bOrgType = (byte)ModelEnum.OrganizationType.SHIPPER; //判断承运商信息是否在数据库中已删除 ShippingInformation oCurrentShippingInfomation = dbEntity.ShippingInformations.Where(p => p.Code == currentShipCode && p.aParent == onSaleOrgID && p.Otype == bOrgType && p.Deleted == false).FirstOrDefault(); if (oCurrentShippingInfomation != null) { Guid currentShippingID = oCurrentShippingInfomation.Gid; oNewProductOnShipping.ShipID = currentShippingID; oNewProductOnShipping.ShipWeight = Int32.Parse(currentShipWeight); oNewProductOnShipping.Solution = byte.Parse(currentShipSolution); dbEntity.ProductOnShippings.Add(oNewProductOnShipping); dbEntity.SaveChanges(); onSaleShippingGid = oNewProductOnShipping.Gid; //将对应的承运商的区域存入ProductOnShipArea表 //如果承运商地区信息不为空,保存信息;否则不做操作。 if (currentShipAreaList[0] != "") { for (int j = 0; j < currentShipAreaList.Count(); j++) { Guid currentRegionGid = Guid.Parse(currentShipAreaList[j]); //判断数据库中地区是否存在 GeneralRegion oRegion = dbEntity.GeneralRegions.Where(p => p.Gid == currentRegionGid && p.Deleted == false).FirstOrDefault(); if (oRegion != null) { ProductOnShipArea oNewShipArea = new ProductOnShipArea(); oNewShipArea.RegionID = currentRegionGid; oNewShipArea.OnShip = onSaleShippingGid; dbEntity.ProductOnShipAreas.Add(oNewShipArea); dbEntity.SaveChanges(); } else { continue; } } } else { continue; } } else { continue; } } else { continue; } } //将相关的支付方式存入数据库 string[] paymentList = strPayPolicy.Split(';'); //如果有支付方式,则将支付方式写入数据库;否则不保存。 if (paymentList[0] != "") { for (int i = 0; i < paymentList.Count(); i++) { string strPaymentCode = paymentList[i]; //判断支付方式在数据库中是否存在 FinancePayType oPaytype = dbEntity.FinancePayTypes.Where(p => p.OrgID == onSaleOrgID && p.Code == strPaymentCode && p.Deleted == false).FirstOrDefault(); if (oPaytype != null) { Guid currentPaymentGid = oPaytype.Gid; ProductOnPayment oProductOnPayment = new ProductOnPayment(); oProductOnPayment.OnSaleID = currentOnsaleGid; oProductOnPayment.PayID = currentPaymentGid; dbEntity.ProductOnPayments.Add(oProductOnPayment); dbEntity.SaveChanges(); } else { continue; } } } //将相关的商品信息存入数据库 string[] relationList = strRelation.Split(';'); //判断是否存在关联商品信息 if (relationList[0] != "") { for (int i = 0; i < relationList.Count(); i++) { Guid relationProductGid = Guid.Parse(relationList[i].Split('|')[0]); byte relationType = byte.Parse(relationList[i].Split('|')[1]); ProductOnSale oRelationProductOnSale = dbEntity.ProductOnSales.Where(p => p.Gid == relationProductGid && p.Deleted == false).FirstOrDefault(); if (oRelationProductOnSale != null) { ProductOnRelation oProductOnRelation = new ProductOnRelation(); oProductOnRelation.OnSaleID = currentOnsaleGid; oProductOnRelation.aOnRelation = relationProductGid; oProductOnRelation.Rtype = relationType; dbEntity.ProductOnRelations.Add(oProductOnRelation); dbEntity.SaveChanges(); } else { continue; } } } //将相关的会员打折信息存入数据库 string[] levelDiscountList = strLevelDiscount.Split(';'); //判断是否存在会员打折信息 if (levelDiscountList[0] != "") { for (int i = 0; i < levelDiscountList.Count(); i++) { string strMemberCode = levelDiscountList[i].Split(':')[0]; decimal decDiscount = Decimal.Parse(levelDiscountList[i].Split(':')[1]); MemberLevel oMemberLevel = dbEntity.MemberLevels.Where(p => p.Code == strMemberCode && p.Deleted == false).FirstOrDefault(); if (oMemberLevel != null) { Guid memberLevelGid = oMemberLevel.Gid; ProductOnLevelDiscount oProductOnLevelDiscount = new ProductOnLevelDiscount(); oProductOnLevelDiscount.OnSaleID = currentOnsaleGid; oProductOnLevelDiscount.aUserLevel = memberLevelGid; oProductOnLevelDiscount.Discount = decDiscount; dbEntity.ProductOnLevelDiscounts.Add(oProductOnLevelDiscount); dbEntity.SaveChanges(); } else { continue; } } } } #endregion } else { //存在上架的商品,同时还是可用状态,则提示用户不能重复上架 if (productOnsale.Deleted == false) { return "fail"; } else { //==================ToDo=================== //#region 恢复原来的上架信息 ////上架商品表信息恢复 //productOnsale.Deleted = false; //currentOnsaleGid = productOnsale.Gid; ////上架SKU信息恢复 //List<ProductOnItem> listProductOnItem = dbEntity.ProductOnItems.Where(p => p.OnSaleID == currentOnsaleGid).ToList(); //foreach (ProductOnItem productOnItem in listProductOnItem) //{ // productOnItem.Deleted = false; //} ////上架承运商信息恢复 //List<ProductOnShipping> listProductOnShipping = dbEntity.ProductOnShippings.Where(p => p.OnSaleID == currentOnsaleGid).ToList(); //foreach (ProductOnShipping productOnShipping in listProductOnShipping) //{ // productOnShipping.Deleted = false; // Guid deleteShipGid = productOnShipping.Gid; // //上架承运商地区信息恢复 // List<ProductOnShipArea> listProductOnShipArea = dbEntity.ProductOnShipAreas.Where(p => p.OnShip == deleteShipGid).ToList(); // foreach (ProductOnShipArea productShipArea in listProductOnShipArea) // { // productShipArea.Deleted = false; // } //} ////上架支付方式信息恢复 //List<ProductOnPayment> listProductOnPayment = dbEntity.ProductOnPayments.Where(p => p.OnSaleID == currentOnsaleGid).ToList(); //foreach (ProductOnPayment productOnPayment in listProductOnPayment) //{ // productOnPayment.Deleted = false; //} ////上架关联商品信息恢复 //List<ProductOnRelation> listProductOnRelation = dbEntity.ProductOnRelations.Where(p => p.OnSaleID == currentOnsaleGid).ToList(); //foreach (ProductOnRelation productOnRelation in listProductOnRelation) //{ // productOnRelation.Deleted = false; //} ////上架会员打折信息恢复 //List<ProductOnLevelDiscount> listProductOnLevelDiscount = dbEntity.ProductOnLevelDiscounts.Where(p => p.OnSaleID == currentOnsaleGid).ToList(); //foreach (ProductOnLevelDiscount productOnLevelDiscount in listProductOnLevelDiscount) //{ // productOnLevelDiscount.Deleted = false; //} //#endregion } } return "success"; }