/// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="large">完整资源表</param>
 public GeneralLargeObject(GeneralLargeObject large)
 {
     this.LargeItems = new List<GeneralLargeItem>();
     this.Code = large.Code;
     this.Culture = large.Culture;
     this.CLOB = large.CLOB;
     this.Remark = large.Remark;
     foreach (GeneralLargeItem item in large.LargeItems)
     {
         var resitem = this.LargeItems.FirstOrDefault(i => i.Culture == item.Culture && i.Deleted == false);
         if (resitem == null)
             this.LargeItems.Add(new GeneralLargeItem { Culture = item.Culture, CLOB = item.CLOB, Remark = item.Remark });
         else
             resitem.CLOB = item.CLOB;
     }
 }
Exemple #2
0
        private static void Test03()
        {
            LiveEntities oGeneralEntities = new LiveEntities(ConfigHelper.LiveConnection.Connection);
            // 指定Child方式
            GeneralLargeItem oItemA1 = new GeneralLargeItem
            {
                Culture = 1033,
                CLOB = "hello, this is a long text (en-US)",
                Source = (byte)ModelEnum.LargeObjectSource.NONE
            };
            GeneralLargeItem oItemA2 = new GeneralLargeItem
            {
                Culture = 1036,
                CLOB = "hello, this is a long text (fr-FR)",
                Source = (byte)ModelEnum.LargeObjectSource.NONE
            };
            GeneralLargeObject oLargeA = new GeneralLargeObject
            {
                CLOB = "hello, there are parents",
                Source = (byte)ModelEnum.LargeObjectSource.DATEBASE,
                LargeItems = new List<GeneralLargeItem> { oItemA1, oItemA2 }
            };
            // 指定Parent方式
            GeneralLargeObject oLargeB = new GeneralLargeObject
            {
                CLOB = "hello, there are parents",
                Source = (byte)ModelEnum.LargeObjectSource.DATEBASE
            };
            GeneralLargeItem oItemB1 = new GeneralLargeItem
            {
                Culture = 1033,
                CLOB = "hello, this is a long text (en-US)",
                Source = (byte)ModelEnum.LargeObjectSource.NONE,
                LargeObject = oLargeB
            };
            GeneralLargeItem oItemB2 = new GeneralLargeItem
            {
                Culture = 1036,
                CLOB = "hello, this is a long text (fr-FR)",
                Source = (byte)ModelEnum.LargeObjectSource.NONE,
                LargeObject = oLargeB
            };

            oGeneralEntities.GeneralLargeObjects.Add(oLargeA);

            oGeneralEntities.GeneralLargeItems.Add(oItemB1);
            oGeneralEntities.GeneralLargeItems.Add(oItemB2);

            oGeneralEntities.SaveChanges();

            var oResources = oGeneralEntities.GeneralLargeObjects.Include("GeneralLargeItems");
            foreach (GeneralLargeObject obj1 in oResources.ToList())
            {
                Console.WriteLine(obj1.CLOB);
                foreach (GeneralLargeItem obj2 in obj1.LargeItems)
                {
                    CultureInfo oCulture = new CultureInfo(obj2.Culture);
                    Console.WriteLine("    " + oCulture.NativeName + " " + obj2.CLOB);
                }
            }
            oGeneralEntities.Dispose();
            GC.Collect();
        }
