Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        public void MemberTest2()
        {
            LiveEntities oLiveEntities = new LiveEntities(ConfigHelper.LiveConnection.Connection);

            GeneralResource ResourceB = new GeneralResource
            {
                Rtype = (byte)ModelEnum.ResourceType.STRING,
                Code = "ResourceB",
                Culture = 1033,
                Matter = "ResourceTest2"
            };

            GeneralResItem ResItemA = new GeneralResItem
            {
                Culture = 1033,
                Matter = "this is the resource's son",
                Cash = 3.08m,
                Resource = ResourceB
            };

            oLiveEntities.GeneralResItems.Add(ResItemA);
            oLiveEntities.SaveChanges();

            oLiveEntities.Dispose();
            GC.Collect();
        }
Ejemplo n.º 3
0
 /// <summary>
 /// 测试OrderAttribute
 /// </summary>
 /// <returns>新建的OrderAttribute对象</returns>
 public OrderAttribute OrderAttributeTest()
 {
     MemberOrganization oOrg = new MemberOrganization
     {
         Code = GetRandCode()
     };
     oLiveEntities.MemberOrganizations.Add(oOrg);
     MemberChannel oChannel = new MemberChannel
     {
         Code = GetRandCode()
     };
     oLiveEntities.MemberChannels.Add(oChannel);
     GeneralResource oGeneralResource = new GeneralResource { };
     MemberRole oRole = new MemberRole
     {
         Organization = oOrg,
         Code = GetRandCode(),
         Name = oGeneralResource
     };
     oLiveEntities.MemberRoles.Add(oRole);
     MemberUser oUser = new MemberUser
     {
         Organization = oOrg,
         Role = oRole,
         Channel = oChannel,
         LoginName = GetRandCode(),
         Passcode = GetRandCode(),
         SaltKey = "88888888"
     };
     oLiveEntities.MemberUsers.Add(oUser);
     OrderInformation oOrderInformation = new OrderInformation
     {
         Organization = oOrg,
         Channel = oChannel,
         User = oUser,
         Code = GetRandCode()
     };
     oLiveEntities.OrderInformations.Add(oOrderInformation);
     GeneralOptional oOptional = new GeneralOptional
     {
         Organization = oOrg,
         Code = GetRandCode()
     };
     oLiveEntities.GeneralOptionals.Add(oOptional);
     OrderAttribute oAttribute = new OrderAttribute
     {
         Order = oOrderInformation,
         Optional = oOptional
     };
     oLiveEntities.OrderAttributes.Add(oAttribute);
     oLiveEntities.SaveChanges();
     return oAttribute;
 }
