public void SerializeXmlByData(TmxTile.map _mapData, string strXmlFileName) { XmlOperation.Serialize(_mapData, strXmlFileName); }
public static void createSkin(string pathSkinGroup, string skinName, string skinContent, XmlOperation.XmlAttr.IAttrRow iAttrRow) { OpenedFile fileDef; //MainWindow.s_pW.openFileByPath(m_pathSkinGroup); if (MainWindow.s_pW.m_mapOpenedFiles.TryGetValue(pathSkinGroup, out fileDef)) { if (fileDef.m_frame is XmlControl) { XmlControl xmlCtrl = (XmlControl)fileDef.m_frame; XmlElement newXe = xmlCtrl.m_xmlDoc.CreateElement("skin"); if (skinContent != null && skinContent != "") { XmlDocument docTmpl = new XmlDocument(); try { docTmpl.LoadXml(skinContent); if (docTmpl.DocumentElement != null && docTmpl.DocumentElement.InnerXml != null && docTmpl.DocumentElement.InnerXml != "") { newXe.InnerXml = docTmpl.DocumentElement.InnerXml; } } catch { } } newXe.SetAttribute("Name", skinName); xmlCtrl.m_treeSkin.addResItem(newXe); xmlCtrl.saveCurStatus(); } } else { if (File.Exists(pathSkinGroup)) { XmlDocument docSkinGroup = new XmlDocument(); try { docSkinGroup.Load(pathSkinGroup); if (docSkinGroup.DocumentElement.Name == "BoloUI") { XmlElement xeSkin = docSkinGroup.CreateElement("skin"); if (skinContent != null && skinContent != "") { XmlDocument docTmpl = new XmlDocument(); try { docTmpl.LoadXml(skinContent); if (docTmpl.DocumentElement != null && docTmpl.DocumentElement.InnerXml != null && docTmpl.DocumentElement.InnerXml != "") { xeSkin.InnerXml = docTmpl.DocumentElement.InnerXml; } } catch { } } xeSkin.SetAttribute("Name", skinName); docSkinGroup.DocumentElement.AppendChild(xeSkin); docSkinGroup.Save(pathSkinGroup); Project.Setting.refreshSkinIndex(); } } catch { } } } if (newSkin.s_pW != null) { newSkin.s_pW.Close(); } iAttrRow.m_parent.m_basic.changeSelectItem(); MainWindow.s_pW.mx_treeFrame.SelectedItem = MainWindow.s_pW.mx_skinEditor; }
public List <ImgInfo> BrandParatope(List <ImgInfo> imgList, string entId, string webUrl, bool landing, bool staleDated, int len, string userId) { SqlParameter[] param = new SqlParameter[] { new SqlParameter("@type", "BrandParatope"), new SqlParameter("@EntId", entId), new SqlParameter("@userId", userId) }; SqlRun sql = new SqlRun(SqlRun.sqlstr); var dt = sql.RunProcedureDR("Proc_GoodsList", param); List <ImgInfo> source = new List <ImgInfo>(); List <ImgInfo> back = new List <ImgInfo>(); if (dt.Rows.Count > 0) { //补位数据 foreach (DataRow item in dt.Rows) { ImgInfo img = new ImgInfo { Entid = item["entid"].ToString().Trim(), Title = item["FloorTitle"].ToString().Trim(), ArticleId = item["Article_Id"].ToString().Trim(), SortId = int.Parse(item["sort_Id"].ToString().Trim()), IsBrand = item["Is_Brand"].ToString().Trim(), BrandCode = item["BrandCode"].ToString().Trim(), LinkUrl = item["link_url"].ToString().Trim() }; if (item["img_url"].ToString().Trim() != "") { img.ImgUrl = webUrl + item["img_url"].ToString().Trim(); } else { img.ImgUrl = ""; } if (item["left_pic"].ToString().Trim() != "") { img.LeftPic = webUrl + item["left_pic"].ToString().Trim(); } if (item["brand_img_url"].ToString().Trim() != "") { img.BrandImgUrl = webUrl + item["brand_img_url"].ToString().Trim(); } else { img.BrandImgUrl = ""; } img.SubTitle = item["sub_title"].ToString().Trim(); img.DrugSpec = item["drug_spec"].ToString().Trim(); img.DrugFactory = item["drug_factory"].ToString().Trim(); if (landing && !staleDated) { img.Price = BasisConfig.ObjToDecimal(item["price"].ToString(), BaseConfiguration.PricePlace, 0.00M).ToString(); } else { img.Price = "会员可见"; } img.Cxbs = item["cxbs"].ToString().Trim(); img.Fabh = item["fabh"].ToString().Trim(); source.Add(img); } imgList.ForEach(t => back.Add(t)); //已存在的品牌 var exist = imgList.Select(t => t.ArticleId).Distinct().ToList(); //移除已存在的品牌 source.RemoveAll(t => exist.Contains(t.ArticleId)); if (source.Count > 0) { int length = source.Count > len ? len : source.Count; Random random = new Random(); int index = source.Count > len?random.Next(source.Count - len + 1) : 0; source = source.GetRange(index, length); source.ForEach(p => { back.Add(p); }); } if (source.Count < len) { var placehold = XmlOperation.ReadXml("Base", "RecommendPicture"); for (int i = 0; i < len - source.Count; i++) { ImgInfo imgInfo = new ImgInfo { Entid = entId, Title = "品牌推荐", ArticleId = "", SortId = 99, IsBrand = "Y", BrandCode = "", LinkUrl = "", ImgUrl = placehold, LeftPic = "", BrandImgUrl = placehold, DrugFactory = "", DrugSpec = "", SubTitle = "", Price = "", Cxbs = "", Fabh = "" }; back.Add(imgInfo); } } } return(back); }