void TaskInfoList_Loaded(object sender, RoutedEventArgs e) { taskGrid.UpEvent += taskGrid_UpEvent; taskGrid.StateEvent += taskGrid_StateEvent; taskGrid.SelectionEvent += taskGrid_SelectionEvent; // 隐藏执行脚本按钮 if (System.Configuration.ConfigurationManager.AppSettings["simulator"] != "true") { scriptrun.Visibility = System.Windows.Visibility.Hidden; } cbStatus.SelectedIndex = s_cbStatus.HasValue ? s_cbStatus.Value: 1; if (!System.ComponentModel.DesignerProperties.GetIsInDesignMode(this)) { log.Info(string.Format("TaskInfoList > getList > user name:{0}", MainWindow.UserName)); dataSource = TaskinfoDAL.getList(MainWindow.UserName); log.Info(string.Format("TaskInfoList > getList > data count:{0}", dataSource.Count)); List <KV> gongbus = getGongBu(dataSource); cbGongbu.ItemsSource = gongbus; cbGongbu.DisplayMemberPath = "value"; log.Info(string.Format("TaskInfoList > gongbu List > data count:{0}", gongbus.Count)); cbGongbu.SelectedIndex = s_cbGongbu.HasValue? s_cbGongbu.Value : 0; dpBegin.SelectedDate = s_qBegin.HasValue ? s_qBegin : DateTime.Now.AddDays(-1); dpEnd.SelectedDate = s_qEnd.HasValue? s_qEnd: DateTime.Now.AddDays(1); if (!string.IsNullOrEmpty(s_qProjectName)) { qProjectName.Text = s_qProjectName; } if (!string.IsNullOrEmpty(s_qTaskName)) { qTaskName.Text = s_qTaskName; } query_Click(null, null); showDetail(); } }
public bool init() { var taskInfoList = TaskinfoDAL.getList(userName); if (taskInfoList == null || taskInfoList.Count == 0) { SendMessageEvent(false, string.Format("用户[{0}],无任务数据", userName)); CompleteEvent(this, new CompleteArgs() { Message = "数据导入失败" }); return(false); } this.taskInfo = taskInfoList.FirstOrDefault(it => it.taskCode == taskCode); if (taskInfo == null) { SendMessageEvent(false, string.Format("任务[{0}],不存在", taskCode)); CompleteEvent(this, new CompleteArgs() { Message = "数据导入失败" }); return(false); } var dataSource = WebHelper.listTdmTaskTimesInfo(taskInfo.id); if (dataSource.Count(it => it.TestTime == this.times.ToString()) < 1) { SendMessageEvent(false, string.Format("任务 [ {0} ] ,试验次数 [ {1} ] 不存在,", taskCode, this.times)); CompleteEvent(this, new CompleteArgs() { Message = "数据导入失败" }); return(false); } string fid = scriptCode2Fid(scriptCode); if (string.IsNullOrEmpty(fid)) { SendMessageEvent(false, string.Format("任务[{0}],不存在", taskCode)); CompleteEvent(this, new CompleteArgs() { Message = "数据导入失败" }); return(false); } this.dataScript = DataScriptDAL.getInfo(fid); if (dataScript == null) { SendMessageEvent(false, string.Format("任务[{0}],不存在", taskCode)); CompleteEvent(this, new CompleteArgs() { Message = "数据导入失败" }); return(false); } this.dataScriptRule = DataScriptRuleDAL.getInfo(fid); if (dataScriptRule == null) { SendMessageEvent(false, string.Format("任务规则[{0}],不存在", fid)); CompleteEvent(this, new CompleteArgs() { Message = "数据导入失败" }); return(false); } this.columnMap = getColumnMap(); if (this.dataScriptRule != null) { this.structList = TableDAL.getTableStructure(this.dataScriptRule.DesTable); } return(true); }