first commit

This commit is contained in:
2026-08-31 16:22:00 +08:00
commit e969a1e559
2665 changed files with 128795 additions and 0 deletions
@@ -0,0 +1,140 @@
<?xml version="1.0"?>
<root>
<LabelDataType>sql_sysquery</LabelDataType>
<LabelType>数据源</LabelType>
<LabelIntro>显示投票结果饼图,需要服务器支持XSLT编程标签方可使用</LabelIntro>
<LabelSqlString>SELECT TOP 1 * FROM PE_Vote WHERE GeneralID = @itemId</LabelSqlString>
<LabelTemplate><![CDATA[<?xml version="1.0" encoding="utf-8"?>
<xsl:transform version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:pe="labelproc" xmlns:ms="urn:schemas-microsoft-com:xslt" xmlns:csharp="urn:the-xml-files:xslt-csharp" xmlns:v="urn:schemas-microsoft-com:vml" exclude-result-prefixes="pe ms csharp">
<ms:script language="c#" implements-prefix="csharp">
double curValue = 0;
string preColor = "rgb(0,0,0)";
double mX = Math.Pow(2,16) * 360;
int rocount = 1;
int Socount = 1;
private string startAngle(string vValue, string nnum)
{
double svalue = Convert.ToDouble(vValue) / Convert.ToDouble(nnum);
double preValue = curValue;
curValue += svalue;
return Convert.ToInt32(mX * preValue).ToString();
}
private string endAngle(string vValue, string nnum)
{
double svalue = Convert.ToDouble(vValue) / Convert.ToDouble(nnum);
return Convert.ToInt32(mX * svalue).ToString();
}
public string getheight(int vValue)
{
int a = 1200 * vValue + 1000;
return a.ToString();
}
public string randomColor()
{
Random rn = new Random(unchecked(rocount * (int)DateTime.Now.Ticks));
Random gn = new Random(unchecked(rocount * (int)DateTime.Now.Ticks) + Socount * 9);
Random bn = new Random(unchecked(rocount * (int)DateTime.Now.Ticks) + Socount * 21);
preColor = "rgb(" + rn.Next(0,255) + "," + gn.Next(0,255) + "," + bn.Next(0,255) + ")";
rocount++;
Socount += 5;
return preColor;
}
public string ShowVoteImage(string ostr, string otitle)
{
XmlDocument xmldoc = new XmlDocument();
try
{
xmldoc.LoadXml(ostr);
}
catch (XmlException e)
{
return e.Message;
}
int i = 1;
Decimal totalnum = Convert.ToDecimal(GetVoteNum(ostr));
string outstr = "&lt;![CDATA[&lt;v:group coordsize='21600,21600' " + "style='width:640px;height:450px'" + "&gt;";
outstr += "&lt;v:rect style='width:21600px;height:21600px' fillcolor='#e6e6e6'&gt;";
outstr += "&lt;v:textbox style='text-Align:center;font-size:24px;font-Weight:bold;height:24px'&gt;" + otitle + "&lt;/v:textbox&gt;&lt;/v:rect&gt;";
outstr += "&lt;v:shadow on='t'/&gt;";
foreach (XmlNode inode in xmldoc.DocumentElement.ChildNodes)
{
XmlElement rnode = (XmlElement)inode;
if (!string.IsNullOrEmpty(rnode.GetAttribute("Title")))
{
outstr += "&lt;v:shape style='width:11000px;height:14000px;top:4000px;left:1000px' adj='0,0' strokecolor='window' coordsize='1500,1400'";
outstr += " path='M 750 700 AE 750 700 750 700 " + startAngle(rnode.GetAttribute("VoteNumber"), GetVoteNum(ostr)) + "&#160; " + endAngle(rnode.GetAttribute("VoteNumber"), GetVoteNum(ostr)) + "xe'";
outstr += " fillcolor='" + randomColor() + "'";
outstr += " title='" + rnode.GetAttribute("Title") + "'/&gt;";
outstr += "&lt;v:rect style='left:14000px;width:600px;height:800px;top:" + getheight(i) + "px'";
outstr += " fillcolor='" + preColor + "'/&gt;";
outstr += "&lt;v:rect strokecolor='black'";
outstr += " style='left:14500px;top:" + getheight(i) + "px'&gt;";
outstr += "&lt;v:textbox style='font:caption'&gt;" + rnode.GetAttribute("Title") + "(" + rnode.GetAttribute("VoteNumber") + ")&lt;/v:textbox&gt;";
outstr += "&lt;/v:rect&gt;";
i += 1;
}
}
outstr += "&lt;/v:group&gt;]]&gt;";
return outstr;
}
public string GetVoteNum(string ostr)
{
XmlDocument xmldoc = new XmlDocument();
try
{
xmldoc.LoadXml(ostr);
}
catch (XmlException e)
{
return e.Message;
}
int i = 0;
foreach (XmlNode inode in xmldoc.DocumentElement.ChildNodes)
{
XmlElement rnode = (XmlElement)inode;
if (!string.IsNullOrEmpty(rnode.GetAttribute("Title")))
{
i += Convert.ToInt32(rnode.GetAttribute("VoteNumber"));
}
}
return i.ToString();
}
</ms:script>
<xsl:output method="xml" />
<xsl:template match="/">
<root>
<VoteTitle>
<xsl:value-of select="/NewDataSet/Table/VoteTitle"/>
</VoteTitle>
<VoteItem>
<xsl:value-of select="csharp:ShowVoteImage(/NewDataSet/Table/VoteItem, /NewDataSet/Table/VoteTitle)"/>
</VoteItem>
<StartTime>
<xsl:value-of select="/NewDataSet/Table/StartTime"/>
</StartTime>
<EndTime>
<xsl:value-of select="/NewDataSet/Table/EndTime"/>
</EndTime>
<VoteTotalNumber>
<xsl:value-of select="csharp:GetVoteNum(/NewDataSet/Table/VoteItem)"/>
</VoteTotalNumber>
</root>
</xsl:template>
</xsl:transform>]]></LabelTemplate>
<attributes>
<name>itemId</name>
<default>1</default>
<intro>投票ID</intro>
</attributes>
<OutType>
</OutType>
<CacheTime>0</CacheTime>
<EnabelAjax>False</EnabelAjax>
<IsXsltSql>false</IsXsltSql>
<IsXsltCountSql>false</IsXsltCountSql>
</root>