private void LoadLhInfo() { if (SysConfig.DeviceInfo != null && SysConfig.DeviceInfo.AuthList != null && SysConfig.DeviceInfo.AuthList.Count > 0) { lhList = new List <LhInfo>(); List <AuthInfo> lhAuthList = SysConfig.DeviceInfo.AuthList.FindAll(x => x.AUTH_CODE.StartsWith("D")); List <AuthInfo> rtAuthList = SysConfig.DeviceInfo.AuthList.FindAll(x => x.AUTH_CODE.StartsWith("E")); if (lhAuthList != null) { foreach (AuthInfo item in lhAuthList) { LhInfo lh = new LhInfo(); lh.Lh = item.AUTH_VALUE; lh.InTag = item.AUTH_VALUE_DES; lh.ReturnType = "TH01"; lhList.Add(lh); } } if (rtAuthList != null) { lhList.RemoveAll(i => rtAuthList.Exists(j => j.AUTH_VALUE_DES == i.Lh)); foreach (AuthInfo item in rtAuthList) { LhInfo lh = new LhInfo(); lh.Lh = item.AUTH_VALUE_DES; lh.InTag = lhAuthList.Exists(i => i.AUTH_VALUE == item.AUTH_VALUE_DES) ? lhAuthList.Find(i => i.AUTH_VALUE == item.AUTH_VALUE_DES).AUTH_VALUE_DES : ""; lh.ReturnType = item.AUTH_VALUE; lhList.Add(lh); } } if (lhList != null && lhList.Count > 0) { foreach (LhInfo item in lhList) { if (!cboLh.Items.Contains(item.Lh)) { Invoke(new Action(() => { cboLh.Items.Add(item.Lh); })); } } } } else { MetroMessageBox.Show(this, "未下载到楼号信息,请联系开发商解决", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public static List <LhInfo> GetLhList() { List <LhInfo> result = null; string sql = @"SELECT Lh , InTag , ReturnType FROM dbo.Lh"; DataTable dt = DBHelper.GetTable(sql, false); if (dt != null && dt.Rows.Count > 0) { result = new List <LhInfo>(); foreach (DataRow row in dt.Rows) { LhInfo item = new LhInfo(); item.Lh = row["Lh"] != null ? row["Lh"].ToString() : ""; item.InTag = row["InTag"] != null ? row["InTag"].ToString() : ""; item.ReturnType = row["ReturnType"] != null ? row["ReturnType"].ToString() : ""; result.Add(item); } } return(result); }