void ShowInfo() { if (_UpdateInfo == null) { txtBillNo.Text = this.FlowInfo_BillNo; _UpdateInfo = new Business_Project_TCU_SoftwareUpdate(); } else { lbBillStatus.Text = _SericeFlow.GetNowBillStatus(_UpdateInfo.BillNo); txtBillNo.Text = _UpdateInfo.BillNo; txtCarModelNo.Text = _UpdateInfo.CarModelNo; txtClientVersion.Text = _UpdateInfo.ClientVersion; txtDiagnosisVersion.Text = _UpdateInfo.DiagnosisVersion; txtHardwareVersion.Text = _UpdateInfo.HardwareVersion; txtTechnicalNote.Text = _UpdateInfo.TechnicalNote; txtTestResult.Text = _UpdateInfo.TestResult; txtUnderVersion.Text = _UpdateInfo.UnderVersion; txtUpdateContent.Text = _UpdateInfo.UpdateContent; txtUpdateReason.Text = _UpdateInfo.UpdateReason; cmbVersionType.Text = _UpdateInfo.Version.Substring(txtCarModelNo.Text.Length, 1); txtVersion.Text = _UpdateInfo.Version.Substring((txtCarModelNo.Text + "T").ToString().Length); btnDownload_TCUSoft.Tag = _UpdateInfo.ProgramUnique; btnDownload_TestReport.Tag = _UpdateInfo.TestReport; if (_UpdateInfo.IsPassTest != null) { if (((bool)_UpdateInfo.IsPassTest)) { rbYes_Pass.Checked = true; rbNo_Pass.Checked = false; } else { rbYes_Pass.Checked = false; rbNo_Pass.Checked = true; } } } if (lbBillStatus.Text == CE_CommonBillStatus.新建单据.ToString()) { btnUpload_TCUSoft.Enabled = true; cmbVersionType.Enabled = true; btnUpload_TestReport.Enabled = false; } else { btnUpload_TCUSoft.Enabled = false; cmbVersionType.Enabled = false; btnUpload_TestReport.Enabled = true; } if (lbBillStatus.Text == CE_CommonBillStatus.单据完成.ToString()) { btnUpload_TCUSoft.Enabled = false; cmbVersionType.Enabled = false; btnUpload_TestReport.Enabled = false; } if (btnDownload_TCUSoft.Tag == null || btnDownload_TCUSoft.Tag.ToString().Length == 0) { btnDownload_TCUSoft.Enabled = false; } if (btnDownload_TestReport.Tag == null || btnDownload_TestReport.Tag.ToString().Length == 0) { btnDownload_TestReport.Enabled = false; } RefreshDataGridView(_ListDID); }
public void SaveInfo_TCUSoft(Business_Project_TCU_SoftwareUpdate updateInfo, List <View_Business_Project_TCU_SoftwareUpdate_DID> lstDID) { FlowControlService.IFlowServer serviceFlow = FlowControlService.ServerModuleFactory.GetServerModule <FlowControlService.IFlowServer>(); DepotManagementDataContext ctx = CommentParameter.DepotDataContext; Flow_FlowInfo flow = serviceFlow.GetNowFlowInfo(serviceFlow.GetBusinessTypeID(CE_BillTypeEnum.TCU软件升级, null), updateInfo.BillNo); ctx.Connection.Open(); ctx.Transaction = ctx.Connection.BeginTransaction(); try { if (updateInfo == null || updateInfo.BillNo == null) { return; } var varData = from a in ctx.Business_Project_TCU_SoftwareUpdate where a.BillNo == updateInfo.BillNo select a; Business_Project_TCU_SoftwareUpdate tempInfo = new Business_Project_TCU_SoftwareUpdate(); if (varData.Count() == 0) { tempInfo.BillNo = updateInfo.BillNo; tempInfo.CarModelNo = updateInfo.CarModelNo; tempInfo.ClientVersion = updateInfo.ClientVersion; tempInfo.DiagnosisVersion = updateInfo.DiagnosisVersion; tempInfo.HardwareVersion = updateInfo.HardwareVersion; tempInfo.ProgramUnique = updateInfo.ProgramUnique; tempInfo.TechnicalNote = updateInfo.TechnicalNote; tempInfo.UnderVersion = updateInfo.UnderVersion; tempInfo.UpdateContent = updateInfo.UpdateContent; tempInfo.UpdateReason = updateInfo.UpdateReason; tempInfo.Version = updateInfo.Version; ctx.Business_Project_TCU_SoftwareUpdate.InsertOnSubmit(tempInfo); } else if (varData.Count() == 1) { tempInfo = varData.Single(); switch (flow.FlowID) { case 70: tempInfo.CarModelNo = updateInfo.CarModelNo; tempInfo.ClientVersion = updateInfo.ClientVersion; tempInfo.DiagnosisVersion = updateInfo.DiagnosisVersion; tempInfo.HardwareVersion = updateInfo.HardwareVersion; tempInfo.ProgramUnique = updateInfo.ProgramUnique; tempInfo.TechnicalNote = updateInfo.TechnicalNote; tempInfo.UnderVersion = updateInfo.UnderVersion; tempInfo.UpdateContent = updateInfo.UpdateContent; tempInfo.UpdateReason = updateInfo.UpdateReason; tempInfo.Version = updateInfo.Version; break; case 72: tempInfo.IsPassTest = updateInfo.IsPassTest; tempInfo.TestReport = updateInfo.TestReport; tempInfo.TestResult = updateInfo.TestResult; break; default: break; } } ctx.SubmitChanges(); if (lstDID != null && serviceFlow.GetNowBillStatus(updateInfo.BillNo) == CE_CommonBillStatus.新建单据.ToString()) { var varData1 = from a in ctx.Business_Project_TCU_SoftwareUpdate_DID where a.BillNo == updateInfo.BillNo select a; ctx.Business_Project_TCU_SoftwareUpdate_DID.DeleteAllOnSubmit(varData1); ctx.SubmitChanges(); foreach (View_Business_Project_TCU_SoftwareUpdate_DID item in lstDID) { Business_Project_TCU_SoftwareUpdate_DID tempDID = new Business_Project_TCU_SoftwareUpdate_DID(); tempDID.BillNo = updateInfo.BillNo; tempDID.DID = item.DID; tempDID.DataContent = item.内容; tempDID.DataSize = item.字节数; ctx.Business_Project_TCU_SoftwareUpdate_DID.InsertOnSubmit(tempDID); } } ctx.SubmitChanges(); ctx.Transaction.Commit(); } catch (Exception ex) { ctx.Transaction.Rollback(); throw new Exception(ex.Message); } }