private void btnDownLoad_Click(object sender, EventArgs e) { try { if (customDataGridView1.CurrentRow == null) { return; } string filePath = customDataGridView1.CurrentRow.Cells["FilePath"].Value.ToString(); if (GeneralFunction.IsNullOrEmpty(filePath)) { throw new Exception("无附件下载"); } if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) { string[] tempArray = filePath.Split(','); for (int i = 0; i < tempArray.Length; i++) { FileOperationService.File_DownLoad(new Guid(tempArray[i]), folderBrowserDialog1.SelectedPath + "\\" + txtFileName.Text + "_" + i.ToString(), GlobalObject.GeneralFunction.StringConvertToEnum <CE_CommunicationMode>(BasicInfo.BaseSwitchInfo[(int)GlobalObject.CE_SwitchName.文件传输方式])); } } } catch (Exception ex) { MessageDialog.ShowPromptMessage(ex.Message); } }
private void LinkLable_DownLoad_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) { try { List <LinkLabel> lstllb = GetListLinkLabel(sender as Control); LinkLabel lbUpLoad = lstllb[0]; LinkLabel lbLook = lstllb[1]; LinkLabel lbDownLoad = lstllb[2]; if (lbLook.Tag == null || lbLook.Tag.ToString().Length == 0) { throw new Exception("无附件下载"); } if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) { string[] tempArray = lbLook.Tag.ToString().Split(','); for (int i = 0; i < tempArray.Length; i++) { FileOperationService.File_DownLoad(new Guid(tempArray[i]), folderBrowserDialog1.SelectedPath + "\\" + txtBillNo.Text + "_" + i.ToString(), GlobalObject.GeneralFunction.StringConvertToEnum <CE_CommunicationMode>(BasicInfo.BaseSwitchInfo[(int)GlobalObject.CE_SwitchName.文件传输方式])); } MessageDialog.ShowPromptMessage("下载成功"); } } catch (Exception ex) { MessageDialog.ShowPromptMessage(ex.Message); } }
void FileDownLoad(Button bt, Program_Report pr) { try { if (bt.Tag == null || bt.Tag.ToString().Length == 0) { MessageDialog.ShowPromptMessage("无附件下载"); return; } if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) { if (pr == Program_Report.Program) { FileOperationService.File_DownLoad(new Guid(bt.Tag.ToString()), folderBrowserDialog1.SelectedPath + "\\TCU程序(" + txtCarModelNo.Text.ToUpper() + cmbVersionType.Text + txtVersion.Text.Trim().ToLower() + ")", GeneralFunction.StringConvertToEnum <CE_CommunicationMode>(BasicInfo.BaseSwitchInfo[(int)CE_SwitchName.文件传输方式])); _ServiceTCU.WriteTxtFile(txtBillNo.Text, folderBrowserDialog1.SelectedPath); } else { FileOperationService.File_DownLoad(new Guid(bt.Tag.ToString()), folderBrowserDialog1.SelectedPath + "\\" + txtBillNo.Text + "_测试报告", GeneralFunction.StringConvertToEnum <CE_CommunicationMode>(BasicInfo.BaseSwitchInfo[(int)CE_SwitchName.文件传输方式])); } MessageDialog.ShowPromptMessage("下载成功"); } } catch (Exception ex) { MessageDialog.ShowPromptMessage(ex.Message); } }
private void btn_ReportFile_Down_Click(object sender, EventArgs e) { if (lbReportFile.Tag == null || lbReportFile.Tag.ToString().Length == 0) { MessageDialog.ShowPromptMessage("无附件下载"); return; } if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) { string[] tempArray = lbReportFile.Tag.ToString().Split(','); for (int i = 0; i < tempArray.Length; i++) { FileOperationService.File_DownLoad(new Guid(tempArray[i]), folderBrowserDialog1.SelectedPath + "\\" + txtBillNo.Text + "_" + i.ToString(), GlobalObject.GeneralFunction.StringConvertToEnum <CE_CommunicationMode>(BasicInfo.BaseSwitchInfo[(int)GlobalObject.CE_SwitchName.文件传输方式])); } MessageDialog.ShowPromptMessage("下载成功"); } }