Exemple #3
0
        /// <summary>
        /// 导入消息模板
        /// </summary>
        /// <param name="sExcelFile">Excel文件名</param>
        /// <param name="sSheetName">Sheet名</param>
        public void ImportMessageTemplate(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 colMatterCN = oExcel.ExcelTable.Columns["中文内容"];
                DataColumn colMatterUS = 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());
                    GeneralLargeObject oMatter = new GeneralLargeObject(2052, row[colMatterCN].ToString(), 1033, row[colMatterUS].ToString());
                    string sRemark = row[colRemark].ToString();

                    var oTemplate = (from t in dbEntity.GeneralMessageTemplates
                                     where t.OrgID == oOrgan.Gid && t.Code == sCode
                                     select t).FirstOrDefault();
                    if (oTemplate == null)
                    {
                        oTemplate = new GeneralMessageTemplate { Organization = oOrgan, Code = sCode };
                        dbEntity.GeneralMessageTemplates.Add(oTemplate);
                    }
                    if (oTemplate.Name == null)
                        oTemplate.Name = oName;
                    else
                        oTemplate.Name.SetResource(ModelEnum.ResourceType.STRING, oName);
                    if (oTemplate.Matter == null)
                        oTemplate.Matter = oMatter;
                    else
                        oTemplate.Matter.SetLargeObject(oMatter);
                    oTemplate.Remark = sRemark;
                    dbEntity.SaveChanges();
                    if (Utility.ConfigHelper.GlobalConst.IsDebug)
                        Debug.WriteLine("{0} {1} {2}", this.ToString(), sCode, sRemark);
                }
                oEventBLL.WriteEvent(String.Format("导入GeneralMessageTemplate成功: {0} {1}", sExcelFile, sSheetName),
                    ModelEnum.ActionLevel.GENERIC, ModelEnum.ActionSource.SYSTEM, this.ToString());
            }
            catch (Exception ex)
            {
                oEventBLL.WriteEvent(String.Format("导入GeneralMessageTemplate错误: {0} {1} {2}", sExcelFile, sSheetName, ex.Message),
                    ModelEnum.ActionLevel.ERROR, ModelEnum.ActionSource.SYSTEM, this.ToString());
            }
        }
Exemple #4
0
        /// <summary>
        /// 导入面单模板
        /// </summary>
        /// <param name="sExcelFile">Excel文件名</param>
        /// <param name="sSheetName">Sheet名</param>
        public void ImportShippingEnvelope(string sExcelFile, string sSheetName)
        {
            try
            {
                ExcelData oExcel = new ExcelData(sExcelFile, sSheetName);
                DataColumn colOrgan = oExcel.ExcelTable.Columns["组织"];
                DataColumn colShipper = oExcel.ExcelTable.Columns["承运商"];
                DataColumn colCode = oExcel.ExcelTable.Columns["代码"];
                DataColumn colStatus = oExcel.ExcelTable.Columns["状态"];
                DataColumn colDescription = oExcel.ExcelTable.Columns["描述"];
                DataColumn colMatterCN = oExcel.ExcelTable.Columns["中文内容"];
                DataColumn colMatterUS = oExcel.ExcelTable.Columns["英文内容"];
                DataColumn colRemark = oExcel.ExcelTable.Columns["备注"];

                foreach (DataRow row in oExcel.ExcelTable.Rows)
                {
                    string sOrganCode = row[colOrgan].ToString();
                    string sShipper = row[colShipper].ToString();
                    var oShipping = (from s in dbEntity.ShippingInformations
                                     where s.Parent.Code == sOrganCode && s.Code == sShipper
                                           && s.Otype == (byte)ModelEnum.OrganizationType.SHIPPER
                                     select s).FirstOrDefault();
                    string sCode = row[colCode].ToString();
                    byte nStatus;
                    Byte.TryParse(row[colStatus].ToString(), out nStatus);
                    string sDescription = row[colDescription].ToString();
                    GeneralLargeObject oTemplate = new GeneralLargeObject(2052, row[colMatterCN].ToString(), 1033, row[colMatterUS].ToString());
                    string sRemark = row[colRemark].ToString();

                    var oEnvelope = (from e in dbEntity.ShippingEnvelopes
                                     where e.Deleted == false
                                           && e.ShipID == oShipping.Gid && e.Code == sCode
                                     select e).FirstOrDefault();
                    if (oEnvelope == null)
                    {
                        oEnvelope = new ShippingEnvelope { Shipping = oShipping, Code = sCode };
                        dbEntity.ShippingEnvelopes.Add(oEnvelope);
                    }
                    oEnvelope.Estatus = nStatus;
                    oEnvelope.Matter = sDescription;
                    if (oEnvelope.Template == null)
                        oEnvelope.Template = oTemplate;
                    else
                        oEnvelope.Template.SetLargeObject(oTemplate);
                    oTemplate.Remark = sRemark;
                    dbEntity.SaveChanges();
                    if (Utility.ConfigHelper.GlobalConst.IsDebug)
                        Debug.WriteLine("{0} {1} {2}", this.ToString(), sCode, sRemark);
                }
                oEventBLL.WriteEvent(String.Format("导入ImportShippingEnvelope成功: {0} {1}", sExcelFile, sSheetName),
                    ModelEnum.ActionLevel.GENERIC, ModelEnum.ActionSource.SYSTEM, this.ToString());
            }
            catch (Exception ex)
            {
                oEventBLL.WriteEvent(String.Format("导入ImportShippingEnvelope错误: {0} {1} {2}", sExcelFile, sSheetName, ex.Message),
                    ModelEnum.ActionLevel.ERROR, ModelEnum.ActionSource.SYSTEM, this.ToString());
            }
        }
