private void lbDLLName_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            try
            {
                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    string fileName = openFileDialog1.SafeFileName.Substring(0, openFileDialog1.SafeFileName.LastIndexOf("."));

                    if (!Regex.IsMatch(fileName, @"^" + txtCarModelNo.Text.Substring(0, 2) + @"\d{3}$"))
                    {
                        throw new Exception("文件名不匹配,无法上传");
                    }

                    Guid guid = Guid.NewGuid();
                    FileOperationService.File_UpLoad(guid, openFileDialog1.FileName,
                                                     GeneralFunction.StringConvertToEnum <CE_CommunicationMode>(BasicInfo.BaseSwitchInfo[(int)CE_SwitchName.文件传输方式]));

                    MessageDialog.ShowPromptMessage("上传成功");

                    lbDLLName.Tag  = guid.ToString();
                    lbDLLName.Text = fileName;
                }
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message);
            }
        }
Exemplo n.º 2
0
        private void btn_ReportFile_Up_Click(object sender, EventArgs e)
        {
            try
            {
                if (lbReportFile.Tag != null && lbReportFile.Tag.ToString().Length > 0)
                {
                    foreach (string fileItem in lbReportFile.Tag.ToString().Split(','))
                    {
                        UniversalControlLibrary.FileOperationService.File_Delete(new Guid(fileItem),
                                                                                 GlobalObject.GeneralFunction.StringConvertToEnum <CE_CommunicationMode>(BasicInfo.BaseSwitchInfo[(int)GlobalObject.CE_SwitchName.文件传输方式]));
                    }
                }

                string strFilePath = "";

                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    foreach (string filePath in openFileDialog1.FileNames)
                    {
                        Guid guid = Guid.NewGuid();
                        FileOperationService.File_UpLoad(guid, filePath,
                                                         GlobalObject.GeneralFunction.StringConvertToEnum <CE_CommunicationMode>(BasicInfo.BaseSwitchInfo[(int)GlobalObject.CE_SwitchName.文件传输方式]));
                        strFilePath += guid.ToString() + ",";
                    }

                    lbReportFile.Tag = strFilePath.Substring(0, strFilePath.Length - 1);
                    m_serviceIsolation.UpdateFilePath(txtBillNo.Text, lbReportFile.Tag.ToString());
                    MessageDialog.ShowPromptMessage("上传成功");
                }
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message);
            }
        }
Exemplo n.º 3
0
        private void btn_Submit_Click(object sender, EventArgs e)
        {
            try
            {
                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    Guid guid = Guid.NewGuid();
                    FileOperationService.File_UpLoad(guid, openFileDialog1.FileName,
                                                     GlobalObject.GeneralFunction.StringConvertToEnum <CE_CommunicationMode>
                                                         (BasicInfo.BaseSwitchInfo[(int)GlobalObject.CE_SwitchName.文件传输方式]));

                    HR_Train_Courseware ware = new HR_Train_Courseware();

                    ware.CourseID       = _CourseInfo.ID;
                    ware.CoursewareName = txtCoursewareName.Text;
                    ware.FileUnique     = guid;
                    _ServiceBasicInfo.Operation_Courseware(ware);

                    MessageDialog.ShowPromptMessage("添加成功");
                    dgv_Courseware.DataSource = _ServiceBasicInfo.GetTable_Ware(_CourseInfo.ID);
                }
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message);
            }
        }
        private void btnUpLoad_Click(object sender, EventArgs e)
        {
            try
            {
                if (GeneralFunction.IsNullOrEmpty(txtFileName.Text))
                {
                    throw new Exception("请填写【文件名】");
                }

                if (GeneralFunction.IsNullOrEmpty(cmbFileType.Text))
                {
                    throw new Exception("请选择【文件类型】");
                }

                if (dtpFileDate.Value.Date > ServerTime.Time.Date)
                {
                    throw new Exception("【文件日期】不能大于当前时间");
                }

                string strFilePath = "";

                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    foreach (string filePath in openFileDialog1.FileNames)
                    {
                        Guid guid = Guid.NewGuid();
                        FileOperationService.File_UpLoad(guid, filePath,
                                                         GeneralFunction.StringConvertToEnum <CE_CommunicationMode>(BasicInfo.BaseSwitchInfo[(int)CE_SwitchName.文件传输方式]));
                        strFilePath += guid.ToString() + ",";
                    }

                    btnUpLoad.Tag = strFilePath.Substring(0, strFilePath.Length - 1);

                    Bus_Gauge_Files fileInfo = new Bus_Gauge_Files();

                    fileInfo.F_Id      = Guid.NewGuid().ToString();
                    fileInfo.FileDate  = dtpFileDate.Value;
                    fileInfo.FileName  = txtFileName.Text;
                    fileInfo.FilePath  = btnUpLoad.Tag.ToString();
                    fileInfo.FileType  = cmbFileType.Text;
                    fileInfo.GaugeCode = _GaugeCode;

                    _Service_Gauge.UpLoadFileInfo(fileInfo);
                    throw new Exception("上传成功");
                }
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message);
            }
            finally
            {
                DataGridViewShow();
            }
        }
