public ActionResult EditProg(GeneralProgram prog)
        {
            if (prog.Gid.ToString() != new Guid().ToString())
            {
                GeneralProgram p = dbEntity.GeneralPrograms.Single(item => item.Gid == prog.Gid);
                p.Name.Matter = prog.Name.Matter;
                p.ProgUrl = prog.ProgUrl;
                dbEntity.Entry(p).State = EntityState.Modified;
                dbEntity.SaveChanges();
            }
            else
            {
                GeneralProgram oProgram = new GeneralProgram();
                GeneralResource oResource = new GeneralResource();
                oResource.Matter = prog.Name.Matter;
                oResource.Culture = 2052;
                dbEntity.Entry(oResource).State = EntityState.Added;
                dbEntity.SaveChanges();

                oProgram.Name = oResource;
                oProgram.ProgUrl = prog.ProgUrl;
                oProgram.Code = prog.Code;
                dbEntity.Entry(oProgram).State = EntityState.Added;
                dbEntity.SaveChanges();
            }
            return Json(GridResponse.Create(true), JsonRequestBehavior.AllowGet);
        }
 public ActionResult DeleteProg(GeneralProgram prog)
 {
     GeneralProgram p = dbEntity.GeneralPrograms.Single(item => item.Gid == prog.Gid);
     p.Deleted = true;
     dbEntity.Entry(p).State = EntityState.Modified;
     dbEntity.SaveChanges();
     return Json(GridResponse.CreateSuccess(), JsonRequestBehavior.AllowGet);
 }
