Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 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();
            }
        }
Ejemplo n.º 4
0
        private void btn_submit_Click(object sender, EventArgs e)
        {
            if (supplement == null)
            {
                supplement = new Db.Entity.ResultSupplement();
            }
            //supplement.alarmInputList = this.alarmSupplementPan.dgv.Rows;
            List <ResultSupplement.AlarmInput> inputList = new List <ResultSupplement.AlarmInput>();

            foreach (DataGridViewRow item in this.alarmSupplementPan.dgv.Rows)
            {
                ResultSupplement.AlarmInput alarm = new ResultSupplement.AlarmInput();
                if (item.Cells[0].Value == null && item.Cells[1].Value == null && item.Cells[2].Value == null &&
                    item.Cells[3].Value == null && item.Cells[4].Value == null)
                {
                    continue;
                }
                else
                {
                    alarm.taskId    = taskInfoId;
                    alarm.alarmType = item.Cells[1].Value == null ? "" : item.Cells[1].Value.ToString();
                    alarm.alarmForm = item.Cells[2].Value == null ? "" : item.Cells[2].Value.ToString();
                    alarm.classify  = item.Cells[3].Value == null ? "" : item.Cells[3].Value.ToString();
                    alarm.describe  = item.Cells[4].Value == null ? "" : item.Cells[4].Value.ToString();
                }
                inputList.Add(alarm);
            }
            supplement.alarmInputList = inputList;
            //supplement.alarmType = txt_alarmType.Text.Trim();
            //supplement.alarmForm = txt_alarmForm.Text.Trim();
            supplement.totalTest           = ii_testCount.Value;
            supplement.alarmTest           = ii_alarmCount.Value;
            supplement.omitCount           = ii_omitCount.Value;
            supplement.misinformationCount = ii_misinformationCount.Value;
            supplement.usableCount         = ii_usableCount.Value;
            this.DialogResult = DialogResult.OK;
            this.Close();
        }