Exemplo n.º 5
0
        void FileUpLoad(Button bt, Program_Report pr)
        {
            try
            {
                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    if (bt.Tag != null && bt.Tag.ToString().Length > 0)
                    {
                        UniversalControlLibrary.FileOperationService.File_Delete(new Guid(bt.Tag.ToString()),
                                                                                 GeneralFunction.StringConvertToEnum <CE_CommunicationMode>(BasicInfo.BaseSwitchInfo[(int)CE_SwitchName.文件传输方式]));
                    }

                    Guid guid = Guid.NewGuid();
                    FileOperationService.File_UpLoad(guid, openFileDialog1.FileName,
                                                     GeneralFunction.StringConvertToEnum <CE_CommunicationMode>(BasicInfo.BaseSwitchInfo[(int)CE_SwitchName.文件传输方式]));

                    bt.Tag = guid.ToString();
                    _ServiceTCU.UpdateFilePath(txtBillNo.Text, guid, pr);
                    MessageDialog.ShowPromptMessage("上传成功");

                    if (bt.Name == btnDownload_TCUSoft.Name)
                    {
                        toolTip1.SetToolTip(btnUpload_TCUSoft, openFileDialog1.FileName);
                    }
                    else if (bt.Name == btnDownload_TestReport.Name)
                    {
                        toolTip1.SetToolTip(btnUpload_TestReport, openFileDialog1.FileName);
                    }
                }

                if (btnDownload_TCUSoft.Tag != null && btnDownload_TCUSoft.Tag.ToString().Length > 0)
                {
                    btnDownload_TCUSoft.Enabled = true;
                }

                if (btnDownload_TestReport.Tag != null && btnDownload_TestReport.Tag.ToString().Length > 0)
                {
                    btnDownload_TestReport.Enabled = true;
                }
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message);
            }
        }
