/// <summary> /// 把行转换为对应的实体。 /// </summary> /// <param name="dr"></param> /// <returns></returns> private TerminalInfo DataRowToTerminalInfo(DataRow dr) { TerminalInfo terminal = new TerminalInfo(); terminal.ClientNo = dr["DeviceNum"].ToString(); terminal.TerminalMacAddress = dr["TerminalMacAddress"].ToString(); terminal.ScreenshotPath = dr["ScreenshotPath"].ToString(); string tempFile = dr["Date"].ToString(); if (!string.IsNullOrEmpty(tempFile)) { terminal.StatusUpdateTime = DateTime.Parse(tempFile); } terminal.IsUpdatePlayList = (bool)dr["IsUpdatePlayList"]; terminal.Describe = dr["Describe"].ToString(); tempFile = dr["DeviceSetting"].ToString(); if (!string.IsNullOrEmpty(tempFile)) { terminal.DeviceSetting = ClientConfig.Convert(tempFile); } tempFile = dr["EmpowerLoseEfficacyTime"].ToString(); if (!string.IsNullOrEmpty(tempFile)) { terminal.EmpowerLoseEfficacyTime = DateTime.Parse(tempFile); } if (dr["LastPrintTimes"] == DBNull.Value) { terminal.LastPrintTimes = 0; } else { terminal.LastPrintTimes = int.Parse(dr["LastPrintTimes"].ToString()); } if (dr["PrintedTimes"] == DBNull.Value) { terminal.PrintedTimes = 0; } else { terminal.PrintedTimes = int.Parse(dr["PrintedTimes"].ToString()); } if (dr["PrinterStatus"] == DBNull.Value) { terminal.PrinterStatus = false; } else { terminal.PrinterStatus = Convert.ToBoolean(dr["PrinterStatus"].ToString()); } //HardAdvertInfo hardAdvert = GetHardAdvert();//获取有效的硬广 //if (hardAdvert != null) //{ // terminal.HardAdImage = hardAdvert.AdvertImage; //} TitleAdvertInfo titleAdvert = GetTitleAdvertInfo();//获取冠名广告 if (titleAdvert != null) { terminal.TitleAd = titleAdvert.TitleAdvert; } return(terminal); }