예제 #1
0
 private void answerUpload_Click(object sender, EventArgs e)//回答上传
 {
     try
     {
         LibraryBLL.question a = new LibraryBLL.question();
         a.answerCheckIn(answerIntro.Text, qusertionId, username.Text, System.DateTime.Now.ToString(), filename);
         LibraryBLL.FtpHelper b = new LibraryBLL.FtpHelper();
         if (filename != "")
         {
             b.answerUpload(filepath);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return;
     }
     if (MessageBox.Show("发布成功") == DialogResult.OK)
     {
         answerContentshow();
         filename = ""; filepath = "";
     }
 }
예제 #2
0
        private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)//下载文件
        {
            SaveFileDialog saveFileDialog = new SaveFileDialog();

            saveFileDialog.FileName = fileName.Text.Trim();
            saveFileDialog.Filter   = "所有文件(*.*)|(*.*)";
            if (saveFileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }
            string filePath = saveFileDialog.FileName;

            try
            {
                LibraryBLL.FtpHelper b = new LibraryBLL.FtpHelper();
                b.Download(filePath, fileName.Text);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }
            MessageBox.Show("下载成功");
        }
예제 #3
0
 private void questionUpload_Click(object sender, EventArgs e)//问题上传
 {
     try
     {
         LibraryBLL.question a = new LibraryBLL.question();
         a.questionCheckIn(questionTitle.Text, questionType.Text, questionIntro.Text, filename, System.DateTime.Now.ToString(), username.Text);
         LibraryBLL.FtpHelper b = new LibraryBLL.FtpHelper();
         if (filename != "")
         {
             b.Upload(filepath);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return;
     }
     if (MessageBox.Show("发布成功") == DialogResult.OK)
     {
         askContentshow("");
         filename = ""; filepath = "";
         skinPanelQuestion.Visible = false;
     }
 }