Exemplo n.º 6
0
        private void LinkLable_UpLoad_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];

                string strFilePath = "";

                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    if (lbLook.Tag != null && lbLook.Tag.ToString().Length > 0)
                    {
                        foreach (string fileItem in lbLook.Tag.ToString().Split(','))
                        {
                            UniversalControlLibrary.FileOperationService.File_Delete(new Guid(fileItem),
                                                                                     GlobalObject.GeneralFunction.StringConvertToEnum <CE_CommunicationMode>(BasicInfo.BaseSwitchInfo[(int)GlobalObject.CE_SwitchName.文件传输方式]));
                        }
                    }

                    foreach (string filePath in openFileDialog1.FileNames)
                    {
                        Guid guid = Guid.NewGuid();
                        FileOperationService.File_UpLoad(guid, filePath,
                                                         GlobalObject.GeneralFunction.StringConvertToEnum <CE_CommunicationMode>(BasicInfo.BaseSwitchInfo[(int)GlobalObject.CE_SwitchName.文件传输方式]));
                        strFilePath += guid.ToString() + ",";
                    }

                    lbLook.Tag = strFilePath.Substring(0, strFilePath.Length - 1);
                    _Service_EightDReport.UpdateFilePath(txtBillNo.Text, lbLook.Tag.ToString(), lbLook.Name.Contains("D1") ? "D1" : "D5");
                    MessageDialog.ShowPromptMessage("上传成功");
                    lbDownLoad.Enabled = true;
                    lbLook.Enabled     = true;
                }
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message);
            }
        }
        private void lbUpLoadFile_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            LinkLabel lbLink = (LinkLabel)sender;

            try
            {
                string strFilePath = "";

                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    if (lbLink.Tag != null && lbLink.ToString().Length > 0)
                    {
                        foreach (string fileItem in lbLink.Tag.ToString().Split(','))
                        {
                            UniversalControlLibrary.FileOperationService.File_Delete(new Guid(fileItem),
                                                                                     GlobalObject.GeneralFunction.StringConvertToEnum <CE_CommunicationMode>(BasicInfo.BaseSwitchInfo[(int)GlobalObject.CE_SwitchName.文件传输方式]));
                        }
                    }

                    foreach (string filePath in openFileDialog1.FileNames)
                    {
                        Guid guid = Guid.NewGuid();
                        FileOperationService.File_UpLoad(guid, filePath,
                                                         GlobalObject.GeneralFunction.StringConvertToEnum <CE_CommunicationMode>(BasicInfo.BaseSwitchInfo[(int)GlobalObject.CE_SwitchName.文件传输方式]));
                        strFilePath += guid.ToString() + ",";
                    }

                    lbLink.Tag         = strFilePath.Substring(0, strFilePath.Length - 1);
                    lbLookFile.Visible = true;
                    m_serverMkPlan.UpdateFilePath(txtDJH.Text, lbLink.Tag.ToString());
                    MessageDialog.ShowPromptMessage("上传成功");
                    lbLink.Visible = true;
                }
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message);
            }
        }
        void FileUp(LinkLabel lbLink)
        {
            try
            {
                string strFilePath = "";

                if (openFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    if (lbLink.Tag != null && lbLink.ToString().Length > 0)
                    {
                        foreach (string fileItem in lbLink.Tag.ToString().Split(','))
                        {
                            UniversalControlLibrary.FileOperationService.File_Delete(new Guid(fileItem),
                                                                                     GlobalObject.GeneralFunction.StringConvertToEnum <CE_CommunicationMode>(BasicInfo.BaseSwitchInfo[(int)GlobalObject.CE_SwitchName.文件传输方式]));
                        }
                    }

                    foreach (string filePath in openFileDialog1.FileNames)
                    {
                        Guid guid = Guid.NewGuid();
                        FileOperationService.File_UpLoad(guid, filePath,
                                                         GlobalObject.GeneralFunction.StringConvertToEnum <CE_CommunicationMode>(BasicInfo.BaseSwitchInfo[(int)GlobalObject.CE_SwitchName.文件传输方式]));
                        strFilePath += guid.ToString() + ",";
                    }

                    lbLink.Tag = strFilePath.Substring(0, strFilePath.Length - 1);
                    m_mainService.UpdateFilePath(txtBillNo.Text, lbLink.Tag.ToString(),
                                                 lbLink.Name.Contains(SelfSimpleEnum_CreativeePersentation.Before.ToString()) ?
                                                 SelfSimpleEnum_CreativeePersentation.Before : SelfSimpleEnum_CreativeePersentation.After);
                    MessageDialog.ShowPromptMessage("上传成功");
                    lbLink.Visible = true;
                }
            }
            catch (Exception ex)
            {
                MessageDialog.ShowPromptMessage(ex.Message);
            }
        }