public static DashboardWindowInfo GetDashboardWindowSetting(String WindowId) { WindowId=GeneralUtil.Null2String(WindowId); DashboardWindowInfo result = new DashboardWindowInfo(); if (WindowId == "") { return result; } else { DataTable DashboardMainInfo = GetEditDashboardMainByWinId(WindowId); if (DashboardMainInfo.Rows.Count == 0) { ExceptionManager.Throw("The specified item has been removed."); } //还需要进一步转换添加等,注意每一位都要根据新的内容赋值 result.WindowId=GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["ID"]); result.WindowName=GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["WindowName"]); result.DisplayName=GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["DisplayName"]); result.AlertMessage=GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["AlertMessage"]); result.RefreshTime=GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["RefreshTime"]); TimeInfo timeInfos=new TimeInfo(); if(result.RefreshTime!="") { int freshTime=Int32.Parse(result.RefreshTime); timeInfos= TimeInt2Struct(freshTime); } result.Hour=timeInfos.Hour; result.Second=timeInfos.Second; result.Minute=timeInfos.Minute; result.DataSourceType=GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["DataSourceType"]); result.StageTargetId=GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["StageTargetId"]); result.StageId=GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["StageId"]); result.StageName=GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["StageName"]); result.IsStageDisplay=GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["IsStageDsp"]); result.StartWorkTime=GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["StartWorkTime"]); TimeInfo startWorkInfos=new TimeInfo(); if(result.StartWorkTime!="") { startWorkInfos= TimeString2Struct(result.StartWorkTime); } result.StartWorkTimeHour=startWorkInfos.Hour; result.StartWorkTimeMinute=startWorkInfos.Minute; result.StopWorkTime=GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["StopWorkTime"]); TimeInfo stopWorkInfos=new TimeInfo(); if(result.StopWorkTime!="") { stopWorkInfos= TimeString2Struct(result.StopWorkTime); } result.StopWorkTimeHour=stopWorkInfos.Hour; result.StopWorkTimeMinute=stopWorkInfos.Minute; result.DisplayFields=GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["DisplayFields"]); StageDisplayFieldInfo displayFieldInfos = new StageDisplayFieldInfo(); if(result.DisplayFields!="") { displayFieldInfos = StageDisplayFieldsString2Struct(result.DisplayFields); } result.IsDnDisplay=displayFieldInfos.IsDnDisplay; result.IsFaInputDisplay =displayFieldInfos.IsFaInputDisplay ; result.IsFaOutputDisplay = displayFieldInfos.IsFaOutputDisplay; result.IsPaInputDisplay = displayFieldInfos.IsPaInputDisplay; result.IsPaOutputDisplay = displayFieldInfos.IsPaOutputDisplay; result.IsGoalDisplay = displayFieldInfos.IsGoalDisplay; result.IsSaInputDisplay = displayFieldInfos.IsSaInputDisplay; result.IsSaOutputDisplay = displayFieldInfos.IsSaOutputDisplay; result.IsRateDisplay=displayFieldInfos.IsRateDisplay; result.Cdt=GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["Cdt"]); result.Udt=GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["Udt"]); result.Editor=GeneralUtil.Null2String(DashboardMainInfo.Rows[0]["Editor"]); DataTable LineResult = GetEditLineListByWinId(WindowId); for (int i = 0; i < LineResult.Rows.Count; i++) { WindowLineInfo lineInfo = new WindowLineInfo(); lineInfo.LineTargetId= GeneralUtil.Null2String(LineResult.Rows[i]["LineTargetId"]); lineInfo.LineID= GeneralUtil.Null2String(LineResult.Rows[i]["LineId"]); lineInfo.Stage= GeneralUtil.Null2String(LineResult.Rows[i]["SatgeName"]); lineInfo.Line= GeneralUtil.Null2String(LineResult.Rows[i]["LineName"]); lineInfo.FPYTarget= GeneralUtil.Null2String(LineResult.Rows[i]["FPYTarget"]); lineInfo.FPYAlert = GeneralUtil.Null2String(LineResult.Rows[i]["FPYAlert"]); lineInfo.OutputTarget = GeneralUtil.Null2String(LineResult.Rows[i]["OutputTarget"]); lineInfo.StartWork= GeneralUtil.Null2String(LineResult.Rows[i]["StartWorkTime"]); TimeInfo lineStartWorkInfos=new TimeInfo(); if(lineInfo.StartWork!="") { lineStartWorkInfos= TimeString2Struct(lineInfo.StartWork); } lineInfo.StartWorkHour=lineStartWorkInfos.Hour; lineInfo.StartWorkMinute=lineStartWorkInfos.Minute; lineInfo.StopWork= GeneralUtil.Null2String(LineResult.Rows[i]["StopWorkTime"]); TimeInfo lineStopWorkInfos = new TimeInfo(); if (lineInfo.StopWork != "") { lineStopWorkInfos = TimeString2Struct(lineInfo.StopWork); } lineInfo.StopWorkHour = lineStopWorkInfos.Hour; lineInfo.StopWorkMinute = lineStopWorkInfos.Minute; lineInfo.StationDisplay= GeneralUtil.Null2String(LineResult.Rows[i]["IsStationDsp"]); lineInfo.Order= GeneralUtil.Null2String(LineResult.Rows[i]["SortOrder"]); List<WindowLineStationInfo> StationResult = GetEditStationListByLineAndWinId(WindowId, lineInfo.LineID); lineInfo.WindowLineStationInfos = StationResult; result.WindowLineInfos.Add(lineInfo); } } return result; }
public static WindowLineInfo GetLineBaseSettingInfo(String lineId) { WindowLineInfo result = new WindowLineInfo(); String connectString = DatabaseUtil.GetConnectionString(); String sqlString = "SELECT top 1 Dashboard_Line_Target.FPYTarget AS FPYTarget,Dashboard_Line_Target.FPYAlert AS FPYAlert, Dashboard_Line_Target.OutputTarget AS OutputTarget,[StartWorkTime],[StopWorkTime] FROM [Dashboard_Line_Target] WHERE [Line]=@param1"; List<ConditionValueSet> paramList = new List<ConditionValueSet>(); ConditionValueSet param1 = new ConditionValueSet(); param1.ParamName = "@param1"; param1.DataType = "char(10)"; param1.ParamValue = lineId; paramList.Add(param1); DataTable sqlResult = DatabaseUtil.GetResultBySQL(sqlString, connectString, paramList); if (sqlResult.Rows.Count > 0) { result.OutputTarget = GeneralUtil.Null2String(sqlResult.Rows[0]["OutputTarget"]); result.FPYAlert = GeneralUtil.Null2String(sqlResult.Rows[0]["FPYAlert"]); result.FPYTarget = GeneralUtil.Null2String(sqlResult.Rows[0]["FPYTarget"]); String StartWorkTime = GeneralUtil.Null2String(sqlResult.Rows[0]["StartWorkTime"]); String StopWorkTime = GeneralUtil.Null2String(sqlResult.Rows[0]["StopWorkTime"]); TimeInfo startWorkInfos = new TimeInfo(); if (StartWorkTime != "") { startWorkInfos = TimeString2Struct(StartWorkTime); } TimeInfo stopWorkInfos = new TimeInfo(); if (StopWorkTime != "") { stopWorkInfos = TimeString2Struct(StopWorkTime); } result.StartWorkHour = startWorkInfos.Hour; result.StartWorkMinute = startWorkInfos.Minute; result.StopWorkHour = stopWorkInfos.Hour; result.StopWorkMinute = stopWorkInfos.Minute; } return result; }