Exemple #3
0
        public void GeneralTest()
        {
            try
            {
                // 创建数据库事务
                using (var scope = new TransactionScope())
                {
                    // 创建EF实体
                    using (var oLiveEntities = new LiveEntities(ConfigHelper.LiveConnection.Connection))
                    {
                        GeneralResource oResource = new GeneralResource
                        {
                            Code = "Test",
                            Culture = 0,
                            Matter = "名称"
                        };
                        string culturename = oResource.CultureName;

                        CultureInfo oCultureCN = new CultureInfo("zh-CN");
                        CultureInfo oCultureGB = new CultureInfo("en-GB");
                        CultureInfo oCultureUS = new CultureInfo("en-US");
                        CultureInfo oCultureFR = new CultureInfo("fr-FR");
                        CultureInfo oCultureDE = new CultureInfo("de-DE");

                        GeneralMessageReceive oMessageReceive = new GeneralMessageReceive
                        {
                            SendFrom = "13816626660",
                            Matter = "Hello World",
                            GetFrom = "EUCP",
                            SentTime = new DateTime(2010, 2, 10, 12, 35, 09)
                        };

                        oLiveEntities.GeneralMessageReceives.Add(oMessageReceive);
                        // 此处,数据库中事实上没有保存
                        oLiveEntities.SaveChanges();

                        GeneralProgram oProgram = new GeneralProgram
                        {
                            Code = "Main"
                        };
                        GeneralProgNode oNode = new GeneralProgNode
                        {
                            Program = oProgram,
                            Code = "Test"
                        };
                        oLiveEntities.GeneralProgNodes.Add(oNode);
                        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();
        }
Exemple #4
0
        /// <summary>
        /// 导入程序菜单和定义
        /// </summary>
        /// <param name="sExcelFile">Excel文件名</param>
        /// <param name="sSheetName">Sheet名</param>
        public void ImportPrograms(string sExcelFile, string sSheetName)
        {
            try
            {
                ExcelData oExcel = new ExcelData(sExcelFile, sSheetName);
                // 程序定义字段
                DataColumn colPgCode = oExcel.ExcelTable.Columns["程序代码"];
                DataColumn colPgParent = oExcel.ExcelTable.Columns["上级"];
                DataColumn colPgUrl = oExcel.ExcelTable.Columns["URL"];
                DataColumn colPgLeaf = oExcel.ExcelTable.Columns["叶子"];
                // 功能定义字段
                DataColumn colNdCode = oExcel.ExcelTable.Columns["功能代码"];
                DataColumn colNdOptCN = oExcel.ExcelTable.Columns["中文选项"];
                DataColumn colNdOptUS = oExcel.ExcelTable.Columns["英文选项"];
                DataColumn colNdMode = oExcel.ExcelTable.Columns["输入模式"];
                // 公共字段
                DataColumn colNameCN = oExcel.ExcelTable.Columns["中文名称"];
                DataColumn colNameUS = oExcel.ExcelTable.Columns["英文名称"];
                DataColumn colRemark = oExcel.ExcelTable.Columns["备注"];

                // 导入
                GeneralProgram oLastProgram = null;
                string sLastParent = "";
                GeneralProgram oParent = null;
                foreach (DataRow row in oExcel.ExcelTable.Rows)
                {
                    string sPgCode = row[colPgCode].ToString();
                    string sPgParent = row[colPgParent].ToString();
                    string sPgUrl = row[colPgUrl].ToString();
                    bool bPgLeaf = row[colPgLeaf].ToString() == "1" ? true : false;

                    string sNdCode = row[colNdCode].ToString();
                    GeneralResource oNdOpt = new GeneralResource(ModelEnum.ResourceType.STRING, 2052, row[colNdOptCN].ToString(), 1033, row[colNdOptUS].ToString());
                    byte nNdMode;
                    Byte.TryParse(row[colNdMode].ToString(), out nNdMode);

                    GeneralResource oName = new GeneralResource(ModelEnum.ResourceType.STRING, 2052, row[colNameCN].ToString(), 1033, row[colNameUS].ToString());
                    string sRemark = row[colRemark].ToString();

                    if (!String.IsNullOrEmpty(sPgCode))
                    {
                        // 定义程序
                        if (String.IsNullOrEmpty(sPgParent))
                        {
                            oParent = null;
                            sLastParent = "";
                        }
                        else if (sPgParent != sLastParent)
                        {
                            oParent = (from p in dbEntity.GeneralPrograms
                                       where p.Code == sPgParent
                                       select p).FirstOrDefault();
                            sLastParent = sPgParent;
                        }
                        var oProgram = (from p in dbEntity.GeneralPrograms
                                        where p.Code == sPgCode
                                        select p).FirstOrDefault();
                        if (oProgram == null)
                        {
                            oProgram = new GeneralProgram { Code = sPgCode };
                            dbEntity.GeneralPrograms.Add(oProgram);
                        }
                        oProgram.Parent = oParent;
                        oProgram.ProgUrl = sPgUrl;
                        oProgram.Terminal = bPgLeaf;
                        if (oProgram.Name == null)
                            oProgram.Name = oName;
                        else
                            oProgram.Name.SetResource(ModelEnum.ResourceType.STRING, oName);
                        oProgram.Show = true;
                        oProgram.Remark = sRemark;
                        dbEntity.SaveChanges();

                        oLastProgram = oProgram;
                        if (Utility.ConfigHelper.GlobalConst.IsDebug)
                            Debug.WriteLine("{0} {1} {2}", this.ToString(), sPgCode, sRemark);
                    }
                    else
                    {
                        // 定义功能点
                        var oProgNode = (from n in dbEntity.GeneralProgNodes
                                         where n.ProgID == oLastProgram.Gid && n.Code == sNdCode
                                         select n).FirstOrDefault();
                        if (oProgNode == null)
                        {
                            oProgNode = new GeneralProgNode { Program = oLastProgram, Code = sNdCode };
                            dbEntity.GeneralProgNodes.Add(oProgNode);
                        }
                        if (oProgNode.Name == null)
                            oProgNode.Name = oName;
                        else
                            oProgNode.Name.SetResource(ModelEnum.ResourceType.STRING, oName);
                        if (nNdMode == (byte)ModelEnum.OptionalInputMode.COMBOBOX)
                        {
                            if (oProgNode.Optional == null)
                                oProgNode.Optional = oNdOpt;
                            else
                                oProgNode.Optional.SetResource(ModelEnum.ResourceType.STRING, oNdOpt);
                        }
                        oProgNode.InputMode = nNdMode;
                        oProgNode.Remark = sRemark;
                        dbEntity.SaveChanges();
                        if (Utility.ConfigHelper.GlobalConst.IsDebug)
                            Debug.WriteLine("    {0} {1}", sNdCode, sRemark);
                    }
                }
                oEventBLL.WriteEvent(String.Format("导入GeneralProgram/GeneralProgNode成功: {0} {1}", sExcelFile, sSheetName),
                    ModelEnum.ActionLevel.GENERIC, ModelEnum.ActionSource.SYSTEM, this.ToString());
            }
            catch (Exception ex)
            {
                oEventBLL.WriteEvent(String.Format("导入GeneralProgram/GeneralProgNode错误: {0} {1} {2}", sExcelFile, sSheetName, ex.Message),
                    ModelEnum.ActionLevel.ERROR, ModelEnum.ActionSource.SYSTEM, this.ToString());
            }
        }
Exemple #5
0
        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="parentId">被选中的程序节点的Guid</param>
 /// <param name="programNodeCollection">要添加的程序节点的内容</param>
 /// <returns>树视图</returns>
 public ActionResult ProgramNewSave(Guid? parentId, GeneralProgram program)
 {
     if (base.GetProgramNode("EnableEdit") == "1")
     {
         GeneralProgram oProgram = new GeneralProgram
         {
             aParent = parentId,
             Code = program.Code,
             ProgUrl = program.ProgUrl,
             Terminal = program.Terminal,
             Show = program.Show,
             Sorting = program.Sorting,
             Name = new GeneralResource(ModelEnum.ResourceType.STRING, program.Name)
         };
         dbEntity.GeneralPrograms.Add(oProgram);
         dbEntity.SaveChanges();
         progNodeGidEdit = oProgram.Gid;
         return RedirectToAction("Tree");
     }
     return RedirectToAction("ErrorPage", "Home", new { message = LiveAzure.Resource.Common.NoPermission });
 }
 /// <summary>
 /// 添加程序
 /// </summary>
 /// <param name="id">被选中的程序节点的Guid</param>
 /// <returns>添加程序节点视图</returns>
 public ActionResult ProgramNew(Guid id)
 {
     if (base.GetProgramNode("EnableEdit") == "1")
     {
         GeneralProgram oProgram = new GeneralProgram { Name = NewResource(ModelEnum.ResourceType.STRING) };
         string strParentName = "root";
         if (id.Equals(Guid.Empty) || id.Equals(null))
         {
             oProgram.aParent = null;
             oProgram.Parent = null;
         }
         else
         {
             oProgram.aParent = id;
             oProgram.Parent = dbEntity.GeneralPrograms.Where(p => p.Gid == id).Single();
             strParentName = oProgram.Parent.Name.GetResource(CurrentSession.Culture);
         }
         ViewBag.TerminalList = SelectEnumList(oProgram.Terminal);
         ViewBag.ShowList = SelectEnumList(oProgram.Show);
         ViewBag.ParentName = strParentName;
         ViewBag.EnableEdit = (base.GetProgramNode("EnableEdit") == "1") ? true : false;
         return View(oProgram);
     }
     return RedirectToAction("ErrorPage", "Home", new { message = LiveAzure.Resource.Common.NoPermission });
 }
 /// <summary>
 /// 保存编辑程序
 /// </summary>
 /// <param name="gid">被选中的程序节点的Guid</param>
 /// <param name="programNodeCollection">程序节点内容</param>
 /// <returns>重定向到树视图</returns>
 public ActionResult ProgramEditSave(GeneralProgram program)
 {
     if (base.GetProgramNode("EnableEdit") == "1")
     {
         try
         {
             var oProgram = dbEntity.GeneralPrograms.Where(s => s.Gid == program.Gid).Single();
             oProgram.Code = program.Code;
             oProgram.ProgUrl = program.ProgUrl;
             oProgram.Name.SetResource(ModelEnum.ResourceType.STRING, program.Name);
             oProgram.Sorting = program.Sorting;
             oProgram.Terminal = program.Terminal;
             program.Show = program.Show;
             dbEntity.SaveChanges();
             return RedirectToAction("Tree");
         }
         catch (Exception ex)
         {
             return RedirectToAction("ErrorPage", "Home", new { message = ex.Message });
         }
     }
     return RedirectToAction("ErrorPage", "Home", new { message = LiveAzure.Resource.Common.NoPermission });
 }
Exemple #9
0
        //=====================================================================
        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();
        }