本文整理汇总了C#中PSPDEV.GetType方法的典型用法代码示例。如果您正苦于以下问题:C# PSPDEV.GetType方法的具体用法?C# PSPDEV.GetType怎么用?C# PSPDEV.GetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PSPDEV
的用法示例。
在下文中一共展示了PSPDEV.GetType方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateInchildren
public virtual void UpdateInchildren(DataTable table)
{
for (int i = 0; i < table.Rows.Count; i++)
{
if (table.Rows[i][0].ToString().IndexOf("�ϼ�") > 0 || table.Rows[i][1].ToString().IndexOf("�ϼ�") > 0)
continue;
PSPDEV area = new PSPDEV();
area.ProjectID = Itop.Client.MIS.ProgUID;
foreach (DataColumn col in table.Columns)
{
try
{
if (table.Rows[i][col] != null)
{
string inserted = table.Rows[i][col].ToString();
Type type = area.GetType().GetProperty(col.ColumnName).PropertyType;//.GetValue(area, null).GetType();
if (type == typeof(int))
area.GetType().GetProperty(col.ColumnName).SetValue(area, int.Parse(inserted == "" ? "0" : inserted), null);
else if (type == typeof(string))
{
if (inserted == "Ͷ������")
{
inserted = "0";
}
if (inserted == "�˳�����")
{
inserted = "1";
}
if (inserted == "ƽ��ڵ�")
{
inserted = "0";
}
if (inserted == "PQ�ڵ�")
{
inserted = "1";
}
if (inserted == "PV�ڵ�")
{
inserted = "2";
}
if (inserted == "kV/MW/MVar" || inserted == "Ohm/10-6Siem")
{
inserted = "1";
}
if (inserted == "p.u.")
{
inserted = "0";
}
if (inserted == "Ͷ��")
{
inserted = "0";
}
if (inserted == "�˳�")
{
inserted = "1";
}
area.GetType().GetProperty(col.ColumnName).SetValue(area, inserted, null);
}
else if (type == typeof(decimal))
area.GetType().GetProperty(col.ColumnName).SetValue(area, decimal.Parse(inserted == "" ? "0" : inserted), null);
else if (type == typeof(double))
area.GetType().GetProperty(col.ColumnName).SetValue(area, double.Parse(inserted == "" ? "0.0" : inserted), null);
}
}
catch { MessageBox.Show(string.Format("��{0}��{1}���������", i.ToString(), col.Caption)); }
}
//if (!string.IsNullOrEmpty(ParentID))
//{
// area.SvgUID = ParentID;
//}
area.Type = GetType();
UCDeviceBase.DataService.Create<PSPDEV>(area);
}
}