private void LoadResultDetails(string checkDateBegin, string checkDateEnd, string checkResult) { List <ResultDetail> resultDetailList; if (checkResult.Equals("全部")) { checkResult = ""; } DbCheckResult.LoadResultDetails(_cable.ItemName, checkDateBegin, checkDateEnd, checkResult, out resultDetailList); GridCheckResult.ItemsSource = resultDetailList; }
private void FiltData() { var itemName = tbItemName.Text.Trim(); var checkDateBegin = Convert.ToDateTime(datePickerBegin.SelectedDate).ToString("yy-MM-dd ") + " 00:00:00"; var checkDateEnd = Convert.ToDateTime(datePickerEnd.SelectedDate).ToString("yy-MM-dd ") + " 23:59:59"; List <CheckItemExt> checkItemList; DbCheckResult.LoadCheckItemList(itemName, checkDateBegin, checkDateEnd, out checkItemList); GridCheckResult.ItemsSource = checkItemList; }
/// <summary> /// 查找所有的自定义数据库函数(禁止使用) /// </summary> /// <returns></returns> private List <DbCheckResult> CheckUserFunction() { List <string> names = CPQuery.Create(@" select sp.name from sys.all_objects as sp where (sp.type = N'TF' or sp.type = N'FN' )and(CAST( case when sp.is_ms_shipped = 1 then 1 when ( select major_id from sys.extended_properties where major_id = sp.object_id and minor_id = 0 and class = 1 and name = N'microsoft_database_tools_support') is not null then 1 else 0 end AS bit)=0) order by name ").ToScalarList <string>(); List <DbCheckResult> list = new List <DbCheckResult>(); foreach (string name in names) { DbCheckResult result = new DbCheckResult(); result.TableName = name; result.Reason = "SPEC:D00008; 禁止使用自定义数据库函数"; result.RuleCode = "SPEC:D00008"; result.Informantion = name; result.ObjectName = name; list.Add(result); } return(list); }
internal static void AddCheckResult(object o, DataTable dt, string itemName, string state, string shortCircuitInfo, string openCircuitInfo, string username) { var barName = ""; var barContent = ""; Window scHandler = (GraphicalCableCheck)o; if (state.Equals("OK")) { for (var i = 0; i < dt.Rows.Count; i++) { var tmpBarName = dt.Rows[i]["bar_field_name"].ToString(); var tb = scHandler.FindName("tbName_" + tmpBarName) as TextBox; if (tb == null) { continue; } var tmpBarContent = tb.Text; barName += tmpBarName + "\t"; barContent += tmpBarContent + "\t"; } if (dt.Rows.Count != 0) { barName = barName.Remove(barName.Length - 1); barContent = barContent.Remove(barContent.Length - 1); } } else { for (var i = 0; i < dt.Rows.Count; i++) { if (Convert.ToInt32(dt.Rows[i]["bar_field_type"]) != 1) { continue; } var tmpBarName = dt.Rows[i]["bar_field_name"].ToString(); var tb = scHandler.FindName("tbName_" + tmpBarName) as TextBox; if (tb == null) { continue; } var tmpBarContent = tb.Text; barName += tmpBarName + "\t"; barContent += tmpBarContent + "\t"; } if (barName.Length != 0) { barName = barName.Remove(barName.Length - 1); barContent = barContent.Remove(barContent.Length - 1); } } DbCheckResult.AddCheckResult(itemName, DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), state, shortCircuitInfo, openCircuitInfo, username, barName, barContent); CpldControl.CheckResultOutput.CheckResultOutput.ResultToTxt(username, itemName, barContent, state, shortCircuitInfo, openCircuitInfo); //write to file }