Exemple #5
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());
            }
        }
Exemple #6
0
 /// <summary>
 /// 产生多语言的大对象资源文件
 /// </summary>
 /// <param name="organID">组织,空则表示用系统支持的所有语言</param>
 /// <returns>新资源文件</returns>
 public GeneralLargeObject NewLargeObject(Guid? organID = null)
 {
     GeneralLargeObject oLarge = new GeneralLargeObject();
     List<GeneralCultureUnit> oCultures = this.GetSupportCultures(organID);
     bool bIsFirst = true;
     foreach (var item in oCultures)
     {
         if (bIsFirst)
             oLarge.Culture = item.Culture;
         else
             oLarge.LargeItems.Add(new GeneralLargeItem { Culture = item.Culture });
         bIsFirst = false;
     }
     return oLarge;
 }
Exemple #7
0
 /// <summary>
 /// 更新已经存在的大对象资源文件,包括插入新语言,删除过期的语言等
 /// </summary>
 /// <param name="large">原资源文件</param>
 /// <param name="organID">组织ID,空表示用系统支持的语言/货币刷新</param>
 /// <returns>新资源文件</returns>
 public GeneralLargeObject RefreshLargeObject(GeneralLargeObject large, Guid? organID = null)
 {
     GeneralLargeObject oLarge = large;
     if (oLarge == null)
         oLarge = this.NewLargeObject(organID);
     List<Guid> oGuidList = new List<Guid>();
     List<GeneralCultureUnit> oCultures = this.GetSupportCultures(organID);
     bool bIsFirst = true;
     foreach (var item in oCultures)
     {
         if (bIsFirst)
         {
             oLarge.Culture = item.Culture;
         }
         else
         {
             var resitem = oLarge.LargeItems.FirstOrDefault(i => i.Culture == item.Culture && i.Deleted == false);
             if (resitem == null)
                 oLarge.LargeItems.Add(new GeneralLargeItem { Culture = item.Culture });
             else
                 oGuidList.Add(resitem.Gid);
         }
         bIsFirst = false;
     }
     // 删除过时的语言资源
     for (int i = 0; i < oLarge.LargeItems.Count; i++)
     {
         var item = oLarge.LargeItems.ElementAt(i);
         if (!item.Gid.Equals(Guid.Empty) && !oGuidList.Contains(item.Gid))
             oLarge.LargeItems.Remove(item);
     }
     return oLarge;
 }
Exemple #8
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="nCulture">语言</param>
 /// <param name="sCLOB">大字符串</param>
 /// <param name="oLargeObject">主资源文件</param>
 public GeneralLargeItem(short nCulture, string sCLOB, GeneralLargeObject oLargeObject)
 {
     this.Culture = nCulture;
     this.CLOB = sCLOB;
     this.LargeObject = oLargeObject;
 }
