public SupplementForm(string supplementJsonString, int taskId) { InitializeComponent(); this.taskInfoId = taskId; try { supplement = ResultSupplement.fromJson(supplementJsonString); } catch (Exception ex) { supplement = null; } DevComponents.DotNetBar.Controls.DataGridViewComboBoxExColumn control = (DevComponents.DotNetBar.Controls.DataGridViewComboBoxExColumn)alarmSupplementPan.dgv.Columns["classify"]; control.BeforeCellPaint += Control_BeforeCellPaint; }
public static void saveResults(List <Tb_taskResult> taskResultList) { using (EFMySqlDbContext context = new Db.EFMySqlDbContext()) { using (var transaction = context.Database.BeginTransaction()) { try { for (int i = 0; i < taskResultList.Count; i++) { context.Tb_taskResults.Add(taskResultList[i]); context.SaveChanges(); context.Entry(taskResultList[i]); int resultId = taskResultList[i].id; string supple = taskResultList[i].supplement; ResultSupplement resultSupp = ResultSupplement.fromJson(supple); if (resultSupp != null) { foreach (var item in resultSupp.alarmInputList) { Tb_alarminput alarm = new Tb_alarminput(); alarm.taskId = taskResultList[i].taskId; alarm.resultId = resultId; alarm.alarmType = item.alarmType; alarm.alarmForm = item.alarmForm; alarm.classify = item.classify; alarm.describe = item.describe; context.Tb_alarminputs.Add(alarm); context.SaveChanges(); } } //context.Tb_alarminputs.Add() } transaction.Commit(); } catch (Exception ex) { transaction.Rollback(); throw ex; } } //context.Tb_taskResults.AddRange(taskResultList); //context.SaveChanges(); } }
/// <summary> /// 只读模式的构造函数 /// </summary> /// <param name="remoteFiles"></param> public FtpListForm(string remoteFiles, string supplementJsonString) { InitializeComponent(); readOnly = true; foreach (string remoteFile in remoteFiles.Split(new string[] { ";" }, StringSplitOptions.RemoveEmptyEntries)) { remoteFileList.Add(remoteFile); addIc(remoteFile, true); } btn_openFileDialog.Enabled = false; superTabItem2.Visible = true; this.Text = "附件及补漏报管理"; try { supplement = ResultSupplement.fromJson(supplementJsonString); } catch (Exception ex) { supplement = null; } if (supplement != null) { //alarmSupplementPan.dgv.Rows.Add(supplement.alarmInputList.Count); //for (int i = 0; i < supplement.alarmInputList.Count; i++) //{ // DataGridViewRow row = alarmSupplementPan.dgv.Rows[i]; // row.Cells[0].Value = supplement.alarmInputList[i].taskId; // row.Cells[1].Value = supplement.alarmInputList[i].alarmType; // row.Cells[2].Value = supplement.alarmInputList[i].alarmForm; // row.Cells[3].Value = supplement.alarmInputList[i].classify; // row.Cells[4].Value = supplement.alarmInputList[i].describe; //} alarmSupplementPan.dgv.DataSource = supplement.alarmInputList; //txt_alarmType.Text = supplement.alarmType; //txt_alarmForm.Text = supplement.alarmForm; ii_testCount.Text = supplement.totalTest.ToString(); ii_alarmCount.Text = supplement.alarmTest.ToString(); ii_omitCount.Text = supplement.omitCount.ToString(); ii_misinformationCount.Text = supplement.misinformationCount.ToString(); ii_usableCount.Text = supplement.usableCount.ToString(); } }