コード例 #1
0
        public EquInfoControl(DataTable dataTable, DataTable eDT)
        {
            InitializeComponent();

            foreach (DataRow dr in dataTable.Rows)
            {
                try
                {
                    EquInfo equInfo = new EquInfo();
                    if (dataTable.Columns.Contains("EQU_MODEL"))
                    {
                        equInfo.EQU_MODEL = dr["EQU_MODEL"].ToString();
                    }
                    else
                    {
                        equInfo.EQU_MODEL = "";
                    }
                    if (dataTable.Columns.Contains("EQU_AUTH"))
                    {
                        equInfo.EQU_AUTH = dr["EQU_AUTH"].ToString();
                    }
                    else
                    {
                        equInfo.EQU_AUTH = "";
                    }
                    if (dataTable.Columns.Contains("EQU_CODE"))
                    {
                        equInfo.EQU_CODE = dr["EQU_CODE"].ToString();
                    }
                    else
                    {
                        equInfo.EQU_CODE = "";
                    }
                    if (dataTable.Columns.Contains("EQU_MENU"))
                    {
                        equInfo.EQU_MENU = dr["EQU_MENU"].ToString();
                    }
                    else
                    {
                        equInfo.EQU_MENU = "";
                    }
                    if (dataTable.Columns.Contains("EQU_POW"))
                    {
                        equInfo.EQU_POW = dr["EQU_POW"].ToString();
                    }
                    else
                    {
                        equInfo.EQU_POW = "";
                    }



                    try
                    {
                        if (string.IsNullOrEmpty(dr["EQU_POW"].ToString()) == true && dr["GUID"].ToString() != null)
                        {
                            //var names = from s in eDT.Rows
                            //            where s["GUID"] == dr["GUID"] //调用对象的方法
                            //            select s["ET_EQU_DPOW"];

                            //foreach (string name in names)//循环输出结果
                            //{
                            //    equInfo.EQU_POW = name;
                            //    break;
                            //}
                        }
                    }
                    catch
                    {
                    }
                    equList.Add(equInfo);
                }
                catch
                {
                }
            }
            Dg_EquInfoList.ItemsSource = equList;
        }
コード例 #2
0
        private List <EquInfo> GetStationEquInfo(DataSet ds)
        {
            List <CO_IA.UI.StationManage.EquInfo> equList = new List <CO_IA.UI.StationManage.EquInfo>();

            string STAT_NAME = string.Empty;
            string NET_TS    = string.Empty;

            #region  详细信息
            List <EquipmentInfo> equipList = new List <EquipmentInfo>();

            //网表
            if (ds.Tables["RSBT_NET"] != null && ds.Tables["RSBT_NET"].Rows.Count > 0)
            {
                if (ds.Tables["RSBT_NET"].Columns.Contains("NET_TS"))
                {
                    NET_TS = ds.Tables["RSBT_NET"].Rows[0]["NET_TS"].ToString();//技术体制
                }
            }



            //台站资料表
            if (ds.Tables["RSBT_STATION"] != null && ds.Tables["RSBT_STATION"].Rows.Count > 0)
            {
                if (ds.Tables["RSBT_STATION"].Columns.Contains("STAT_NAME"))
                {
                    STAT_NAME = ds.Tables["RSBT_STATION"].Rows[0]["STAT_NAME"].ToString();//台站名称
                }
            }

            //设备表
            if (ds.Tables["RSBT_EQU"] != null && ds.Tables["RSBT_EQU"].Rows.Count > 0)
            {
                DataTable equTable = ds.Tables["RSBT_EQU"];
                DataTable eDT      = ds.Tables["RSBT_EQU_T"];

                #region  设备表

                foreach (DataRow dr in equTable.Rows)
                {
                    try
                    {
                        CO_IA.UI.StationManage.EquInfo equInfo = new CO_IA.UI.StationManage.EquInfo();
                        if (equTable.Columns.Contains("EQU_MODEL"))
                        {
                            equInfo.EQU_MODEL = dr["EQU_MODEL"].ToString();
                        }
                        else
                        {
                            equInfo.EQU_MODEL = "";
                        }
                        if (equTable.Columns.Contains("EQU_AUTH"))
                        {
                            equInfo.EQU_AUTH = dr["EQU_AUTH"].ToString();
                        }
                        else
                        {
                            equInfo.EQU_AUTH = "";
                        }
                        if (equTable.Columns.Contains("EQU_CODE"))
                        {
                            equInfo.EQU_CODE = dr["EQU_CODE"].ToString();
                        }
                        else
                        {
                            equInfo.EQU_CODE = "";
                        }
                        if (equTable.Columns.Contains("EQU_MENU"))
                        {
                            equInfo.EQU_MENU = dr["EQU_MENU"].ToString();
                        }
                        else
                        {
                            equInfo.EQU_MENU = "";
                        }
                        if (equTable.Columns.Contains("EQU_POW"))
                        {
                            equInfo.EQU_POW = dr["EQU_POW"].ToString();
                        }
                        else
                        {
                            equInfo.EQU_POW = "";
                        }

                        try
                        {
                            if (string.IsNullOrEmpty(dr["EQU_POW"].ToString()) == true && dr["GUID"].ToString() != null)
                            {
                                foreach (DataRow edr in eDT.Rows)
                                {
                                    if (edr["GUID"] == dr["GUID"])
                                    {
                                        if (equTable.Columns.Contains("ET_EQU_SENU"))
                                        {
                                            equInfo.ET_EQU_SENU = dr["ET_EQU_SENU"].ToString();
                                        }
                                        else
                                        {
                                            equInfo.ET_EQU_SENU = "";
                                        }
                                        if (equTable.Columns.Contains("ET_EQU_SEN"))
                                        {
                                            equInfo.ET_EQU_SEN = dr["ET_EQU_SEN"].ToString();
                                        }
                                        else
                                        {
                                            equInfo.ET_EQU_SEN = "";
                                        }

                                        break;
                                    }
                                }
                            }
                        }
                        catch
                        {
                        }
                        equList.Add(equInfo);
                    }
                    catch
                    {
                    }
                }

                #endregion
            }

            return(equList);

            #endregion
        }