当前位置: 首页>>代码示例>>C#>>正文


C# PSPDEV.GetType方法代码示例

本文整理汇总了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);

            }
        }
开发者ID:EdgarEDT,项目名称:myitoppsp,代码行数:76,代码来源:UCDeviceBase.cs


注:本文中的PSPDEV.GetType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。