Exemple #9
0
 /// <summary>
 /// 更新已经存在的大对象资源文件,包括插入新语言,删除过期的语言等
 /// </summary>
 /// <param name="large">原资源文件</param>
 /// <param name="organID">组织ID,空表示用系统支持的语言/货币刷新</param>
 /// <returns>新资源文件</returns>
 public GeneralLargeObject RefreshLargeObject(GeneralLargeObject large, Guid? organID = null)
 {
     return oGeneralBLL.RefreshLargeObject(large, organID);
 }
Exemple #10
0
        public void MemberTest3()
        {
            LiveEntities oLiveEntities = new LiveEntities(ConfigHelper.LiveConnection.Connection);

            GeneralLargeItem LargeItemA = new GeneralLargeItem
            {
                //LargeObject = LargeObjectA,
                Culture = 1024,
                CLOB = "this is a test LargeItem",
                FileType = ".txt",
                Source = (byte)ModelEnum.LargeObjectSource.DATEBASE,
                ObjUrl = "/123/23/3"
            };

            GeneralLargeItem LargeItemB = new GeneralLargeItem
            {
                //LargeObject = LargeObjectB,
                Culture = 2011,
                CLOB = "this is the other test LargeItem",
                FileType = ".php",
                Source = (byte)ModelEnum.LargeObjectSource.NONE,
                ObjUrl = "/1abc"
            };

            GeneralLargeObject LargeObjectA = new GeneralLargeObject
            {
                Code = "LargeObjectA",
                Culture = 1033,
                CLOB = "this is a LargeObject CLOB",
                FileType = ".jpg",
                ObjUrl = "/zhuchao/123",
                LargeItems = new List<GeneralLargeItem> { LargeItemA, LargeItemB},
                Source = (byte)ModelEnum.LargeObjectSource.DATEBASE
            };

            oLiveEntities.GeneralLargeObjects.Add(LargeObjectA);
            oLiveEntities.SaveChanges();

            //Console.WriteLine(LargeItemA.Gid);
            //Console.WriteLine(LargeObjectA.Gid);

            oLiveEntities.Dispose();
            GC.Collect();
        }
Exemple #11
0
        /// <summary>
        /// 保存详情
        /// </summary>
        /// <param name="oProductInfo">产品页面对象</param>
        /// <returns></returns>
        public bool saveProductInfoDetail(ProductInformation model)
        {
            try
            {
                ProductInformation oProductInformation = dbEntity.ProductInformations.Include("Brief").Include("Matter").Where(p => p.Deleted == false && p.Gid == model.Gid).Single();
                oProductInformation.Brief.SetResource(ModelEnum.ResourceType.STRING, model.Brief);
            ///////////////////////////////////待更改/////////////////////////////////////////////////////
                if (oProductInformation.Matter == null)
                {
                    GeneralLargeObject oClob = new GeneralLargeObject();
                    oClob.CLOB = model.Matter.CLOB;
                    dbEntity.GeneralLargeObjects.Add(oClob);
                    dbEntity.SaveChanges();
                    oProductInformation.aMatter = oClob.Gid;
                }
                else
                {
                    oProductInformation.Matter.CLOB = model.Matter.CLOB;
                }
            ////////////////////////////////////////////////////////////////////////////////////////////////
                dbEntity.SaveChanges();

            }
            catch (Exception)
            {
                return false;
            }
            return true;
        }
 /// <summary>
 /// 测试方法,最终废弃不用
 /// </summary>
 /// <returns></returns>
 public ViewResult TestEditLargeMatter()
 {
     GeneralLargeItem item = new GeneralLargeItem
     {
         Culture = 1033,
         CLOB = "<p style='color:Green'>English</p>",
     };
     GeneralLargeObject obj = new GeneralLargeObject
     {
         Culture = 2052,
         CLOB = "<p style='color:Red'>中文</p>",
         LargeItems = new List<GeneralLargeItem>
         {
             item
         }
     };
     dbEntity.GeneralLargeObjects.Add(obj);
     dbEntity.SaveChanges();
     return View(obj);
 }