本文整理汇总了C#中NBrightInfo.ValidateXmlFormat方法的典型用法代码示例。如果您正苦于以下问题:C# NBrightInfo.ValidateXmlFormat方法的具体用法?C# NBrightInfo.ValidateXmlFormat怎么用?C# NBrightInfo.ValidateXmlFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NBrightInfo
的用法示例。
在下文中一共展示了NBrightInfo.ValidateXmlFormat方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Validate
public int Validate()
{
var errorcount = 0;
var objCtrl = new NBrightBuyController();
DataRecord.ValidateXmlFormat();
if (DataLangRecord == null)
{
// we have no datalang record for this language, so get an existing one and save it.
var l = objCtrl.GetList(PortalSettings.Current.PortalId, -1, "GROUPLANG", " and NB1.ParentItemId = " + Info.ItemID.ToString(""));
if (l.Count > 0)
{
DataLangRecord = (NBrightInfo)l[0].Clone();
DataLangRecord.ItemID = -1;
DataLangRecord.Lang = _lang;
DataLangRecord.ValidateXmlFormat();
objCtrl.Update(DataLangRecord);
}
}
var defaultname = Name;
if (defaultname == "")
{
// find a valid default name
foreach (var lang in DnnUtils.GetCultureCodeList(PortalSettings.Current.PortalId))
{
var l = objCtrl.GetList(PortalSettings.Current.PortalId, -1, "GROUPLANG", " and NB1.ParentItemId = " + Info.ItemID.ToString("") + " and NB1.Lang = '" + lang + "'");
if (l.Count == 1)
{
var nbi2 = (NBrightInfo) l[0];
if (nbi2.GetXmlProperty("genxml/textbox/groupname") != "")
{
defaultname = nbi2.GetXmlProperty("genxml/textbox/groupname");
Name = defaultname;
Save();
break;
}
}
}
}
// fix langauge records
foreach (var lang in DnnUtils.GetCultureCodeList(PortalSettings.Current.PortalId))
{
var l = objCtrl.GetList(PortalSettings.Current.PortalId, -1, "GROUPLANG", " and NB1.ParentItemId = " + Info.ItemID.ToString("") + " and NB1.Lang = '" + lang + "'");
if (l.Count == 0 && DataLangRecord != null)
{
var nbi = (NBrightInfo)DataLangRecord.Clone();
nbi.ItemID = -1;
nbi.Lang = lang;
objCtrl.Update(nbi);
errorcount += 1;
}
if (l.Count == 1)
{
var nbi2 = (NBrightInfo) l[0];
if (nbi2.GetXmlProperty("genxml/textbox/groupname") == "")
{
// if we have no name, use the default name we found early to update.
nbi2.SetXmlProperty("genxml/textbox/groupname", defaultname);
objCtrl.Update(nbi2);
}
}
if (l.Count > 1)
{
// we have more records than should exists, remove any old ones.
var l2 = objCtrl.GetList(PortalSettings.Current.PortalId, -1, "GROUPLANG", " and NB1.ParentItemId = " + Info.ItemID.ToString("") + " and NB1.Lang = '" + lang + "'", "order by Modifieddate desc");
var lp = 1;
foreach (var i in l2)
{
if (lp >= 2) objCtrl.Delete(i.ItemID);
lp += 1;
}
}
}
// add required field values to make getting group easier.
if (DataRecord.GUIDKey != Ref)
{
DataRecord.GUIDKey = Ref;
objCtrl.Update(DataRecord);
}
return errorcount;
}
示例2: Validate
public int Validate()
{
var errorcount = 0;
var objCtrl = new NBrightBuyController();
// default any undefined group type as category (I think quickcategory v1.0.0 plugin causes this)
if (DataRecord.GetXmlProperty("genxml/dropdownlist/ddlgrouptype") == "")
{
DataRecord.SetXmlProperty("genxml/dropdownlist/ddlgrouptype", "cat");
objCtrl.Update(DataRecord);
}
if (GroupType == "cat")
{
// the base category ref cannot have language dependant refs, we therefore just use a unique key
var catref = DataRecord.GetXmlProperty("genxml/textbox/txtcategoryref");
if (catref == "" || DataRecord.GUIDKey == "")
{
catref = Utils.GetUniqueKey().ToLower();
DataRecord.SetXmlProperty("genxml/textbox/txtcategoryref", catref);
DataRecord.GUIDKey = catref;
errorcount += 1;
}
if (DataRecord.GetXmlProperty("genxml/dropdownlist/ddlparentcatid") != DataRecord.ParentItemId.ToString())
{
DataRecord.SetXmlProperty("genxml/dropdownlist/ddlparentcatid", DataRecord.ParentItemId.ToString());
}
}
DataRecord.ValidateXmlFormat();
if (DataLangRecord == null)
{
// we have no datalang record for this language, so get an existing one and save it.
var l = objCtrl.GetList(_portalId, -1, "CATEGORYLANG", " and NB1.ParentItemId = " + Info.ItemID.ToString(""));
if (l.Count > 0)
{
DataLangRecord = (NBrightInfo)l[0].Clone();
DataLangRecord.ItemID = -1;
DataLangRecord.Lang = _lang;
DataLangRecord.ValidateXmlFormat();
objCtrl.Update(DataLangRecord);
}
}
// fix image
var imgpath = DataRecord.GetXmlProperty("genxml/hidden/imagepath");
var imgurl = DataRecord.GetXmlProperty("genxml/hidden/imageurl");
var imagefilename = Path.GetFileName(imgpath);
if (!imgpath.StartsWith(StoreSettings.Current.FolderImagesMapPath))
{
DataRecord.SetXmlProperty("genxml/hidden/imagepath", StoreSettings.Current.FolderImagesMapPath.TrimEnd('\\') + "\\" + imagefilename);
errorcount += 1;
}
if (imagefilename == "")
{
DataRecord.SetXmlProperty("genxml/hidden/imagepath", "");
errorcount += 1;
}
if (!imgurl.StartsWith(StoreSettings.Current.FolderImages))
{
DataRecord.SetXmlProperty("genxml/hidden/imageurl", StoreSettings.Current.FolderImages.TrimEnd('/') + "/" + imagefilename);
errorcount += 1;
}
if (imagefilename == "")
{
DataRecord.SetXmlProperty("genxml/hidden/imageurl", "");
errorcount += 1;
}
// check guidkey is correct
if (DataRecord.GUIDKey != CategoryRef)
{
DataRecord.GUIDKey = CategoryRef;
errorcount += 1;
}
if (errorcount > 0) objCtrl.Update(DataRecord); // update if we find a error
// fix langauge records
foreach (var lang in DnnUtils.GetCultureCodeList(_portalId))
{
var l = objCtrl.GetList(_portalId, -1, "CATEGORYLANG", " and NB1.ParentItemId = " + Info.ItemID.ToString("") + " and NB1.Lang = '" + lang + "'");
if (l.Count == 0 && DataLangRecord != null)
{
var nbi = (NBrightInfo)DataLangRecord.Clone();
nbi.ItemID = -1;
nbi.Lang = lang;
objCtrl.Update(nbi);
errorcount += 1;
}
if (l.Count > 1)
{
// we have more records than shoudl exists, remove any old ones.
var l2 = objCtrl.GetList(_portalId, -1, "CATEGORYLANG", " and NB1.ParentItemId = " + Info.ItemID.ToString("") + " and NB1.Lang = '" + lang + "'", "order by Modifieddate desc");
var lp = 1;
foreach (var i in l2)
{
//.........这里部分代码省略.........