Ejemplo n.º 4
0
        public void MemberTest()
        {
            LiveEntities oLiveEntities = new LiveEntities(ConfigHelper.LiveConnection.Connection);

            GeneralResource ResourceA = new GeneralResource
            {
                Rtype = (byte)ModelEnum.ResourceType.STRING,
                Code = "ResourceA",
                Culture = 1033,
                Matter = "ResourceTest"
            };

            oLiveEntities.GeneralResources.Add(ResourceA);
            oLiveEntities.SaveChanges();

            oLiveEntities.Dispose();
            GC.Collect();
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="rtype">资源类型</param>
 /// <param name="resource">完整资源表</param>
 public GeneralResource(ModelEnum.ResourceType rtype, GeneralResource resource)
 {
     this.Rtype = (byte)rtype;
     this.ResourceItems = new List<GeneralResItem>();
     if (rtype == ModelEnum.ResourceType.MONEY)
     {
         this.Code = resource.Code;
         this.Currency = resource.Currency;
         this.Cash = resource.Cash;
         this.Remark = resource.Remark;
         foreach (GeneralResItem item in resource.ResourceItems)
         {
             var resitem = this.ResourceItems.FirstOrDefault(i => i.Currency == item.Currency && i.Deleted == false);
             if (resitem == null)
                 this.ResourceItems.Add(new GeneralResItem { Code = item.Code, Currency = item.Currency, Cash = item.Cash, Remark = item.Remark });
             else
             {
                 resitem.Code = item.Code;
                 resitem.Cash = item.Cash;
             }
         }
     }
     else
     {
         this.Code = resource.Code;
         this.Culture = resource.Culture;
         this.Matter = resource.Matter;
         this.Remark = resource.Remark;
         foreach (GeneralResItem item in resource.ResourceItems)
         {
             var resitem = this.ResourceItems.FirstOrDefault(i => i.Culture == item.Culture && i.Deleted == false);
             if (resitem == null)
                 this.ResourceItems.Add(new GeneralResItem { Code = item.Code, Culture = item.Culture, Matter = item.Matter, Remark = item.Remark });
             else
             {
                 resitem.Code = item.Code;
                 resitem.Matter = item.Matter;
             }
         }
     }
 }
Ejemplo n.º 6
0
        /// <summary>
        /// 添加程序
        /// </summary>
        /// <param name="parentId"></param>
        /// <param name="programNodeCollection"></param>
        /// <returns></returns>
        public ActionResult AddProgramNode(Guid parentId, FormCollection programNodeCollection)
        {
            GeneralPrivateCategory oGeneralPrivateCategory = new GeneralPrivateCategory();
            oGeneralPrivateCategory.OrgID = GetOrganization();
            oGeneralPrivateCategory.aParent = parentId;
            oGeneralPrivateCategory.Code = programNodeCollection["Code"];
            oGeneralPrivateCategory.Sorting = Convert.ToInt32(programNodeCollection["Sorting"]);

            GeneralResource oResouce = new GeneralResource();
            oResouce.Code = "4534645";
            oResouce.Culture = 2052;
            oResouce.Matter = programNodeCollection["Name.Matter"];
            dbEntity.GeneralResources.Add(oResouce);

            oGeneralPrivateCategory.Name = oResouce;

            dbEntity.GeneralPrivateCategorys.Add(oGeneralPrivateCategory);

            dbEntity.SaveChanges();

            return RedirectToAction("Index");
        }
Ejemplo n.º 7
0
        public void ImportOnTemplate(string sExcelFile, string sSheetName)
        {
            try
            {
                ExcelData oExcel = new ExcelData(sExcelFile, sSheetName);
                DataColumn colOrgan = oExcel.ExcelTable.Columns["组织"];
                DataColumn colCode = oExcel.ExcelTable.Columns["代码"];
                DataColumn colNameCN = oExcel.ExcelTable.Columns["中文名称"];
                DataColumn colNameUS = oExcel.ExcelTable.Columns["英文名称"];
                DataColumn colShipPolicy = oExcel.ExcelTable.Columns["运输策略"];
                DataColumn colPayPolicy = oExcel.ExcelTable.Columns["支付策略"];
                DataColumn colRelation = oExcel.ExcelTable.Columns["关联商品"];
                DataColumn colLevelDiscount = oExcel.ExcelTable.Columns["等级折扣"];
                DataColumn colRemark = oExcel.ExcelTable.Columns["备注"];

                foreach (DataRow row in oExcel.ExcelTable.Rows)
                {
                    string sOrganCode = row[colOrgan].ToString();
                    var oOrgan = (from o in dbEntity.MemberOrganizations
                                  where o.Code == sOrganCode && o.Otype == (byte)ModelEnum.OrganizationType.CORPORATION
                                  select o).FirstOrDefault();
                    string sCode = row[colCode].ToString();
                    GeneralResource oName = new GeneralResource(ModelEnum.ResourceType.STRING, 2052, row[colNameCN].ToString(), 1033, row[colNameUS].ToString());
                    string sShipPolicy = row[colShipPolicy].ToString();
                    string sPayPolicy = row[colPayPolicy].ToString();
                    string sRelation = row[colRelation].ToString();
                    string sLevelDiscount = row[colLevelDiscount].ToString();
                    string sRemark = row[colRemark].ToString();

                    var oTemplate = (from t in dbEntity.ProductOnTemplates
                                     where t.OrgID == oOrgan.Gid && t.Code == sCode
                                     select t).FirstOrDefault();
                    if (oTemplate == null)
                    {
                        oTemplate = new ProductOnTemplate { Organization = oOrgan, Code = sCode };
                        dbEntity.ProductOnTemplates.Add(oTemplate);
                    }
                    if (oTemplate.Name == null)
                        oTemplate.Name = oName;
                    else
                        oTemplate.Name.SetResource(ModelEnum.ResourceType.STRING, oName);
                    oTemplate.ShipPolicy = sShipPolicy;
                    oTemplate.PayPolicy = sPayPolicy;
                    oTemplate.Relation = sRelation;
                    oTemplate.LevelDiscount = sLevelDiscount;
                    oTemplate.Remark = sRemark;
                    dbEntity.SaveChanges();
                    if (Utility.ConfigHelper.GlobalConst.IsDebug)
                        Debug.WriteLine("{0} {1} {2}", this.ToString(), sCode, sRemark);
                }
                oEventBLL.WriteEvent(String.Format("导入ProductOnTemplate成功: {0} {1}", sExcelFile, sSheetName),
                    ModelEnum.ActionLevel.GENERIC, ModelEnum.ActionSource.SYSTEM, this.ToString());
            }
            catch (Exception ex)
            {
                oEventBLL.WriteEvent(String.Format("导入ProductOnTemplate错误: {0} {1} {2}", sExcelFile, sSheetName, ex.Message),
                    ModelEnum.ActionLevel.ERROR, ModelEnum.ActionSource.SYSTEM, this.ToString());
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 导入用户级别
        /// </summary>
        /// <param name="sExcelFile">Excel文件名</param>
        /// <param name="sSheetName">Sheet名</param>
        public void ImportUserLevel(string sExcelFile, string sSheetName)
        {
            try
            {
                ExcelData oExcel = new ExcelData(sExcelFile, sSheetName);
                DataColumn colOrgan = oExcel.ExcelTable.Columns["组织"];
                DataColumn colCode = oExcel.ExcelTable.Columns["代码"];
                DataColumn colNameCN = oExcel.ExcelTable.Columns["中文名称"];
                DataColumn colNameUS = oExcel.ExcelTable.Columns["英文名称"];
                DataColumn colLevel = oExcel.ExcelTable.Columns["级别"];
                DataColumn colDiscount = oExcel.ExcelTable.Columns["折扣"];
                DataColumn colRemark = oExcel.ExcelTable.Columns["备注"];
                foreach (DataRow row in oExcel.ExcelTable.Rows)
                {
                    string sOrgan = row[colOrgan].ToString();
                    var oOrgan = (from o in dbEntity.MemberOrganizations
                                  where o.Code == sOrgan && o.Otype == (byte)ModelEnum.OrganizationType.CORPORATION
                                  select o).FirstOrDefault();
                    string sCode = row[colCode].ToString();
                    GeneralResource oName = new GeneralResource(ModelEnum.ResourceType.STRING, 2052, row[colNameCN].ToString(), 1033, row[colNameUS].ToString());
                    byte nLevel;
                    Byte.TryParse(row[colLevel].ToString(), out nLevel);
                    decimal mDiscount = 1;
                    Decimal.TryParse(row[colDiscount].ToString(), out mDiscount);
                    string sRemark = row[colRemark].ToString();

                    var oLevel = (from l in dbEntity.MemberLevels
                                 where l.OrgID == oOrgan.Gid && l.Code == sCode
                                 select l).FirstOrDefault();
                    if (oLevel == null)
                    {
                        oLevel = new MemberLevel { Code = sCode };
                        dbEntity.MemberLevels.Add(oLevel);
                    }
                    oLevel.Organization = oOrgan;
                    if (oLevel.Name == null)
                        oLevel.Name = oName;
                    else
                        oLevel.Name.SetResource(ModelEnum.ResourceType.STRING, oName);
                    oLevel.Mlevel = nLevel;
                    oLevel.Discount = mDiscount;
                    oLevel.Remark = sRemark;
                    dbEntity.SaveChanges();
                    if (Utility.ConfigHelper.GlobalConst.IsDebug)
                        Debug.WriteLine("{0} {1} {2}", this.ToString(), sCode, sRemark);
                }
                oEventBLL.WriteEvent(String.Format("导入MemberLevel成功: {0} {1}", sExcelFile, sSheetName),
                    ModelEnum.ActionLevel.GENERIC, ModelEnum.ActionSource.SYSTEM, this.ToString());
            }
            catch (Exception ex)
            {
                oEventBLL.WriteEvent(String.Format("导入MemberLevel错误: {0} {1} {2}", sExcelFile, sSheetName, ex.Message),
                    ModelEnum.ActionLevel.ERROR, ModelEnum.ActionSource.SYSTEM, this.ToString());
            }
        }
Ejemplo n.º 9
0
 /// <summary>
 /// 导入计量单位
 /// </summary>
 /// <param name="sExcelFile">Excel文件名</param>
 /// <param name="sSheetName">Sheet表名</param>
 public void ImportMeasureUnits(string sExcelFile, string sSheetName)
 {
     try
     {
         ExcelData oExcel = new ExcelData(sExcelFile, sSheetName);
         DataColumn colCode = oExcel.ExcelTable.Columns["代码"];
         DataColumn colType = oExcel.ExcelTable.Columns["类型"];
         DataColumn colNameCN = oExcel.ExcelTable.Columns["中文名称"];
         DataColumn colNameUS = oExcel.ExcelTable.Columns["英文名称"];
         DataColumn colRemark = oExcel.ExcelTable.Columns["备注"];
         foreach (DataRow row in oExcel.ExcelTable.Rows)
         {
             string sCode = row[colCode].ToString();
             byte nType;
             Byte.TryParse(row[colType].ToString(), out nType);
             GeneralResource oName = new GeneralResource(ModelEnum.ResourceType.STRING, 2052, row[colNameCN].ToString(), 1033, row[colNameUS].ToString());
             string sRemark = row[colRemark].ToString();
             var oUnit = (from c in dbEntity.GeneralMeasureUnits
                          where c.Code == sCode
                          select c).FirstOrDefault();
             if (oUnit == null)
             {
                 oUnit = new GeneralMeasureUnit { Code = sCode };
                 dbEntity.GeneralMeasureUnits.Add(oUnit);
             }
             oUnit.Utype = nType;
             if (oUnit.Name == null)
                 oUnit.Name = oName;
             else
                 oUnit.Name.SetResource(ModelEnum.ResourceType.STRING, oName);
             oUnit.Remark = sRemark;
             dbEntity.SaveChanges();
             if (Utility.ConfigHelper.GlobalConst.IsDebug)
                 Debug.WriteLine("{0} {1} {2}", this.ToString(), sCode, sRemark);
         }
         oEventBLL.WriteEvent(String.Format("导入GeneralMeasureUnit成功: {0} {1}", sExcelFile, sSheetName),
             ModelEnum.ActionLevel.GENERIC, ModelEnum.ActionSource.SYSTEM, this.ToString());
     }
     catch (Exception ex)
     {
         oEventBLL.WriteEvent(String.Format("导入GeneralMeasureUnit错误: {0} {1} {2}", sExcelFile, sSheetName, ex.Message),
             ModelEnum.ActionLevel.ERROR, ModelEnum.ActionSource.SYSTEM, this.ToString());
     }
 }
Ejemplo n.º 10
0
        /// <summary>
        /// 导入用户角色
        /// </summary>
        /// <param name="sExcelFile">Excel文件名</param>
        /// <param name="sSheetName">Sheet名</param>
        public void ImportRoles(string sExcelFile, string sSheetName)
        {
            try
            {
                ExcelData oExcel = new ExcelData(sExcelFile, sSheetName);
                DataColumn colOrgan = oExcel.ExcelTable.Columns["组织"];
                DataColumn colCode = oExcel.ExcelTable.Columns["代码"];
                DataColumn colParent = oExcel.ExcelTable.Columns["上级"];
                DataColumn colType = oExcel.ExcelTable.Columns["类型"];
                DataColumn colNameCN = oExcel.ExcelTable.Columns["中文名称"];
                DataColumn colNameUS = oExcel.ExcelTable.Columns["英文名称"];
                DataColumn colRemark = oExcel.ExcelTable.Columns["备注"];

                string sLastParent = "";
                MemberRole oParent = null;
                foreach (DataRow row in oExcel.ExcelTable.Rows)
                {
                    string sOrgan = row[colOrgan].ToString();
                    var oOrgan = (from o in dbEntity.MemberOrganizations
                                  where o.Code == sOrgan && o.Otype == (byte)ModelEnum.OrganizationType.CORPORATION
                                  select o).FirstOrDefault();
                    string sCode = row[colCode].ToString();
                    string sParent = row[colParent].ToString();
                    string sType = row[colType].ToString();
                    GeneralResource oName = new GeneralResource(ModelEnum.ResourceType.STRING, 2052, row[colNameCN].ToString(), 1033, row[colNameUS].ToString());
                    string sRemark = row[colRemark].ToString();

                    if (String.IsNullOrEmpty(sParent))
                    {
                        oParent = null;
                        sLastParent = "";
                    }
                    else if (sParent != sLastParent)
                    {
                        oParent = (from r in dbEntity.MemberRoles
                                   where r.OrgID == oOrgan.Gid && r.Code == sParent
                                   select r).FirstOrDefault();
                        sLastParent = sParent;
                    }
                    var oRole = (from r in dbEntity.MemberRoles
                                  where r.OrgID == oOrgan.Gid && r.Code == sCode
                                  select r).FirstOrDefault();
                    if (oRole == null)
                    {
                        oRole = new MemberRole { Code = sCode };
                        dbEntity.MemberRoles.Add(oRole);
                    }
                    oRole.Organization = oOrgan;
                    oRole.Parent = oParent;
                    oRole.RoleType = dbEntity.GeneralStandardCategorys.Where(c => c.Code == sType && c.Ctype == (byte)ModelEnum.StandardCategoryType.ROLE).FirstOrDefault();
                    if (oRole.Name == null)
                        oRole.Name = oName;
                    else
                        oRole.Name.SetResource(ModelEnum.ResourceType.STRING, oName);
                    oRole.Remark = sRemark;
                    dbEntity.SaveChanges();
                    if (Utility.ConfigHelper.GlobalConst.IsDebug)
                        Debug.WriteLine("{0} {1} {2}", this.ToString(), sCode, sRemark);
                }
                oEventBLL.WriteEvent(String.Format("导入MemberRole成功: {0} {1}", sExcelFile, sSheetName),
                    ModelEnum.ActionLevel.GENERIC, ModelEnum.ActionSource.SYSTEM, this.ToString());
            }
            catch (Exception ex)
            {
                oEventBLL.WriteEvent(String.Format("导入MemberRole错误: {0} {1} {2}", sExcelFile, sSheetName, ex.Message),
                    ModelEnum.ActionLevel.ERROR, ModelEnum.ActionSource.SYSTEM, this.ToString());
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// 导入标准分类
        /// </summary>
        /// <param name="sExcelFile"></param>
        /// <param name="sSheetName"></param>
        public void ImportStandardCategories(string sExcelFile, string sSheetName)
        {
            try
            {
                ExcelData oExcel = new ExcelData(sExcelFile, sSheetName);
                DataColumn colCode = oExcel.ExcelTable.Columns["代码"];
                DataColumn colParent = oExcel.ExcelTable.Columns["上级"];
                DataColumn colType = oExcel.ExcelTable.Columns["类型"];
                DataColumn colNameCN = oExcel.ExcelTable.Columns["中文名称"];
                DataColumn colNameUS = oExcel.ExcelTable.Columns["英文名称"];
                DataColumn colRemark = oExcel.ExcelTable.Columns["备注"];

                string sLastParent = "";
                GeneralStandardCategory oParent = null;
                foreach (DataRow row in oExcel.ExcelTable.Rows)
                {
                    string sCode = row[colCode].ToString();
                    string sParent = row[colParent].ToString();
                    byte nType;
                    Byte.TryParse(row[colType].ToString(), out nType);
                    GeneralResource oName = new GeneralResource(ModelEnum.ResourceType.STRING, 2052, row[colNameCN].ToString(), 1033, row[colNameUS].ToString());
                    string sRemark = row[colRemark].ToString();

                    if (String.IsNullOrEmpty(sParent))
                    {
                        oParent = null;
                        sLastParent = "";
                    }
                    else if (sLastParent != sParent)
                    {
                        oParent = (from c in dbEntity.GeneralStandardCategorys
                                   where c.Code == sParent && c.Ctype == nType
                                   select c).FirstOrDefault();
                        sLastParent = sParent;
                    }
                    var oCategory = (from c in dbEntity.GeneralStandardCategorys
                                     where c.Code == sCode && c.Ctype == nType
                                     select c).FirstOrDefault();
                    if (oCategory == null)
                    {
                        oCategory = new GeneralStandardCategory { Code = sCode, Ctype = nType };
                        dbEntity.GeneralStandardCategorys.Add(oCategory);
                    }
                    oCategory.Parent = oParent;
                    if (oCategory.Name == null)
                        oCategory.Name = oName;
                    else
                        oCategory.Name.SetResource(ModelEnum.ResourceType.STRING, oName);
                    oCategory.Remark = sRemark;
                    dbEntity.SaveChanges();
                    if (Utility.ConfigHelper.GlobalConst.IsDebug)
                        Debug.WriteLine("{0} {1} {2}", this.ToString(), sCode, sRemark);
                }
                oEventBLL.WriteEvent(String.Format("导入GeneralStandardCategory成功: {0} {1}", sExcelFile, sSheetName),
                    ModelEnum.ActionLevel.GENERIC, ModelEnum.ActionSource.SYSTEM, this.ToString());
            }
            catch (Exception ex)
            {
                oEventBLL.WriteEvent(String.Format("导入GeneralStandardCategory错误: {0} {1} {2}", sExcelFile, sSheetName, ex.Message),
                    ModelEnum.ActionLevel.ERROR, ModelEnum.ActionSource.SYSTEM, this.ToString());
            }
        }
Ejemplo n.º 12
0
 /// <summary>
 /// 产生多语言的资源文件
 /// </summary>
 /// <param name="rtype">资源类型:字符或金额</param>
 /// <param name="organID">组织,空则表示用系统支持的所有语言</param>
 /// <returns>新资源文件</returns>
 public GeneralResource NewResource(ModelEnum.ResourceType rtype, Guid? organID = null)
 {
     GeneralResource oResource = new GeneralResource();
     oResource.Rtype = (byte)rtype;
     if (rtype == ModelEnum.ResourceType.MONEY)
     {
         List<GeneralMeasureUnit> oUnits = this.GetSupportCurrencies(organID);
         bool bIsFirst = true;
         foreach (var item in oUnits)
         {
             if (bIsFirst)
             {
                 oResource.Code = item.Code;
                 oResource.Currency = item.Gid;
             }
             else
             {
                 oResource.ResourceItems.Add(new GeneralResItem { Code = item.Code, Currency = item.Gid });
             }
             bIsFirst = false;
         }
     }
     else
     {
         List<GeneralCultureUnit> oCultures = this.GetSupportCultures(organID);
         bool bIsFirst = true;
         foreach (var item in oCultures)
         {
             if (bIsFirst)
                 oResource.Culture = item.Culture;
             else
                 oResource.ResourceItems.Add(new GeneralResItem { Culture = item.Culture });
             bIsFirst = false;
         }
     }
     return oResource;
 }
Ejemplo n.º 13
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());
            }
        }
Ejemplo n.º 14
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();
        }
Ejemplo n.º 15
0
        /// <summary>
        /// 测试方法,最终将被舍弃
        /// </summary>
        /// <returns></returns>
        public ActionResult TestEditCash()
        {
            ///添加货币名称资源(人民币)
            GeneralResource cashName1_CN = new GeneralResource { Rtype = (byte)ModelEnum.ResourceType.STRING, Culture = 2052, Matter = "人民币" };
            dbEntity.GeneralResources.Add(cashName1_CN);
            GeneralResItem cashName1_EN = new GeneralResItem { Culture = 1033, Matter = "Chinese Yuan", Resource = cashName1_CN };
            dbEntity.GeneralResItems.Add(cashName1_EN);
            GeneralResItem cashName1_FR = new GeneralResItem { Culture = 1036, Matter = "~~~Chinese Yuan~~法语~", Resource = cashName1_CN };
            dbEntity.GeneralResItems.Add(cashName1_FR);
            dbEntity.SaveChanges();

            ///添加货币名称资源(美元)
            GeneralResource cashName2_CN = new GeneralResource { Rtype = (byte)ModelEnum.ResourceType.STRING, Culture = 2052, Matter = "美元" };
            dbEntity.GeneralResources.Add(cashName2_CN);
            GeneralResItem cashName2_EN = new GeneralResItem { Culture = 1033, Matter = "Dollar", Resource = cashName2_CN };
            dbEntity.GeneralResItems.Add(cashName2_EN);
            GeneralResItem cashName2_FR = new GeneralResItem { Culture = 1036, Matter = "~~~Dollar~~法语~", Resource = cashName2_CN };
            dbEntity.GeneralResItems.Add(cashName2_FR);
            dbEntity.SaveChanges();

            //添加货币单位
            GeneralMeasureUnit unitCNY = new GeneralMeasureUnit
            {
                Utype = (byte)ModelEnum.MeasureUnit.CURRENCY,
                Code = "CNYdcced5",
                Name = cashName1_CN
            };
            dbEntity.GeneralMeasureUnits.Add(unitCNY);
            GeneralMeasureUnit unitUSD = new GeneralMeasureUnit
            {
                Utype = (byte)ModelEnum.MeasureUnit.CURRENCY,
                Code = "USDd5555",
                Name = cashName2_CN
            };
            dbEntity.GeneralMeasureUnits.Add(unitUSD);
            dbEntity.SaveChanges();

            //添加金额资源
            GeneralResource res = new GeneralResource
            {
                Rtype = (byte)ModelEnum.ResourceType.MONEY,
                Currency = unitCNY.Gid,
                Cash = 10.0m
            };
            GeneralResItem resItem = new GeneralResItem
            {
                Resource = res,
                Currency = unitUSD.Gid
            };
            dbEntity.GeneralResources.Add(res);
            dbEntity.GeneralResItems.Add(resItem);
            dbEntity.SaveChanges();

            return View("TestEditCash", res);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// ProductOnItem
        /// </summary>
        public ProductOnItem ProductOnItemTest()
        {
            GeneralResource oResource = new GeneralResource { };
            oLiveEntities.GeneralResources.Add(oResource);

            MemberOrganization oOrg = new MemberOrganization
            {
                Code = GetRandCode()
            };
            oLiveEntities.MemberOrganizations.Add(oOrg);

            ProductInformation oProd = new ProductInformation
            {
                Code = GetRandCode(),
                Organization = oOrg,
                Name = oResource
            };
            oLiveEntities.ProductInformations.Add(oProd);

            MemberChannel mChl = new MemberChannel
            {
                Code = GetRandCode()
            };
            oLiveEntities.MemberChannels.Add(mChl);

            MemberOrgChannel oOChl = new MemberOrgChannel
            {
                Organization = oOrg,
                Channel = mChl
            };
            oLiveEntities.MemberOrgChannels.Add(oOChl);

            ProductOnSale onSale = new ProductOnSale
            {
                Code = GetRandCode(),
                Product = oProd,
                Channel = mChl,
                Name = oResource
            };
            oLiveEntities.ProductOnSales.Add(onSale);

            ProductInfoItem oSku = new ProductInfoItem
            {
                Code = GetRandCode(),
                Organization = oOrg,
                Product = oProd
            };
            oLiveEntities.ProductInfoItems.Add(oSku);

            ProductOnItem oOnSku = new ProductOnItem
            {
                OnSale = onSale,
                SkuItem = oSku
            };
            oLiveEntities.ProductOnItems.Add(oOnSku);
            oLiveEntities.SaveChanges();
            return oOnSku;
        }
Ejemplo n.º 17
0
        public ActionResult OrgDetail(MemberOrganization memorganization)
        {
            MemberOrganization newOrg;
            if (!memorganization.Gid.ToString().Equals("00000000-0000-0000-0000-000000000000"))
            {
                newOrg = (from o in dbEntity.MemberOrganizations
                          where (o.Gid == memorganization.Gid && o.Deleted == false)
                          select o).Single();
                newOrg.Code = memorganization.Code;
                newOrg.ExCode = memorganization.ExCode;
                newOrg.Ostatus = memorganization.Ostatus;
                newOrg.Otype = memorganization.Otype;
                //newOrg.ExType = memorganization.ExType;
                //newOrg.ExtendType.Name = memorganization.ExtendType.Name;
                newOrg.ExType = memorganization.ExType;
                newOrg.ExtendType.aName = memorganization.ExtendType.aName;
                newOrg.ExtendType.Name.Matter = memorganization.ExtendType.Name.Matter;
                newOrg.aFullName = memorganization.aFullName;
                newOrg.FullName.Matter = memorganization.FullName.Matter;
                newOrg.aShortName = memorganization.aShortName;
                newOrg.ShortName.Matter = memorganization.ShortName.Matter;
                newOrg.FullAddress = memorganization.FullAddress;
                newOrg.Contact = memorganization.Contact;
                newOrg.WorkPhone = memorganization.WorkPhone;
                newOrg.CellPhone = memorganization.CellPhone;
                newOrg.WorkFax = memorganization.WorkFax;
                newOrg.Email = memorganization.Email;
                newOrg.HomeUrl = memorganization.HomeUrl;
                newOrg.Sorting = memorganization.Sorting;
                newOrg.Brief = memorganization.Brief;
                newOrg.aLocation = memorganization.aLocation;
                dbEntity.Entry(newOrg).State = System.Data.EntityState.Modified;
            }
            else
            {
                GeneralResource res = new GeneralResource
                {
                    Matter = memorganization.ExtendType.Name.Matter
                };
                GeneralStandardCategory sCat = new GeneralStandardCategory
                {
                    Code = "a test",
                    Name = res
                };
                newOrg = new MemberOrganization();
                newOrg.Code = memorganization.Code;
                newOrg.ExCode = memorganization.ExCode;
                newOrg.Ostatus = memorganization.Ostatus;
                newOrg.Otype = memorganization.Otype;
                //newOrg.ExType = memorganization.ExType;
                //newOrg.ExtendType.Name = memorganization.ExtendType.Name;
                //newOrg.ExType = memorganization.ExType;
                //newOrg.ExtendType.aName = memorganization.ExtendType.aName;
                //newOrg.ExtendType.Name.Matter = memorganization.ExtendType.Name.Matter;

                newOrg.ExtendType = sCat;

                newOrg.FullName = memorganization.FullName;
                newOrg.ShortName = memorganization.ShortName;

                //newOrg.aFullName = memorganization.aFullName;
                //newOrg.FullName.Matter = memorganization.FullName.Matter;
                //newOrg.aShortName = memorganization.aShortName;
                //newOrg.ShortName.Matter = memorganization.ShortName.Matter;
                newOrg.FullAddress = memorganization.FullAddress;
                newOrg.Contact = memorganization.Contact;
                newOrg.WorkPhone = memorganization.WorkPhone;
                newOrg.CellPhone = memorganization.CellPhone;
                newOrg.WorkFax = memorganization.WorkFax;
                newOrg.Email = memorganization.Email;
                newOrg.HomeUrl = memorganization.HomeUrl;
                newOrg.Sorting = memorganization.Sorting;
                newOrg.Brief = memorganization.Brief;
                newOrg.aLocation = memorganization.aLocation;
                dbEntity.MemberOrganizations.Add(newOrg);

            }
            dbEntity.SaveChanges();

            return RedirectToAction("Index");
        }
Ejemplo n.º 18
0
 /// <summary>
 /// 测试ProductOnUnitPrice
 /// </summary>
 /// <returns>新建的ProductOnUnitPrice对象</returns>
 public ProductOnUnitPrice ProductOnUnitPriceTest()
 {
     MemberOrganization oOrg = new MemberOrganization
     {
         Code = GetRandCode()
     };
     oLiveEntities.MemberOrganizations.Add(oOrg);
     oLiveEntities.SaveChanges();
     GeneralResource oName = new GeneralResource { };
     oLiveEntities.GeneralResources.Add(oName);
     oLiveEntities.SaveChanges();
     ProductInformation oProduct = new ProductInformation
     {
         Organization = oOrg,
         Code = GetRandCode(),
         Name = oName
     };
     oLiveEntities.ProductInformations.Add(oProduct);
     oLiveEntities.SaveChanges();
     ProductInfoItem oProductInfoItem = new ProductInfoItem
     {
         Organization = oOrg,
         Product = oProduct,
         Code = GetRandCode()
     };
     oLiveEntities.ProductInfoItems.Add(oProductInfoItem);
     oLiveEntities.SaveChanges();
     ProductOnItem oPOI = new ProductOnItem
     {
         OnSale = ProductOnSaleTest(),
         SkuItem = oProductInfoItem
     };
     oLiveEntities.ProductOnItems.Add(oPOI);
     oLiveEntities.SaveChanges();
     GeneralMeasureUnit oGMU = new GeneralMeasureUnit
     {
         Code = GetRandCode()
     };
     oLiveEntities.GeneralMeasureUnits.Add(oGMU);
     oLiveEntities.SaveChanges();
     ProductOnUnitPrice oPUP = new ProductOnUnitPrice
     {
         OnSkuItem = oPOI,
         ShowUnit = oGMU
     };
     oLiveEntities.ProductOnUnitPrices.Add(oPUP);
     oLiveEntities.SaveChanges();
     return oPUP;
 }
Ejemplo n.º 19
0
 /// <summary>
 /// 测试ProductOnSale
 /// </summary>
 /// <returns>新建的ProductOnSale对象</returns>
 public ProductOnSale ProductOnSaleTest()
 {
     MemberOrganization oOrg = new MemberOrganization
     {
         Code = GetRandCode()
     };
     oLiveEntities.MemberOrganizations.Add(oOrg);
     GeneralResource oName = new GeneralResource { };
     oLiveEntities.GeneralResources.Add(oName);
     ProductInformation oProduct = new ProductInformation
     {
         Organization = oOrg,
         Code = GetRandCode(),
         Name = oName
     };
     oLiveEntities.ProductInformations.Add(oProduct);
     MemberChannel oChannel = new MemberChannel
     {
         Code = GetRandCode()
     };
     oLiveEntities.MemberChannels.Add(oChannel);
     GeneralResource oName2 = new GeneralResource { };
     oLiveEntities.GeneralResources.Add(oName2);
     ProductOnSale oProductOnSale = new ProductOnSale
     {
         Product = oProduct,
         Channel = oChannel,
         Name = oName2,
         Code = GetRandCode()
     };
     oLiveEntities.ProductOnSales.Add(oProductOnSale);
     oLiveEntities.SaveChanges();
     return oProductOnSale;
 }
Ejemplo n.º 20
0
 /// <summary>
 /// 更新已经存在的资源文件,包括插入新语言/货币,删除过期的语言/货币等
 /// </summary>
 /// <param name="rtype">资源类型:字符,金额</param>
 /// <param name="resource">原资源文件</param>
 /// <param name="organID">组织ID,空表示用系统支持的语言/货币刷新</param>
 /// <returns>新资源文件</returns>
 public GeneralResource RefreshResource(ModelEnum.ResourceType rtype, GeneralResource resource, Guid? organID = null)
 {
     GeneralResource oResource = resource;
     if (oResource == null)
         oResource = this.NewResource(rtype, organID);
     oResource.Rtype = (byte)rtype;
     List<Guid> oGuidList = new List<Guid>();
     if (rtype == ModelEnum.ResourceType.MONEY)
     {
         List<GeneralMeasureUnit> oUnits = this.GetSupportCurrencies(organID);
         bool bIsFirst = true;
         foreach (var item in oUnits)
         {
             if (bIsFirst)
             {
                 oResource.Code = item.Code;
                 oResource.Currency = item.Gid;
             }
             else
             {
                 var resitem = oResource.ResourceItems.FirstOrDefault(i => i.Currency == item.Gid && i.Deleted == false);
                 if (resitem == null)
                     oResource.ResourceItems.Add(new GeneralResItem { Code = item.Code, Currency = item.Gid });
                 else
                     oGuidList.Add(resitem.Gid);
             }
             bIsFirst = false;
         }
     }
     else
     {
         List<GeneralCultureUnit> oCultures = this.GetSupportCultures(organID);
         bool bIsFirst = true;
         foreach (var item in oCultures)
         {
             if (bIsFirst)
             {
                 oResource.Culture = item.Culture;
             }
             else
             {
                 var resitem = oResource.ResourceItems.FirstOrDefault(i => i.Culture == item.Culture && i.Deleted == false);
                 if (resitem == null)
                     oResource.ResourceItems.Add(new GeneralResItem { Culture = item.Culture });
                 else
                     oGuidList.Add(resitem.Gid);
             }
             bIsFirst = false;
         }
     }
     // 删除过时的语言资源
     for (int i = 0; i < oResource.ResourceItems.Count; i++)
     {
         var item = oResource.ResourceItems.ElementAt(i);
         if (!item.Gid.Equals(Guid.Empty) && !oGuidList.Contains(item.Gid))
             oResource.ResourceItems.Remove(item);
     }
     return oResource;
 }
Ejemplo n.º 21
0
        /// <summary>
        /// 导入属性定义
        /// </summary>
        /// <param name="sExcelFile">Excel文件名</param>
        /// <param name="sSheetName">Sheet名</param>
        public void ImportOptional(string sExcelFile, string sSheetName)
        {
            try
            {
                ExcelData oExcel = new ExcelData(sExcelFile, sSheetName);
                DataColumn colOrgan = oExcel.ExcelTable.Columns["组织"];
                DataColumn colType = oExcel.ExcelTable.Columns["用途"];
                DataColumn colMainCode = oExcel.ExcelTable.Columns["属性代码"];
                DataColumn colOptCode = oExcel.ExcelTable.Columns["选项代码"];
                DataColumn colSorting = oExcel.ExcelTable.Columns["排序"];
                DataColumn colNameCN = oExcel.ExcelTable.Columns["中文名称"];
                DataColumn colNameUS = oExcel.ExcelTable.Columns["英文名称"];
                DataColumn colMode = oExcel.ExcelTable.Columns["输入模式"];
                DataColumn colRemark = oExcel.ExcelTable.Columns["备注"];

                string sLastOrgCode = "";
                MemberOrganization oOrgan = null;
                GeneralOptional oOption = null;
                foreach (DataRow row in oExcel.ExcelTable.Rows)
                {
                    string sOrgCode = row[colOrgan].ToString();
                    byte nType;
                    Byte.TryParse(row[colType].ToString(), out nType);
                    string sMainCode = row[colMainCode].ToString();
                    string sOptCode = row[colOptCode].ToString();
                    int nSorting;
                    Int32.TryParse(row[colSorting].ToString(), out nSorting);
                    GeneralResource oName = new GeneralResource(ModelEnum.ResourceType.STRING, 2052, row[colNameCN].ToString(), 1033, row[colNameUS].ToString());
                    byte nMode;
                    Byte.TryParse(row[colMode].ToString(), out nMode);
                    string sRemark = row[colRemark].ToString();

                    if (!String.IsNullOrEmpty(sOrgCode) && (sOrgCode != sLastOrgCode))
                    {
                        oOrgan = (from o in dbEntity.MemberOrganizations
                                  where o.Code == sOrgCode && o.Otype == (byte)ModelEnum.OrganizationType.CORPORATION
                                  select o).FirstOrDefault();
                        sLastOrgCode = sOrgCode;
                    }
                    if (!String.IsNullOrEmpty(sMainCode))
                    {
                        oOption = (from o in dbEntity.GeneralOptionals
                                   where o.OrgID == oOrgan.Gid && o.Code == sMainCode
                                   select o).FirstOrDefault();
                        if (oOption == null)
                        {
                            oOption = new GeneralOptional { Organization = oOrgan, Code = sMainCode };
                            dbEntity.GeneralOptionals.Add(oOption);
                        }
                        oOption.Otype = nType;
                        oOption.Sorting = nSorting;
                        if (oOption.Name == null)
                            oOption.Name = oName;
                        else
                            oOption.Name.SetResource(ModelEnum.ResourceType.STRING, oName);
                        oOption.InputMode = nMode;
                        oOption.Remark = sRemark;
                    }
                    else
                    {
                        GeneralOptItem oOptItem = (from i in dbEntity.GeneralOptItems
                                                   where i.Deleted == false && i.OptID == oOption.Gid && i.Code == sOptCode
                                                   select i).FirstOrDefault();
                        if (oOptItem == null)
                        {
                            oOptItem = new GeneralOptItem { Optional = oOption, Code = sOptCode };
                            dbEntity.GeneralOptItems.Add(oOptItem);
                        }
                        oOptItem.Sorting = nSorting;
                        if (oOptItem.Name == null)
                            oOptItem.Name = oName;
                        else
                            oOptItem.Name.SetResource(ModelEnum.ResourceType.STRING, oName);
                        oOptItem.Remark = sRemark;
                    }
                    dbEntity.SaveChanges();
                    if (Utility.ConfigHelper.GlobalConst.IsDebug)
                        Debug.WriteLine("{0} {1} {2}", this.ToString(), sMainCode, sRemark);
                }
                oEventBLL.WriteEvent(String.Format("导入GeneralOptional成功: {0} {1}", sExcelFile, sSheetName),
                    ModelEnum.ActionLevel.GENERIC, ModelEnum.ActionSource.SYSTEM, this.ToString());
            }
            catch (Exception ex)
            {
                oEventBLL.WriteEvent(String.Format("导入GeneralOptional错误: {0} {1} {2}", sExcelFile, sSheetName, ex.Message),
                    ModelEnum.ActionLevel.ERROR, ModelEnum.ActionSource.SYSTEM, this.ToString());
            }
        }
Ejemplo n.º 22
0
        public void ProductOnAdjustTest()
        {
            ProductOnSale oSale = ProductOnSaleTest();
            ProductOnItem oSku = ProductOnItemTest();

            MemberOrganization org = new MemberOrganization
            {
                Code = GetRandCode()
            };
            oLiveEntities.MemberOrganizations.Add(org);

            GeneralResource res = new GeneralResource
            {
            };
            oLiveEntities.GeneralResources.Add(res);

            ProductInformation prod = new ProductInformation
            {
                Name = res,
                Organization = org,
                Code = GetRandCode()
            };
            oLiveEntities.ProductInformations.Add(prod);

            ProductInfoItem infoItem = new ProductInfoItem
            {
                Organization = org,
                Product = prod,
                Code = GetRandCode()
            };
            oLiveEntities.ProductInfoItems.Add(infoItem);
            oLiveEntities.SaveChanges();

            ProductOnAdjust oAdjust = new ProductOnAdjust
            {
                OnSaleID = oSale.Gid,
                OnSkuID = oSku.Gid
            };
            oLiveEntities.ProductOnAdjusts.Add(oAdjust);
            oLiveEntities.SaveChanges();
        }
Ejemplo n.º 23
0
        /// <summary>
        /// 导入组织定义
        /// </summary>
        /// <param name="sExcelFile"></param>
        /// <param name="sSheetName"></param>
        public void ImportOrganizations(string sExcelFile, string sSheetName)
        {
            try
            {
                ExcelData oExcel = new ExcelData(sExcelFile, sSheetName);
                DataColumn colCode = oExcel.ExcelTable.Columns["代码"];
                DataColumn colOstatus = oExcel.ExcelTable.Columns["状态"];
                DataColumn colOtype = oExcel.ExcelTable.Columns["类型"];
                DataColumn colExCode = oExcel.ExcelTable.Columns["扩展代码"];
                DataColumn colExType = oExcel.ExcelTable.Columns["扩展类型"];
                DataColumn colExTypeCode = oExcel.ExcelTable.Columns["类型代码"];
                DataColumn colParent = oExcel.ExcelTable.Columns["上级"];
                DataColumn colTerminal = oExcel.ExcelTable.Columns["末级"];
                DataColumn colFullNameCN = oExcel.ExcelTable.Columns["中文完整名称"];
                DataColumn colFullNameUS = oExcel.ExcelTable.Columns["英文完整名称"];
                DataColumn colShortNameCN = oExcel.ExcelTable.Columns["中文简称"];
                DataColumn colShortNameUS = oExcel.ExcelTable.Columns["英文简称"];
                DataColumn colLocation = oExcel.ExcelTable.Columns["地区"];
                DataColumn colFullAddress = oExcel.ExcelTable.Columns["完整地址"];
                DataColumn colPostCode = oExcel.ExcelTable.Columns["邮政编码"];
                DataColumn colContact = oExcel.ExcelTable.Columns["联系人"];
                DataColumn colCellPhone = oExcel.ExcelTable.Columns["手机"];
                DataColumn colWorkPhone = oExcel.ExcelTable.Columns["电话"];
                DataColumn colWorkFax = oExcel.ExcelTable.Columns["传真"];
                DataColumn colEmail = oExcel.ExcelTable.Columns["电子邮件"];
                DataColumn colHomeUrl = oExcel.ExcelTable.Columns["主页"];
                DataColumn colBrief = oExcel.ExcelTable.Columns["简介"];
                DataColumn colIntroduction = oExcel.ExcelTable.Columns["介绍"];
                DataColumn colPuPolicy = oExcel.ExcelTable.Columns["PU编码规则"];
                DataColumn colSkuPolicy = oExcel.ExcelTable.Columns["SKU编码规则"];
                DataColumn colBarcodePolicy = oExcel.ExcelTable.Columns["条码编码规则"];
                DataColumn colRemark = oExcel.ExcelTable.Columns["备注"];

                foreach (DataRow row in oExcel.ExcelTable.Rows)
                {
                    string sCode = row[colCode].ToString();
                    byte nStatus;
                    Byte.TryParse(row[colOstatus].ToString(), out nStatus);
                    byte nType;
                    Byte.TryParse(row[colOtype].ToString(), out nType);
                    string sExCode = row[colExCode].ToString();

                    byte nExType;
                    Byte.TryParse(row[colExType].ToString(), out nExType);
                    string sExTypeCode = row[colExTypeCode].ToString();
                    var oExType = (from c in dbEntity.GeneralStandardCategorys
                                   where c.Ctype == nExType && c.Code == sExTypeCode
                                   select c).FirstOrDefault();

                    string sParent = row[colParent].ToString();
                    var oParent = (from m in dbEntity.MemberOrganizations
                                   where m.Code == sParent && m.Otype == (byte)ModelEnum.OrganizationType.CORPORATION
                                   select m).FirstOrDefault();

                    bool bLeaf = row[colTerminal].ToString() == "1" ? true : false;
                    GeneralResource oFullName = new GeneralResource(ModelEnum.ResourceType.STRING, 2052, row[colFullNameCN].ToString(), 1033, row[colFullNameUS].ToString());
                    GeneralResource oShortName = new GeneralResource(ModelEnum.ResourceType.STRING, 2052, row[colShortNameCN].ToString(), 1033, row[colShortNameUS].ToString());
                    string sLocation = row[colLocation].ToString();
                    var oLocation = (from r in dbEntity.GeneralRegions
                                     where r.Code == sLocation
                                     select r).FirstOrDefault();

                    string sFullAddress = row[colFullAddress].ToString();
                    string sPostCode = row[colPostCode].ToString();
                    string sContact = row[colContact].ToString();
                    string sCellPhone = row[colCellPhone].ToString();
                    string sWorkPhone = row[colWorkPhone].ToString();
                    string sWorkFax = row[colWorkFax].ToString();
                    string sEmail = row[colEmail].ToString();
                    string sHomeUrl = row[colHomeUrl].ToString();
                    string sBrief = row[colBrief].ToString();
                    string sIntroduction = row[colIntroduction].ToString();
                    string sPuPolicy = row[colPuPolicy].ToString();
                    string sSkuPolicy = row[colSkuPolicy].ToString();
                    string sBarcodePolicy = row[colBarcodePolicy].ToString();
                    string sRemark = row[colRemark].ToString();

                    switch ((ModelEnum.OrganizationType)nType)
                    {
                        case ModelEnum.OrganizationType.CORPORATION:
                            var oOrgan = (from o in dbEntity.MemberOrganizations
                                          where o.Code == sCode && o.Otype == nType
                                          select o).FirstOrDefault();
                            if (oOrgan == null)
                            {
                                oOrgan = new MemberOrganization
                                {
                                    Code = sCode,
                                    Otype = nType
                                };
                                dbEntity.MemberOrganizations.Add(oOrgan);
                            }
                            oOrgan.Ostatus = nStatus;
                            oOrgan.ExCode = sExCode;
                            oOrgan.ExtendType = oExType;
                            oOrgan.Parent = oParent;
                            oOrgan.Terminal = bLeaf;
                            if (oOrgan.FullName == null)
                                oOrgan.FullName = oFullName;
                            else
                                oOrgan.FullName.SetResource(ModelEnum.ResourceType.STRING, oFullName);
                            if (oOrgan.ShortName == null)
                                oOrgan.ShortName = oShortName;
                            else
                                oOrgan.ShortName.SetResource(ModelEnum.ResourceType.STRING, oShortName);
                            oOrgan.Location = oLocation;
                            oOrgan.FullAddress = sFullAddress;
                            oOrgan.PostCode = sPostCode;
                            oOrgan.Contact = sContact;
                            oOrgan.CellPhone = sCellPhone;
                            oOrgan.WorkPhone = sWorkPhone;
                            oOrgan.WorkFax = sWorkFax;
                            oOrgan.Email = sEmail;
                            oOrgan.HomeUrl = sHomeUrl;
                            oOrgan.Brief = sBrief;
                            if (!String.IsNullOrEmpty(sIntroduction))
                            {
                                if (oOrgan.Introduction == null)
                                    oOrgan.Introduction = new GeneralLargeObject(2052, sIntroduction);
                                else
                                    oOrgan.Introduction.SetLargeObject(2052, sIntroduction);
                            }
                            oOrgan.ProdCodePolicy = sPuPolicy;
                            oOrgan.SkuCodePolicy = sSkuPolicy;
                            oOrgan.BarcodePolicy = sBarcodePolicy;
                            oOrgan.Remark = sRemark;
                            dbEntity.SaveChanges();
                            break;
                        case ModelEnum.OrganizationType.CHANNEL:
                            var oChannel = (from o in dbEntity.MemberChannels
                                            where o.Code == sCode && o.Otype == nType
                                            select o).FirstOrDefault();
                            if (oChannel == null)
                            {
                                oChannel = new MemberChannel
                                {
                                    Code = sCode,
                                    Otype = nType
                                };
                                dbEntity.MemberChannels.Add(oChannel);
                            }
                            oChannel.Ostatus = nStatus;
                            oChannel.ExCode = sExCode;
                            oChannel.ExtendType = oExType;
                            oChannel.Parent = oParent;
                            oChannel.Terminal = bLeaf;
                            if (oChannel.FullName == null)
                                oChannel.FullName = oFullName;
                            else
                                oChannel.FullName.SetResource(ModelEnum.ResourceType.STRING, oFullName);
                            if (oChannel.ShortName == null)
                                oChannel.ShortName = oShortName;
                            else
                                oChannel.ShortName.SetResource(ModelEnum.ResourceType.STRING, oShortName);
                            oChannel.Location = oLocation;
                            oChannel.FullAddress = sFullAddress;
                            oChannel.PostCode = sPostCode;
                            oChannel.Contact = sContact;
                            oChannel.CellPhone = sCellPhone;
                            oChannel.WorkPhone = sWorkPhone;
                            oChannel.WorkFax = sWorkFax;
                            oChannel.Email = sEmail;
                            oChannel.HomeUrl = sHomeUrl;
                            oChannel.Brief = sBrief;
                            if (!String.IsNullOrEmpty(sIntroduction))
                            {
                                if (oChannel.Introduction == null)
                                    oChannel.Introduction = new GeneralLargeObject(2052, sIntroduction);
                                else
                                    oChannel.Introduction.SetLargeObject(2052, sIntroduction);
                            }
                            oChannel.ProdCodePolicy = sPuPolicy;
                            oChannel.SkuCodePolicy = sSkuPolicy;
                            oChannel.BarcodePolicy = sBarcodePolicy;
                            oChannel.Remark = sRemark;
                            dbEntity.SaveChanges();
                            break;
                        case ModelEnum.OrganizationType.SHIPPER:
                            var oShipper = (from o in dbEntity.ShippingInformations
                                            where o.Code == sCode && o.Otype == nType
                                            select o).FirstOrDefault();
                            if (oShipper == null)
                            {
                                oShipper = new ShippingInformation
                                {
                                    Code = sCode,
                                    Otype = nType
                                };
                                dbEntity.ShippingInformations.Add(oShipper);
                            }
                            oShipper.Ostatus = nStatus;
                            oShipper.ExCode = sExCode;
                            oShipper.ExtendType = oExType;
                            oShipper.Parent = oParent;
                            oShipper.Terminal = bLeaf;
                            if (oShipper.FullName == null)
                                oShipper.FullName = oFullName;
                            else
                                oShipper.FullName.SetResource(ModelEnum.ResourceType.STRING, oFullName);
                            if (oShipper.ShortName == null)
                                oShipper.ShortName = oShortName;
                            else
                                oShipper.ShortName.SetResource(ModelEnum.ResourceType.STRING, oShortName);
                            oShipper.Location = oLocation;
                            oShipper.FullAddress = sFullAddress;
                            oShipper.PostCode = sPostCode;
                            oShipper.Contact = sContact;
                            oShipper.CellPhone = sCellPhone;
                            oShipper.WorkPhone = sWorkPhone;
                            oShipper.WorkFax = sWorkFax;
                            oShipper.Email = sEmail;
                            oShipper.HomeUrl = sHomeUrl;
                            oShipper.Brief = sBrief;
                            if (!String.IsNullOrEmpty(sIntroduction))
                            {
                                if (oShipper.Introduction == null)
                                    oShipper.Introduction = new GeneralLargeObject(2052, sIntroduction);
                                else
                                    oShipper.Introduction.SetLargeObject(2052, sIntroduction);
                            }
                            oShipper.ProdCodePolicy = sPuPolicy;
                            oShipper.SkuCodePolicy = sSkuPolicy;
                            oShipper.BarcodePolicy = sBarcodePolicy;
                            oShipper.Remark = sRemark;
                            dbEntity.SaveChanges();
                            break;
                        case ModelEnum.OrganizationType.SUPPLIER:
                            var oSupplier = (from o in dbEntity.PurchaseSuppliers
                                             where o.Code == sCode && o.Otype == nType
                                             select o).FirstOrDefault();
                            if (oSupplier == null)
                            {
                                oSupplier = new PurchaseSupplier
                                {
                                    Code = sCode,
                                    Otype = nType
                                };
                                dbEntity.PurchaseSuppliers.Add(oSupplier);
                            }
                            oSupplier.Ostatus = nStatus;
                            oSupplier.ExCode = sExCode;
                            oSupplier.ExtendType = oExType;
                            oSupplier.Parent = oParent;
                            oSupplier.Terminal = bLeaf;
                            if (oSupplier.FullName == null)
                                oSupplier.FullName = oFullName;
                            else
                                oSupplier.FullName.SetResource(ModelEnum.ResourceType.STRING, oFullName);
                            if (oSupplier.ShortName == null)
                                oSupplier.ShortName = oShortName;
                            else
                                oSupplier.ShortName.SetResource(ModelEnum.ResourceType.STRING, oShortName);
                            oSupplier.Location = oLocation;
                            oSupplier.FullAddress = sFullAddress;
                            oSupplier.PostCode = sPostCode;
                            oSupplier.Contact = sContact;
                            oSupplier.CellPhone = sCellPhone;
                            oSupplier.WorkPhone = sWorkPhone;
                            oSupplier.WorkFax = sWorkFax;
                            oSupplier.Email = sEmail;
                            oSupplier.HomeUrl = sHomeUrl;
                            oSupplier.Brief = sBrief;
                            if (!String.IsNullOrEmpty(sIntroduction))
                            {
                                if (oSupplier.Introduction == null)
                                    oSupplier.Introduction = new GeneralLargeObject(2052, sIntroduction);
                                else
                                    oSupplier.Introduction.SetLargeObject(2052, sIntroduction);
                            }
                            oSupplier.ProdCodePolicy = sPuPolicy;
                            oSupplier.SkuCodePolicy = sSkuPolicy;
                            oSupplier.BarcodePolicy = sBarcodePolicy;
                            oSupplier.Remark = sRemark;
                            dbEntity.SaveChanges();
                            break;
                        case ModelEnum.OrganizationType.WAREHOUSE:
                            var oWarehouse = (from o in dbEntity.WarehouseInformations
                                              where o.Code == sCode && o.Otype == nType
                                              select o).FirstOrDefault();
                            if (oWarehouse == null)
                            {
                                oWarehouse = new WarehouseInformation
                                {
                                    Code = sCode,
                                    Otype = nType
                                };
                                dbEntity.WarehouseInformations.Add(oWarehouse);
                            }
                            oWarehouse.Ostatus = nStatus;
                            oWarehouse.ExCode = sExCode;
                            oWarehouse.ExtendType = oExType;
                            oWarehouse.Parent = oParent;
                            oWarehouse.Terminal = bLeaf;
                            if (oWarehouse.FullName == null)
                                oWarehouse.FullName = oFullName;
                            else
                                oWarehouse.FullName.SetResource(ModelEnum.ResourceType.STRING, oFullName);
                            if (oWarehouse.ShortName == null)
                                oWarehouse.ShortName = oShortName;
                            else
                                oWarehouse.ShortName.SetResource(ModelEnum.ResourceType.STRING, oShortName);
                            oWarehouse.Location = oLocation;
                            oWarehouse.FullAddress = sFullAddress;
                            oWarehouse.PostCode = sPostCode;
                            oWarehouse.Contact = sContact;
                            oWarehouse.CellPhone = sCellPhone;
                            oWarehouse.WorkPhone = sWorkPhone;
                            oWarehouse.WorkFax = sWorkFax;
                            oWarehouse.Email = sEmail;
                            oWarehouse.HomeUrl = sHomeUrl;
                            oWarehouse.Brief = sBrief;
                            if (!String.IsNullOrEmpty(sIntroduction))
                            {
                                if (oWarehouse.Introduction == null)
                                    oWarehouse.Introduction = new GeneralLargeObject(2052, sIntroduction);
                                else
                                    oWarehouse.Introduction.SetLargeObject(2052, sIntroduction);
                            }
                            oWarehouse.ProdCodePolicy = sPuPolicy;
                            oWarehouse.SkuCodePolicy = sSkuPolicy;
                            oWarehouse.BarcodePolicy = sBarcodePolicy;
                            oWarehouse.Remark = sRemark;
                            dbEntity.SaveChanges();
                            break;
                    }
                    if (Utility.ConfigHelper.GlobalConst.IsDebug)
                        Debug.WriteLine("{0} {1} {2}", this.ToString(), sCode, oFullName.Matter);
                }
                oEventBLL.WriteEvent(String.Format("导入MemberOrganization成功: {0} {1}", sExcelFile, sSheetName),
                    ModelEnum.ActionLevel.GENERIC, ModelEnum.ActionSource.SYSTEM, this.ToString());
            }
            catch (Exception ex)
            {
                oEventBLL.WriteEvent(String.Format("导入MemberOrganization错误: {0} {1} {2}", sExcelFile, sSheetName, ex.Message),
                    ModelEnum.ActionLevel.ERROR, ModelEnum.ActionSource.SYSTEM, this.ToString());
            }
        }
Ejemplo n.º 24
0
        public void TestOld()
        {
            LiveEntities dbEntity = new LiveEntities(ConfigHelper.LiveConnection.Connection);

            CultureInfo oCulture1 = new CultureInfo("zh-CN");
            CultureInfo oCulture2 = new CultureInfo("zh-TW");
            CultureInfo oCulture = new CultureInfo("ja-JP");
            decimal dm = 123894.56m;
            string s1 = oCulture.NumberFormat.CurrencySymbol + dm.ToString(oCulture.NumberFormat);
            Debug.WriteLine(s1);

            string symbolRMB = (new CultureInfo("zh-CN")).NumberFormat.CurrencySymbol;
            string symbolUSD = (new CultureInfo("en-US")).NumberFormat.CurrencySymbol;
            string symbolEUR = (new CultureInfo("fr-FR")).NumberFormat.CurrencySymbol;
            Guid? oUnitRMB = (from m in dbEntity.GeneralMeasureUnits
                              where m.Code == symbolRMB
                              select m.Gid).FirstOrDefault();
            Guid? oUnitUSD = (from m in dbEntity.GeneralMeasureUnits
                              where m.Code == symbolUSD
                              select m.Gid).FirstOrDefault();
            Guid? oUnitEUR = (from m in dbEntity.GeneralMeasureUnits
                              where m.Code == symbolEUR
                              select m.Gid).FirstOrDefault();

            GeneralResource oMoney = new GeneralResource
            {
                Rtype = (byte)ModelEnum.ResourceType.MONEY,
                Currency = oUnitRMB,
                Cash = 123.56m,
                ResourceItems = new List<GeneralResItem>
                {
                    new GeneralResItem { Currency = oUnitUSD, Cash = 34.67m },
                    new GeneralResItem { Currency = oUnitEUR, Cash = 31.69m }
                }
            };
            dbEntity.GeneralResources.Add(oMoney);
            dbEntity.SaveChanges();

            GeneralBLL oGeneralBLL = new GeneralBLL(dbEntity);
            string sm = oGeneralBLL.GetMoneyString(oMoney.Gid, oUnitRMB);

            string sMoneyCode1 = oMoney.GetCurrencyUnit(dbEntity).Code;
            string sMoneyCode2 = oMoney.GetCurrencyUnit(dbEntity, oUnitUSD.Value).Code;

            GeneralProgNode oProgNode = new GeneralProgNode
            {
                Program = dbEntity.GeneralPrograms.Where(p => p.Code == "ConfigIndex").FirstOrDefault(),
                Code = "EnableModify",
                Name = new GeneralResource
                {
                    Culture = 1033,
                    Matter = "Modify",
                    ResourceItems = new List<GeneralResItem>
                    {
                        new GeneralResItem { Culture = 2052, Matter = "允许修改" }
                    }
                },
                InputMode = (byte)ModelEnum.OptionalInputMode.COMBOBOX,
                Optional = new GeneralResource
                {
                    Culture = 1033,
                    Matter = "{0|No},{1|Yes}",
                    ResourceItems = new List<GeneralResItem>
                    {
                        new GeneralResItem { Culture = 2052, Matter = "{0|否},{1|是}" }
                    }
                }
            };
            dbEntity.GeneralProgNodes.Add(oProgNode);
            dbEntity.SaveChanges();

            MemberPrivilege oPrivilege = new MemberPrivilege
            {
                User = dbEntity.MemberUsers.Where(u => u.LoginName == "test").FirstOrDefault(),
                Ptype = (byte)ModelEnum.UserPrivType.PROGRAM_NODE,
                PrivilegeItems = new List<MemberPrivItem>
                {
                     new MemberPrivItem
                     {
                         RefID = oProgNode.Gid,
                         NodeCode = "EnableModify",
                         NodeValue = "1"
                     }
                }
            };
            dbEntity.MemberPrivileges.Add(oPrivilege);
            dbEntity.SaveChanges();

            Dictionary<string, string> oProgramNodes = new Dictionary<string, string>();
            oProgramNodes.Add("Supervisor", "1");
            if (oProgramNodes.ContainsKey("Supervisor") && (oProgramNodes["Supervisor"] == "1"))
            {
                Debug.WriteLine(oProgramNodes["Supervisor"]);
            }
            if (oProgramNodes.ContainsKey("Key") && (oProgramNodes["Key"] == "1"))
            {
                string s = oProgramNodes["Key"];
                Debug.WriteLine(s);
            }

            TimeSpan oTimeSpan = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Now);
            DateTimeOffset oLocalTime1 = new DateTimeOffset(2011, 8, 24, 13, 45, 24, oTimeSpan);

            DateTime oLocalTime2 = DateTime.Now;
            oLocalTime2 = DateTime.SpecifyKind(oLocalTime2, DateTimeKind.Utc);
            DateTimeOffset oLocalTime3 = oLocalTime2;
            DateTimeOffset oLocalTime4 = oLocalTime1;

            GeneralConfig oConfig1 = new GeneralConfig
            {
                Code = "Test11",
                DateValue = oLocalTime1
            };
            GeneralConfig oConfig2 = new GeneralConfig
            {
                Code = "Test21",
                DateValue = oLocalTime3
            };
            GeneralConfig oConfig3 = new GeneralConfig
            {
                Code = "Test31",
                DateValue = oLocalTime4
            };

            dbEntity.GeneralConfigs.Add(oConfig1);
            dbEntity.GeneralConfigs.Add(oConfig2);
            dbEntity.GeneralConfigs.Add(oConfig3);
            dbEntity.SaveChanges();

            GeneralTodoList oTodo2 = (from t in dbEntity.GeneralTodoLists
                                      where t.Gid == new Guid("3429BF77-1ECE-E011-A3A0-60EB69D65AE8")
                                      select t).FirstOrDefault();

            // string strSQL = String.Format("SELECT * FROM dbo.fn_FindTest('{0}')", Guid.Empty);
            // string strSQL = String.Format("EXECUTE sp_FindTest '{0}'", Guid.Empty);

            var fnFindTest = dbEntity.Database.SqlQuery<ShipList>("SELECT * FROM fn_FindTest({0})", Guid.Empty);

            foreach (ShipList fnItem in fnFindTest)
            {
                Debug.WriteLine(fnItem.ShipID);
                Debug.WriteLine(fnItem.ShipWeight);
            }

            Guid og = Guid.Empty;
            Guid? og1 = null;
            Guid? og2 = Guid.NewGuid();
            Guid? og3 = Guid.Empty;
            if (og == Guid.Empty)
                Debug.WriteLine(og);
            if (og1.HasValue)
                Debug.WriteLine(og1.Value);
            if (og2.HasValue)
                Debug.WriteLine(og2.Value);
            if (og3.HasValue)
                Debug.WriteLine(og3.Value);

            var list = from c in dbEntity.WarehouseInformations
                       where c.Deleted == false
                       select c.Parent;
            foreach (var v in list)
            {
                Debug.WriteLine(v.FullName.Matter);

                //Debug.WriteLine(v.Key);
                //foreach (var item in v)
                //{
                //    Debug.WriteLine(item.FullName.Matter);
                //}
                //if (v.FullName == null)
                //    Debug.WriteLine("is null");
                //foreach (var v2 in v.FullName.ResourceItems)
                //    Debug.WriteLine(v2.Matter);
            }

            EventBLL oEventBLL = new EventBLL(dbEntity);
            oEventBLL.WriteEvent("系统启动", ModelEnum.ActionLevel.ERROR, ModelEnum.ActionSource.SYSTEM, this.ToString());

            GeneralConfig oConfig = dbEntity.GeneralConfigs.Where(c => c.Code == "SessionName").FirstOrDefault();

            List<ListItem> oList2 = oConfig.SelectEnumList(typeof(ModelEnum.ActionSource), 2);
            string oListName = oConfig.SelectEnumName(typeof(ModelEnum.ActionSource), 2);
        }
Ejemplo n.º 25
0
        private static void Test02(string s)
        {
            LiveEntities oGeneralEntities = new LiveEntities(ConfigHelper.LiveConnection.Connection);
            // 指定Child方式
            GeneralResItem oResItemA1 = new GeneralResItem
            {
                Culture = 1033,
                Matter = "Product Name (En)"
            };
            GeneralResItem oResItemA2 = new GeneralResItem
            {
                Culture = 1036,
                Matter = "Product Name (Fr)"
            };
            GeneralResource oResourceA = new GeneralResource
            {
                Rtype = (byte)ModelEnum.ResourceType.STRING,
                Matter = "产品名称",
                ResourceItems = new List<GeneralResItem> { oResItemA1, oResItemA2 }
            };
            // 指定Parent方式
            GeneralResource oResourceB = new GeneralResource
            {
                Rtype = (byte)ModelEnum.ResourceType.MONEY,
                Matter = "产品名称"
            };
            GeneralResItem oResItemB1 = new GeneralResItem
            {
                Culture = 1033,
                Matter = "Product Name (En)",
                Resource = oResourceB
            };
            GeneralResItem oResItemB2 = new GeneralResItem
            {
                Culture = 1036,
                Matter = "Product Name (Fr)",
                Resource = oResourceB
            };

            oGeneralEntities.GeneralResources.Add(oResourceA);
            oGeneralEntities.GeneralResItems.Add(oResItemB1);
            oGeneralEntities.GeneralResItems.Add(oResItemB2);
            oGeneralEntities.SaveChanges();

            var oResources = oGeneralEntities.GeneralResources.Include("GeneralResItems");
            foreach (GeneralResource obj1 in oResources.ToList())
            {
                Console.WriteLine(obj1.Matter);
                foreach (GeneralResItem obj2 in obj1.ResourceItems)
                {
                    CultureInfo oCulture = new CultureInfo(obj2.Culture);
                    Console.WriteLine("    " + oCulture.NativeName + " " + obj2.Matter);
                }
            }
            oGeneralEntities.Dispose();
            GC.Collect();
        }
Ejemplo n.º 26
0
        /// <summary>
        /// 导入支付方式
        /// </summary>
        /// <param name="sExcelFile">Excel文件名</param>
        /// <param name="sSheetName">Sheet名</param>
        public void ImportPaymentType(string sExcelFile, string sSheetName)
        {
            try
            {
                ExcelData oExcel = new ExcelData(sExcelFile, sSheetName);
                DataColumn colOrgan = oExcel.ExcelTable.Columns["组织"];
                DataColumn colCode = oExcel.ExcelTable.Columns["代码"];
                DataColumn colNameCN = oExcel.ExcelTable.Columns["中文名称"];
                DataColumn colNameUS = oExcel.ExcelTable.Columns["英文名称"];
                DataColumn colMatter = oExcel.ExcelTable.Columns["简单描述"];
                DataColumn colStatus = oExcel.ExcelTable.Columns["状态"];
                DataColumn colSorting = oExcel.ExcelTable.Columns["排序"];
                DataColumn colIsCod = oExcel.ExcelTable.Columns["货到付款"];
                DataColumn colIsOnline = oExcel.ExcelTable.Columns["在线支付"];
                DataColumn colIsSecured = oExcel.ExcelTable.Columns["担保交易"];
                DataColumn colFee = oExcel.ExcelTable.Columns["手续费率"];
                DataColumn colConfig = oExcel.ExcelTable.Columns["配置密钥"];
                DataColumn colRemark = oExcel.ExcelTable.Columns["备注"];

                foreach (DataRow row in oExcel.ExcelTable.Rows)
                {
                    string sOrganCode = row[colOrgan].ToString();
                    var oOrgan = (from o in dbEntity.MemberOrganizations
                                  where o.Code == sOrganCode && o.Otype == (byte)ModelEnum.OrganizationType.CORPORATION
                                  select o).FirstOrDefault();
                    string sCode = row[colCode].ToString();
                    GeneralResource oName = new GeneralResource(ModelEnum.ResourceType.STRING, 2052, row[colNameCN].ToString(), 1033, row[colNameUS].ToString());
                    string sMatter = row[colMatter].ToString();
                    byte nStatus;
                    Byte.TryParse(row[colStatus].ToString(), out nStatus);
                    int nSorting;
                    Int32.TryParse(row[colSorting].ToString(), out nSorting);
                    bool bIsCod = (row[colIsCod].ToString() == "1") ? true : false;
                    bool bIsOnline = (row[colIsOnline].ToString() == "1") ? true : false;
                    bool bIsSecured = (row[colIsSecured].ToString() == "1") ? true : false;
                    decimal mFee;
                    Decimal.TryParse(row[colFee].ToString(), out mFee);
                    string sConfig = row[colConfig].ToString();
                    string sRemark = row[colRemark].ToString();

                    var oPayType = (from t in dbEntity.FinancePayTypes
                                    where t.OrgID == oOrgan.Gid && t.Code == sCode
                                    select t).FirstOrDefault();
                    if (oPayType == null)
                    {
                        oPayType = new FinancePayType { Organization = oOrgan, Code = sCode };
                        dbEntity.FinancePayTypes.Add(oPayType);
                    }
                    if (oPayType.Name == null)
                        oPayType.Name = oName;
                    else
                        oPayType.Name.SetResource(ModelEnum.ResourceType.STRING, oName);
                    oPayType.Matter = sMatter;
                    oPayType.Pstatus = nStatus;
                    oPayType.Sorting = nSorting;
                    oPayType.IsCod = bIsCod;
                    oPayType.IsOnline = bIsOnline;
                    oPayType.IsSecured = bIsSecured;
                    oPayType.Fee = mFee;
                    oPayType.Config = sConfig;
                    oPayType.Remark = sRemark;
                    dbEntity.SaveChanges();
                    if (Utility.ConfigHelper.GlobalConst.IsDebug)
                        Debug.WriteLine("{0} {1} {2}", this.ToString(), sCode, sRemark);
                }
                oEventBLL.WriteEvent(String.Format("导入FinancePayType成功: {0} {1}", sExcelFile, sSheetName),
                    ModelEnum.ActionLevel.GENERIC, ModelEnum.ActionSource.SYSTEM, this.ToString());
            }
            catch (Exception ex)
            {
                oEventBLL.WriteEvent(String.Format("导入FinancePayType错误: {0} {1} {2}", sExcelFile, sSheetName, ex.Message),
                    ModelEnum.ActionLevel.ERROR, ModelEnum.ActionSource.SYSTEM, this.ToString());
            }
        }
Ejemplo n.º 27
0
 /// <summary>
 /// 获取GeneralResource字符串的当前语言值
 /// </summary>
 /// <param name="res"></param>
 /// <returns></returns>
 public string GetMatterValue(GeneralResource res)
 {
     int currentCulture = CurrentSession.Culture;
     string matter = string.Empty;
     if (currentCulture == res.Culture)
         matter = res.Matter;
     else
     {
         foreach (GeneralResItem item in res.ResourceItems)
         {
             if (currentCulture == item.Culture)
             {
                 matter = item.Matter;
                 break;
             }
         }
     }
     return matter;
 }
Ejemplo n.º 28
0
        /// <summary>
        /// 导入私有分类
        /// </summary>
        /// <param name="sExcelFile"></param>
        /// <param name="sSheetName"></param>
        public void ImportPrivateCategories(string sExcelFile, string sSheetName)
        {
            try
            {
                ExcelData oExcel = new ExcelData(sExcelFile, sSheetName);
                DataColumn colOrgan = oExcel.ExcelTable.Columns["组织"];
                DataColumn colCode = oExcel.ExcelTable.Columns["代码"];
                DataColumn colParent = oExcel.ExcelTable.Columns["上级"];
                DataColumn colType = oExcel.ExcelTable.Columns["类型"];
                DataColumn colNameCN = oExcel.ExcelTable.Columns["中文名称"];
                DataColumn colNameUS = oExcel.ExcelTable.Columns["英文名称"];
                DataColumn colSort = oExcel.ExcelTable.Columns["排序"];
                DataColumn colUnitType = oExcel.ExcelTable.Columns["单位类型"];
                DataColumn colUnitCode = oExcel.ExcelTable.Columns["计量单位"];
                DataColumn colShow = oExcel.ExcelTable.Columns["是否显示"];
                DataColumn colGuarantee = oExcel.ExcelTable.Columns["显示保质期"];
                DataColumn colRemark = oExcel.ExcelTable.Columns["备注"];

                string sLastParent = "";
                GeneralPrivateCategory oParent = null;
                foreach (DataRow row in oExcel.ExcelTable.Rows)
                {
                    string sOrgan = row[colOrgan].ToString();
                    var oOrgan = (from o in dbEntity.MemberOrganizations
                                  where o.Code == sOrgan && o.Otype == (byte)ModelEnum.OrganizationType.CORPORATION
                                  select o).FirstOrDefault();
                    string sCode = row[colCode].ToString();
                    string sParent = row[colParent].ToString();
                    byte nType;
                    Byte.TryParse(row[colType].ToString(), out nType);
                    GeneralResource oName = new GeneralResource(ModelEnum.ResourceType.STRING, 2052, row[colNameCN].ToString(), 1033, row[colNameUS].ToString());
                    int nSort;
                    Int32.TryParse(row[colSort].ToString(), out nSort);
                    byte nUnitType;
                    Byte.TryParse(row[colUnitType].ToString(), out nUnitType);
                    string sUnitCode = row[colUnitCode].ToString();
                    bool bShow = row[colShow].ToString() == "1" ? true : false;
                    bool bGuarantee = row[colGuarantee].ToString() == "1" ? true : false;
                    string sRemark = row[colRemark].ToString();

                    if (String.IsNullOrEmpty(sParent))
                    {
                        oParent = null;
                        sLastParent = "";
                    }
                    else if (sParent != sLastParent)
                    {
                        oParent = (from c in dbEntity.GeneralPrivateCategorys
                                   where c.OrgID == oOrgan.Gid && c.Ctype == nType && c.Code == sParent
                                   select c).FirstOrDefault();
                        sLastParent = sParent;
                    }
                    var oCategory = (from c in dbEntity.GeneralPrivateCategorys
                                     where c.OrgID == oOrgan.Gid && c.Ctype == nType && c.Code == sCode
                                     select c).FirstOrDefault();
                    if (oCategory == null)
                    {
                        oCategory = new GeneralPrivateCategory { Organization = oOrgan, Ctype = nType, Code = sCode };
                        dbEntity.GeneralPrivateCategorys.Add(oCategory);
                    }
                    oCategory.Parent = oParent;
                    if (oCategory.Name == null)
                        oCategory.Name = oName;
                    else
                        oCategory.Name.SetResource(ModelEnum.ResourceType.STRING, oName);
                    oCategory.Sorting = nSort;
                    oCategory.StandardUnit = dbEntity.GeneralMeasureUnits.Where(u => u.Utype == nUnitType && u.Code == sUnitCode).FirstOrDefault();
                    oCategory.Show = bShow;
                    oCategory.ShowGuarantee = bGuarantee;
                    oCategory.Remark = sRemark;
                    dbEntity.SaveChanges();
                    if (Utility.ConfigHelper.GlobalConst.IsDebug)
                        Debug.WriteLine("{0} {1} {2}", this.ToString(), sCode, sRemark);
                }
                oEventBLL.WriteEvent(String.Format("导入GeneralPrivateCategory成功: {0} {1}", sExcelFile, sSheetName),
                    ModelEnum.ActionLevel.GENERIC, ModelEnum.ActionSource.SYSTEM, this.ToString());
            }
            catch (Exception ex)
            {
                oEventBLL.WriteEvent(String.Format("导入GeneralPrivateCategory错误: {0} {1} {2}", sExcelFile, sSheetName, ex.Message),
                    ModelEnum.ActionLevel.ERROR, ModelEnum.ActionSource.SYSTEM, this.ToString());
            }
        }
Ejemplo n.º 29
0
        /// <summary>
        /// 测试方法,最终将被舍弃
        /// </summary>
        /// <returns></returns>
        public ActionResult TestEditMatter()
        {
            GeneralResource res = new GeneralResource
            {
                Rtype = (byte)ModelEnum.ResourceType.STRING,
                Culture = 2052,
                Matter = "我是中文名字"
            };
            GeneralResItem resitem1 = new GeneralResItem
            {
                Culture = 1036,
                Matter = "我是法国名字(PS:我不会法文,囧)",
                Resource = res
            };
            GeneralResItem resitem2 = new GeneralResItem
            {
                Culture = 1031,
                Matter = "It's an English name.",
                Resource = res
            };
            dbEntity.GeneralResources.Add(res);
            dbEntity.GeneralResItems.Add(resitem1);
            dbEntity.GeneralResItems.Add(resitem2);
            dbEntity.SaveChanges();

            return View("TestEditMatter", res);
        }
Ejemplo n.º 30
0
        /// <summary>
        /// 导入商品定义,包括PU和SKU
        /// </summary>
        /// <param name="sExcelFile">Excel文件名</param>
        /// <param name="sSheetName">Sheet名</param>
        public void ImportProduct(string sExcelFile, string sSheetName)
        {
            try
            {
                ExcelData oExcel = new ExcelData(sExcelFile, sSheetName);
                DataColumn colOrgan = oExcel.ExcelTable.Columns["组织"];
                DataColumn colProdCode = oExcel.ExcelTable.Columns["PU代码"];
                DataColumn colSkuCode = oExcel.ExcelTable.Columns["SKU代码"];
                DataColumn colBarcode = oExcel.ExcelTable.Columns["条码"];
                DataColumn colExCode1 = oExcel.ExcelTable.Columns["自定义编码"];
                DataColumn colProdNameCN = oExcel.ExcelTable.Columns["PU中文名称"];
                DataColumn colSkuNameCN = oExcel.ExcelTable.Columns["SKU中文名称"];
                DataColumn colStdCat = oExcel.ExcelTable.Columns["标准分类"];
                DataColumn colPrvCat = oExcel.ExcelTable.Columns["私有分类"];
                DataColumn colBlock = oExcel.ExcelTable.Columns["拆单分组标志"];
                DataColumn colMode = oExcel.ExcelTable.Columns["产品模式"];
                DataColumn colUnitType = oExcel.ExcelTable.Columns["单位类型"];
                DataColumn colUnitCode = oExcel.ExcelTable.Columns["单位代码"];
                DataColumn colPercision = oExcel.ExcelTable.Columns["计量精度"];
                DataColumn colSpecification = oExcel.ExcelTable.Columns["规格"];
                DataColumn colProdPicture = oExcel.ExcelTable.Columns["主图路径"];
                DataColumn colBriefCN = oExcel.ExcelTable.Columns["简单描述"];
                DataColumn colIntroCN = oExcel.ExcelTable.Columns["详细描述"];
                DataColumn colMinQuantity = oExcel.ExcelTable.Columns["起订量"];
                DataColumn colCycle = oExcel.ExcelTable.Columns["生产周期"];
                DataColumn colGuarantee = oExcel.ExcelTable.Columns["保质期"];
                DataColumn colMarketPriceRMB = oExcel.ExcelTable.Columns["市场价¥"];
                DataColumn colSuggestPriceRMB = oExcel.ExcelTable.Columns["建议价¥"];
                DataColumn colLowestPriceRMB = oExcel.ExcelTable.Columns["最低价¥"];
                DataColumn colKeywords = oExcel.ExcelTable.Columns["关键词"];
                DataColumn colGrossWeight = oExcel.ExcelTable.Columns["毛重"];
                DataColumn colNetWeight = oExcel.ExcelTable.Columns["净重"];
                DataColumn colGrossVolume = oExcel.ExcelTable.Columns["毛体积"];
                DataColumn colNetVolume = oExcel.ExcelTable.Columns["净体积"];
                DataColumn colNetPiece = oExcel.ExcelTable.Columns["计件"];
                DataColumn colRemark = oExcel.ExcelTable.Columns["备注"];

                ProductInformation oProduct = null;
                MemberOrganization oOrgan = null;
                foreach (DataRow row in oExcel.ExcelTable.Rows)
                {
                    string sOrgan = row[colOrgan].ToString();
                    if (!String.IsNullOrEmpty(sOrgan))
                        oOrgan = (from o in dbEntity.MemberOrganizations
                                  where o.Code == sOrgan && o.Otype == (byte)ModelEnum.OrganizationType.CORPORATION
                                  select o).FirstOrDefault();
                    string sProdCode = row[colProdCode].ToString();
                    string sSkuCode = row[colSkuCode].ToString();
                    if (String.IsNullOrEmpty(sSkuCode)) continue;
                    string sBarcode = row[colBarcode].ToString();
                    string sExCode1 = row[colExCode1].ToString();
                    GeneralResource oProdName = new GeneralResource(ModelEnum.ResourceType.STRING, 2052, row[colProdNameCN].ToString());
                    GeneralResource oSkuName = new GeneralResource(ModelEnum.ResourceType.STRING, 2052, row[colSkuNameCN].ToString());
                    GeneralResource oFullName = new GeneralResource(ModelEnum.ResourceType.STRING, 2052, row[colProdNameCN].ToString() + row[colSkuNameCN].ToString());
                    GeneralResource oShortName = new GeneralResource(ModelEnum.ResourceType.STRING, 2052, row[colSkuNameCN].ToString());
                    string sStdCat = row[colStdCat].ToString();
                    string sPrvCat = row[colPrvCat].ToString();
                    byte nBlock;
                    Byte.TryParse(row[colBlock].ToString(), out nBlock);
                    byte nMode;
                    Byte.TryParse(row[colMode].ToString(), out nMode);
                    byte nUnitType;
                    Byte.TryParse(row[colUnitType].ToString(), out nUnitType);
                    string sUnitCode = row[colUnitCode].ToString();
                    byte nPercision;
                    Byte.TryParse(row[colPercision].ToString(), out nPercision);
                    GeneralResource oSpecification = new GeneralResource(ModelEnum.ResourceType.STRING, 2052, row[colSpecification].ToString());
                    string sProdPicture = row[colProdPicture].ToString();
                    GeneralResource oBrief = new GeneralResource(ModelEnum.ResourceType.STRING, 2052, row[colBriefCN].ToString());
                    GeneralLargeObject oIntro = new GeneralLargeObject(2052, row[colIntroCN].ToString());
                    decimal nMinQuantity;
                    Decimal.TryParse(row[colMinQuantity].ToString(), out nMinQuantity);
                    int nCycle;
                    Int32.TryParse(row[colCycle].ToString(), out nCycle);
                    int nGuarantee;
                    Int32.TryParse(row[colGuarantee].ToString(), out nGuarantee);
                    decimal nMarketPriceRMB;
                    Decimal.TryParse(row[colMarketPriceRMB].ToString(), out nMarketPriceRMB);
                    decimal nSuggestPriceRMB;
                    Decimal.TryParse(row[colSuggestPriceRMB].ToString(), out nSuggestPriceRMB);
                    decimal nLowestPriceRMB;
                    Decimal.TryParse(row[colLowestPriceRMB].ToString(), out nLowestPriceRMB);
                    string sKeywords = row[colKeywords].ToString();
                    decimal nGrossWeight;
                    Decimal.TryParse(row[colGrossWeight].ToString(), out nGrossWeight);
                    decimal nNetWeight;
                    Decimal.TryParse(row[colNetWeight].ToString(), out nNetWeight);
                    decimal nGrossVolume;
                    Decimal.TryParse(row[colGrossVolume].ToString(), out nGrossVolume);
                    decimal nNetVolume;
                    Decimal.TryParse(row[colNetVolume].ToString(), out nNetVolume);
                    int nNetPiece;
                    Int32.TryParse(row[colNetPiece].ToString(), out nNetPiece);
                    string sRemark = row[colRemark].ToString();

                    if (!String.IsNullOrEmpty(sProdCode))
                    {
                        // 导入产品主表
                        oProduct = (from p in dbEntity.ProductInformations
                                    where p.OrgID == oOrgan.Gid && p.Code == sProdCode
                                    select p).FirstOrDefault();
                        if (oProduct == null)
                        {
                            oProduct = new ProductInformation { Organization = oOrgan, Code = sProdCode };
                            dbEntity.ProductInformations.Add(oProduct);
                        }
                        if (oProduct.Name == null)
                            oProduct.Name = oProdName;
                        else
                            oProduct.Name.SetResource(ModelEnum.ResourceType.STRING, oProdName);
                        oProduct.StandardCategory = dbEntity.GeneralStandardCategorys.Where(c => c.Code == sStdCat && c.Ctype == (byte)ModelEnum.StandardCategoryType.PRODUCT).FirstOrDefault();
                        oProduct.Block = nBlock;
                        oProduct.Mode = nMode;
                        oProduct.Picture = sProdPicture;
                        if (oProduct.Brief == null)
                            oProduct.Brief = oBrief;
                        else
                            oProduct.Brief.SetResource(ModelEnum.ResourceType.STRING, oBrief);
                        if (oProduct.Matter == null)
                            oProduct.Matter = oIntro;
                        else
                            oProduct.Matter.SetLargeObject(oIntro);
                        oProduct.MinQuantity = nMinQuantity;
                        oProduct.ProductionCycle = nCycle;
                        oProduct.GuaranteeDays = nGuarantee;
                        oProduct.Keywords = sKeywords;
                        oProduct.Remark = sRemark;
                        dbEntity.SaveChanges();
                    }
                    // 导入产品SKU表
                    var oProdItem = (from i in dbEntity.ProductInfoItems
                                     where i.OrgID == oOrgan.Gid && i.Code == sSkuCode
                                     select i).FirstOrDefault();
                    if (oProdItem == null)
                    {
                        oProdItem = new ProductInfoItem { Organization = oOrgan, Code = sSkuCode };
                        dbEntity.ProductInfoItems.Add(oProdItem);
                    }
                    oProdItem.Product = oProduct;
                    oProdItem.Barcode = (String.IsNullOrEmpty(sBarcode)) ? sSkuCode : sBarcode;
                    oProdItem.CodeEx1 = sExCode1;
                    if (oProdItem.FullName == null)
                        oProdItem.FullName = oFullName;
                    else
                        oProdItem.FullName.SetResource(ModelEnum.ResourceType.STRING, oFullName);
                    if (oProdItem.ShortName == null)
                        oProdItem.ShortName = oShortName;
                    else
                        oProdItem.ShortName.SetResource(ModelEnum.ResourceType.STRING, oShortName);
                    oProdItem.StandardUnit = dbEntity.GeneralMeasureUnits.Where(u => u.Code == sUnitCode && u.Utype == nUnitType).FirstOrDefault();
                    if (oProdItem.Specification == null)
                        oProdItem.Specification = oSpecification;
                    else
                        oProdItem.Specification.SetResource(ModelEnum.ResourceType.STRING, oSpecification);
                    var oCurrency = (from u in dbEntity.GeneralMeasureUnits
                                     where u.Utype == (byte)ModelEnum.MeasureUnit.CURRENCY && u.Code == "¥"
                                     select u).FirstOrDefault();
                    if (oProdItem.MarketPrice == null)
                        oProdItem.MarketPrice = new GeneralResource(ModelEnum.ResourceType.MONEY, oCurrency.Gid, nMarketPriceRMB);
                    else
                        oProdItem.MarketPrice.SetResource(ModelEnum.ResourceType.MONEY, oCurrency.Gid, nMarketPriceRMB);
                    if (oProdItem.SuggestPrice == null)
                        oProdItem.SuggestPrice = new GeneralResource(ModelEnum.ResourceType.MONEY, oCurrency.Gid, nSuggestPriceRMB);
                    else
                        oProdItem.SuggestPrice.SetResource(ModelEnum.ResourceType.MONEY, oCurrency.Gid, nSuggestPriceRMB);
                    if (oProdItem.LowestPrice == null)
                        oProdItem.LowestPrice = new GeneralResource(ModelEnum.ResourceType.MONEY, oCurrency.Gid, nLowestPriceRMB);
                    else
                        oProdItem.LowestPrice.SetResource(ModelEnum.ResourceType.MONEY, oCurrency.Gid, nLowestPriceRMB);
                    oProdItem.GrossWeight = nGrossWeight;
                    oProdItem.NetWeight = nNetWeight;
                    oProdItem.GrossVolume = nGrossVolume;
                    oProdItem.NetVolume = nNetVolume;
                    oProdItem.NetPiece = nNetPiece;
                    oProdItem.Remark = sRemark;
                    dbEntity.SaveChanges();
                    if (Utility.ConfigHelper.GlobalConst.IsDebug)
                        Debug.WriteLine("{0} {1} {2} {3} {4}", this.ToString(), sProdCode, oProdName.Matter, oSkuName.Matter, sRemark);
                }
                oEventBLL.WriteEvent(String.Format("导入ProductInformation成功: {0} {1}", sExcelFile, sSheetName),
                    ModelEnum.ActionLevel.GENERIC, ModelEnum.ActionSource.SYSTEM, this.ToString());
            }
            catch (Exception ex)
            {
                oEventBLL.WriteEvent(String.Format("导入ProductInformation错误: {0} {1} {2}", sExcelFile, sSheetName, ex.Message),
                    ModelEnum.ActionLevel.ERROR, ModelEnum.ActionSource.SYSTEM, this.ToString());
            }
        }