解决如下:
我的项目是应用程序,是在app.config 文件里面根节点加入:
<runtime>
<NetFx40_LegacySecurityPolicy enabled="true"/>
</runtime>
便可以顺利解决
posted @
2013-11-01 17:28 天书 阅读(2906) |
评论 (0) |
编辑 收藏
1:Microsoft.Jet.OLEDB.4.0只支持32位操作系统,不支持64位操作系统,但是可以在64位操作系统中编译目标改为x86
1:局数据系统由原来的.net2.0升级为.net4.0
2:项目编译时的目标平台改为x86
3:System.Data.SQLite.dll因为区分32 64 位还有for x86的版本 目前用for x86版本 1.0.76.0
4:由此产生的问题:
此方法显式使用的 CAS 策略已被 .NET Framework 弃用。若要出于兼容性原因而启用 CAS 策略,请使用 NetFx40_LegacySecurityPolicy 配置开关。
源文档 <http://bbs.csdn.net/topics/370104103>
解决如下:
我的项目是应用程序,首先是在app.config 文件里面根节点加入:
<runtime>
<NetFx40_LegacySecurityPolicy enabled="true"/>
</runtime>
以上四个步骤便可解决问题
posted @
2013-11-01 17:28 天书 阅读(2056) |
评论 (0) |
编辑 收藏
namespace OSSDOM.DataQuality.CommonSL.Control
{
public partial class SelectToMonth : UserControl
{
#region select title property
public static readonly DependencyProperty SelectTitleProperty =
DependencyProperty.Register("SelectTitle", typeof(String), typeof(
SelectToMonth), null
);//这块是类型 public string SelectTitle
{
get { return (string)GetValue(SelectTitleProperty); }
set
{
SetValue(SelectTitleProperty, value);
}
}
#endregion
<UserControl x:Class="OSSDOM.DataQuality.CommonSL.Control.SelectToMonth"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="27" d:DesignWidth="220" x:Name="userControl">
<Grid x:Name="LayoutRoot" Background="White">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="60"/>
<ColumnDefinition Width="63"/>
<ColumnDefinition Width="15"/>
<ColumnDefinition Width="64"/>
<ColumnDefinition Width="15*"/>
</Grid.ColumnDefinitions>
<TextBlock Height="20" Margin="2,3,1,0" Name="title" HorizontalAlignment="Stretch" VerticalAlignment="Top" Text="{Binding SelectTitle, ElementName=userControl}" /> //这块是控件名称userControl
<my:SelectToMonth Grid.Row="1" x:Name="结束时间" SelectTitle="结束时间" />
posted @
2013-10-21 17:05 天书 阅读(1395) |
评论 (0) |
编辑 收藏
DevExpress GridControl GridView大批量数据(20万条)导出Excel, 由于03版的Excel每个Sheet页只能承载65536条数据,故自带的ExportToExcelOld及ExportToPdf函数在导出20W条数据时,只能导出前65536条数据,其他数据丢失。 所以自己写导出函数,可以分sheet页来写,用到Excel组件,但是速度比较慢,现用数据流的方式来写,代码如下:
1public static void GridViewToExcel(Stream myStream, DevExpress.XtraGrid.Views.Grid.GridView dataGridView1)
2 {
3 StreamWriter sw = new StreamWriter(myStream, System.Text.Encoding.GetEncoding("gb2312"));
4 string str = "";
5 try
6 {
7 //写标题
8 for (int i = 1; i < dataGridView1.Columns.Count; i++)
9 {
10 if (!string.IsNullOrEmpty(dataGridView1.Columns[i].Caption))
11 {
12 if (i > 1)
13 {
14 str += "\t";
15 }
16 str += dataGridView1.Columns[i].Caption;
17 }
18 }
19
20 sw.WriteLine(str);
21 //写内容
22 for (int j = 0; j < dataGridView1.RowCount; j++)
23 {
24 string tempStr = "";
25 for (int k = 1; k < dataGridView1.Columns.Count; k++)
26 {
27 if (!string.IsNullOrEmpty(dataGridView1.Columns[k].Caption))
28 {
29 if (k > 1)
30 {
31 tempStr += "\t";
32 }
33 tempStr += dataGridView1.GetRowCellValue(j, dataGridView1.Columns[k].FieldName);
34 }
35 }
36 sw.WriteLine(tempStr);
37 }
38 sw.Close();
39 myStream.Close();
40 }
41 catch (Exception ex)
42 {
43 MessageBox.Show(ex.ToString());
44 }
45 finally
46 {
47 sw.Close();
48 myStream.Close();
49 }
50
51 }
posted @
2013-10-12 15:29 天书 阅读(7440) |
评论 (1) |
编辑 收藏
private void MakePager_BigData()
{
try
{
var itemCount = new List<int>();//数据源总共多少数据的整形链表
int pageCount = IDList.Count / dataGridPageSize; //计算出总共多少页
//
for (int i = 0; i < pageCount; i++)
{
itemCount.Add(i);
}
PagedCollectionView pcv = new PagedCollectionView(itemCount);//创建PagedCollectionView
if (pcv != null)
{
pcv.PageSize = 1;//设置PagedCollectionView的每页显示1条数据(虚拟对应的,为了和datagrid对应)
dataPager1.PageSize = 1;//设置dataPager每页显示1条数据(虚拟对应的,为了和datagrid对应)
this.dataPager1.Source = pcv;//设置dataPager的数据源
}
}
catch (Exception ex) { MessageBox.Show(ex.Message + ex.StackTrace); }
}
//根据页索引动态绑定数据源
private void dataPager1_PageIndexChanged(object sender, EventArgs e)
{
int curPageIdx = dataPager1.PageIndex;
int skipData = curPageIdx * dataGridPageSize;
List<IDData> curBindingDataSource = ((from p in IDList select p).Skip(skipData).Take(dataGridPageSize)).ToList();
dataGrid1.ItemsSource = curBindingDataSource;
}
posted @
2013-04-15 15:35 天书 阅读(1297) |
评论 (0) |
编辑 收藏
运行效果见上图, 可以根据单元格中的值来设置颜色,100%为红色,其他为绿色。
实现方法:用列模板绑定数据源中定义的颜色数据项。
其中列模板用Border加TextBox构成,代码如下:
private static DataTemplate MakeCellTemplate(MyColumn col)
{
try
{
DataTemplate dt1 = new DataTemplate();
StringBuilder xaml = new StringBuilder();
xaml.Append("<DataTemplate ");
xaml.Append("xmlns='http://schemas.microsoft.com/client/2007' ");
xaml.Append("xmlns:x='http://schemas.microsoft.com/winfx/2006/xaml' ");
xaml.Append(">");
xaml.Append("<Border ");
xaml.Append("BorderThickness='0.5' BorderBrush='LightGray' Background='Orange'>");
xaml.Append("<TextBox ");
xaml.Append("IsReadOnly='True' Text='{Binding " + col.Name + "}' Foreground='Black' BorderBrush='White' BorderThickness='0' Background='{Binding " + col.colorValue + "}'");
xaml.Append("/>");
xaml.Append("</Border>");
xaml.Append("</DataTemplate>");
dt1 = (DataTemplate)XamlReader.Load(xaml.ToString());
return dt1;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + ex.StackTrace);
return null;
}
}
posted @
2010-12-07 16:17 天书 阅读(2526) |
评论 (0) |
编辑 收藏
1:首先到gsoap-2.7\gsoap\bin\win32 目录下面: 包括两个文件wsdl2h.exe 和
soapcpp2.exe。 把生成好的wsdl文件也拷贝到这个目录下面。
2:wsdl2h.exe -h看帮助文件, 其中参数-c是生成C语言的, 不加参数-c代表C++
的, -s代表不用STL(有时有这个标准模板库编译不过去),一般我们用参数-s
"wsdl2h -s Test.wsdl"
详细网址(http://wenku.baidu.com/view/68e0fb1252d380eb62946d8e.html 或者
http://wenku.baidu.com/view/ebdd3f29bd64783e09122b7a.html?from=rec&pos=0&weight=30&lastweight=9&count=5)
3:soapcpp2 -h 查看帮助
4:soapcpp2 -S -L -i Test.h生成.cpp文件
-C 代表生成客户端代码
-S 代表生成服务端代码
-L 代表不生成soapClientLib/soapServiceLib
-c 代表仅生成c代码
-i 代表使用proxy
通常情况下使用命令 soapcpp2 -S/-C -L -i xxx.h
5:最后生成的.h .cpp .xml文件中只需要保留下面五个即可
soapC.cpp
soapH.h
soapService1SoapService.cpp
soapServiceSoapService.h
soapStub.h
posted @
2010-11-23 20:16 天书 阅读(4438) |
评论 (0) |
编辑 收藏
IPluginService myPluginService = (IPluginService)this.application.GetService(typeof(IPluginService));
IConfigManageService ConfigService = (IConfigManageService)this.application.GetService(typeof(IConfigManageService));
PluginInfo myPlugin = ConfigService.getPluginInfoByClassType("Inspur.CM.NeGroup");
myPlugin.MethodName = "setConfig";
myPlugin = myPluginService.getPluginByName(myPlugin);
myPlugin.doInvoke(strValue);
posted @
2010-10-26 09:13 天书 阅读(1606) |
评论 (0) |
编辑 收藏
System.Drawing.Rectangle r = System.Windows.Forms.Screen.GetWorkingArea(recForm);
recForm.Location = new System.Drawing.Point(r.Right - recForm.Width, r.Bottom - recForm.Height);
recForm.Show();
posted @
2010-10-25 09:57 天书 阅读(1681) |
评论 (0) |
编辑 收藏
DevExpress TreeList加载大批量数据的时候绑定数据源 dataTable.
注意事项1: 由于一旦绑定了数据源dataTable的些许变化便在TreeList中有所体现, 所以等dataTable完全填充好了之后再绑定数据源.
注意事项2:dataTable每行的父节点ID当加载到目前为止,还没有找到那么可能就当成空了, 所以最后treelist呈现就有问题, 所以解决办法有3个, 1: 大范围数据,也就是父节点的数据一定要先于子节点在表中排列.(这个不好控制). 2: 等完全填充完datatable时再重新设置每行的父节点ID. 3:可以边填充边设置, 最后再绑定数据源, 在填充dataTable之前先解绑数据源, 即先把数据源设为空,完全填充好再重新绑定(经过测试这种方法的加载速度最快了)
参看代码如下:
public void ShowData(ForecastService.TrafficResult[] result, int iscrop, bool AllType)
{
//填充数据
try
{
ResetCtrl(AllType);
this.result = result;
treeListResult.Nodes.Clear();
treeListResult.DataSource = null; //一定要先解绑
FillTypeFirstData(result, this.dtResult);
treeListResult.DataSource = dtResult;
if (treeListResult.Nodes.Count > 0)
{
for (int i = 0; i < treeListResult.Nodes.Count; i++)
{
treeListResult.Nodes[i].HasChildren = true;
treeListResult.Nodes[i].Expanded = true;
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + ex.StackTrace);
}
}
private void FillTypeFirstData(Inspur.Forecast.ForecastService.TrafficResult[] result, DataTable dataTable)
{
try
{
dataTable.Rows.Clear();
for (int i = 0; i < result.Length; i++)
{
if (result[i].trafficType == "ALL" && result[i].city == "ALL")//全省的数据
{
DataRow dr = dataTable.NewRow();
dr["keyFieldName"] = "湖南";//设置当前行ID
dr["parentFieldName"] = DBNull.Value; //设置父节点ID
dr["维度"] = "湖南";
dr["去年基准日话务量"] = result[i].lastFir.Trim();
dr["去年预测日话务量"] = result[i].lastSec.Trim();
dr["增长幅度"] = result[i].add.Trim();
dr["今年基准日话务量"] = result[i].nowFir.Trim();
dr["今年预测日话务量"] = result[i].nowSec.Trim();
dr["目前电路数"] = result[i].count.Trim();
dr["预测2M电路数"] = result[i].fcastcount.Trim();
dr["需要新增的电路数"] = result[i].addcount.Trim();
dataTable.Rows.Add(dr);
}
else if (result[i].trafficType != "ALL" && result[i].city == "ALL" && result[i].nename == "ALL")//汇总到类型的数据
{
DataRow dr = dataTable.NewRow();
dr["keyFieldName"] = result[i].trafficType;
dr["parentFieldName"] = "湖南";
dr["维度"] = result[i].trafficType;
dr["去年基准日话务量"] = result[i].lastFir.Trim();
dr["去年预测日话务量"] = result[i].lastSec.Trim();
dr["增长幅度"] = result[i].add.Trim();
dr["今年基准日话务量"] = result[i].nowFir.Trim();
dr["今年预测日话务量"] = result[i].nowSec.Trim();
dr["目前电路数"] = result[i].count.Trim();
dr["预测2M电路数"] = result[i].fcastcount.Trim();
dr["需要新增的电路数"] = result[i].addcount.Trim();
dataTable.Rows.Add(dr);
}
else if (result[i].trafficType != "ALL" && result[i].city != "ALL" && result[i].nename == "ALL")//汇总到地市的数据
{
DataRow dr = dataTable.NewRow();
dr["keyFieldName"] = result[i].trafficType + "_" + result[i].city;
dr["parentFieldName"] = result[i].trafficType;
dr["维度"] = result[i].city;
dr["去年基准日话务量"] = result[i].lastFir.Trim();
dr["去年预测日话务量"] = result[i].lastSec.Trim();
dr["增长幅度"] = result[i].add.Trim();
dr["今年基准日话务量"] = result[i].nowFir.Trim();
dr["今年预测日话务量"] = result[i].nowSec.Trim();
dr["目前电路数"] = result[i].count.Trim();
dr["预测2M电路数"] = result[i].fcastcount.Trim();
dr["需要新增的电路数"] = result[i].addcount.Trim();
dataTable.Rows.Add(dr);
}
else if (result[i].trafficType != "ALL" && result[i].city != "ALL" && result[i].nename != "ALL" && result[i].middle == "ALL")//汇总到网元的数据
{
DataRow dr = dataTable.NewRow();
dr["keyFieldName"] = result[i].trafficType + "_" + result[i].city + "_" + result[i].nename;
dr["parentFieldName"] = result[i].trafficType + "_" + result[i].city;
dr["维度"] = result[i].nename;
dr["去年基准日话务量"] = result[i].lastFir.Trim();
dr["去年预测日话务量"] = result[i].lastSec.Trim();
dr["增长幅度"] = result[i].add.Trim();
dr["今年基准日话务量"] = result[i].nowFir.Trim();
dr["今年预测日话务量"] = result[i].nowSec.Trim();
dr["目前电路数"] = result[i].count.Trim();
dr["预测2M电路数"] = result[i].fcastcount.Trim();
dr["需要新增的电路数"] = result[i].addcount.Trim();
dataTable.Rows.Add(dr);
}
else if (result[i].trafficType != "ALL" && result[i].city != "ALL" && result[i].nename != "ALL" && result[i].middle != "ALL")//到中继的数据
{
DataRow dr = dataTable.NewRow();
dr["keyFieldName"] = result[i].trafficType + "_" + result[i].city + "_" + result[i].nename + "_" + result[i].middle;
dr["parentFieldName"] = result[i].trafficType + "_" + result[i].city + "_" + result[i].nename;
dr["维度"] = result[i].middle;
dr["去年基准日话务量"] = result[i].lastFir.Trim();
dr["去年预测日话务量"] = result[i].lastSec.Trim();
dr["增长幅度"] = result[i].add.Trim();
dr["今年基准日话务量"] = result[i].nowFir.Trim();
dr["今年预测日话务量"] = result[i].nowSec.Trim();
dr["目前电路数"] = result[i].count.Trim();
dr["预测2M电路数"] = result[i].fcastcount.Trim();
dr["需要新增的电路数"] = result[i].addcount.Trim();
dataTable.Rows.Add(dr);
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + ex.StackTrace);
}
}
public TrafficResultTree(IApplication application)
{
InitializeComponent();
this.application = application;
SetTreeListColumn("Config\\Forecast\\TrafficForecastResultTree.xml", "/Head", treeListResult);
//Test
PublicFunction.SetDataTableColumn(treeListResult, dtResult);
treeListResult.ParentFieldName = "parentFieldName"; //设置树的ParentFieldName 属性
treeListResult.KeyFieldName = "keyFieldName"; //设置树的KeyFieldName 属性
//
}
public static void SetDataTableColumn(DevExpress.XtraTreeList.TreeList treeListResult, DataTable dtResult)
{
try
{
dtResult.Columns.Clear();
DataColumn dcid = new DataColumn("keyFieldName", Type.GetType("System.String"));
DataColumn dcparentId = new DataColumn("parentFieldName", Type.GetType("System.String"));
dtResult.Columns.Add(dcid);
dtResult.Columns.Add(dcparentId);
for (int i = 0; i < treeListResult.Columns.Count; i++)
{
DataColumn dc = new DataColumn(treeListResult.Columns[i].FieldName);
dtResult.Columns.Add(dc);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + ex.StackTrace);
}
}
private void InsertRelayData(string time, string type, string cityName, string equipeName, string burName, Inspur.Analysis.AnalysisService.Relay resultRelay)
{
try
{
DataRow drRelay = dtResult.NewRow();
drRelay["keyFieldName"] = time + "_" + type + "_" + cityName + "_" + equipeName + "_" + burName + "_" + resultRelay.RelayName + "_" + DateTime.Now.ToString();
drRelay["parentFieldName"] = time + "_" + type + "_" + cityName + "_" + equipeName + "_" + burName;
drRelay["维度"] = resultRelay.RelayName;
drRelay["定义电路数"] = resultRelay.Total.CIRCUITS;
drRelay["来话试呼次数"] = resultRelay.Total.in_att;
drRelay["去话试呼次数"] = resultRelay.Total.out_att;
drRelay["来话应答次数"] = resultRelay.Total.in_ans;
drRelay["去话应答次数"] = resultRelay.Total.out_ans;
drRelay["来话话务量"] = resultRelay.Total.in_traf;
drRelay["去话话务量"] = resultRelay.Total.out_traf;
drRelay["总话务量"] = resultRelay.Total.traf;
drRelay["来话市话话务量"] = resultRelay.Total.in_local_traf;
drRelay["去话市话话务量"] = resultRelay.Total.out_local_traf;
drRelay["来话长话话务量"] = resultRelay.Total.in_long_traf;
drRelay["去话长话话务量"] = resultRelay.Total.out_long_traf;
drRelay["市话话务量"] = resultRelay.Total.local_traf;
drRelay["长话话务量"] = resultRelay.Total.long_traf;
dtResult.Rows.Add(drRelay);
//DevExpress.XtraTreeList.Nodes.TreeListNode noderelay = null;
//for (int i = 0; i < nodebureauD.Nodes.Count; i++)
//{
// if (nodebureauD.Nodes[i]["维度"].ToString() == relay.RelayName)
// {
// noderelay = nodebureauD.Nodes[i];
// break;
// }
//}
//if (noderelay == null)
//{
// List<string> relayList = new List<string>();
// relayList.Add(relay.RelayName);
// noderelay = treeList.AppendNode(relayList.ToArray(), nodebureauD);
//}
//if (noderelay != null)
//{
// InsertTargetData(noderelay, relay.RelayName, relay.Total);
//}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message + ex.StackTrace);
}
}
posted @
2010-08-18 10:56 天书 阅读(6731) |
评论 (0) |
编辑 收藏