private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { UpFile objsh2 = new UpFile(); objsh2 = objsh2.Retrieveq(comboBox1.Text); label1.Text = "公文標題:" + objsh2.GetFileTitle(); progressBar1.Maximum = 4; progressBar1.Value = Convert.ToInt32(objsh2.GetFileStatus()) + 1; ModifyProgressBarColor.SetState(progressBar1, 1); if (objsh2.GetFileStatus().Equals("0")) { label2.Text = "目前狀態:公文以上傳審核中"; } else if (objsh2.GetFileStatus().Equals("1")) { ModifyProgressBarColor.SetState(progressBar1, 2); label2.Text = "目前狀態:公文被退件請修正"; } else if (objsh2.GetFileStatus().Equals("2")) { label2.Text = "目前狀態:公文已通過待歸檔"; } else if (objsh2.GetFileStatus().Equals("3")) { label2.Text = "目前狀態:公文已歸檔"; } }
private void button1_Click(object sender, EventArgs e) { try { UpFile u = new UpFile(); u.SetFileNumber(comboBox2.Text); u.SetFileTitle(textBox3.Text); u.SetFileContent(textBox2.Text); u.SetFileStatus("0"); if (u.UpfdateFileInfo(u)) { MessageBox.Show("更新公文編號:" + comboBox2.Text + "成功"); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; } else { MessageBox.Show("更新公文編號:" + comboBox2.Text + " 失敗"); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } UpFile u2 = new UpFile(); u2 = u2.Retrieveq(comboBox2.Text); textBox1.Text = u2.GetFileContent(); label1.Text = "公文標題:" + u2.GetFileTitle(); label6.Text = "需修改內容:" + u2.GetFFixContent(); comboBox1.Text = ""; comboBox2.Text = ""; }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { UpFile objsh2 = new UpFile(); objsh2 = objsh2.Retrieveq(comboBox1.Text); label3.Text = "公文標題:" + objsh2.GetFileTitle(); textBox2.Text = objsh2.GetFileContent(); }
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e) { UpFile u = new UpFile(); u = u.Retrieveq(comboBox2.Text); textBox1.Text = u.GetFileContent(); label1.Text = "公文標題:" + u.GetFileTitle(); label6.Text = "需修改內容:" + u.GetFFixContent(); }
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { UpFile u = new UpFile(); u = u.Retrieveq(comboBox1.Text); comboBox1.DataSource = u.retrieveAllFile(); label1.Text = "公文標題:" + u.GetFileTitle(); label2.Text = "上傳日期:" + u.GetUpD(); label3.Text = "上傳時間:" + u.GetUpT(); textBox1.Text = u.GetFileContent(); }
public bool UpfdateFileInfo(UpFile objUpFile) { Boolean tf = false; DBConnect dbconn = new DBConnect(); dbconn.ConnectDB(); try { // 注意 : 字串要用單引號 ' ', 數字欄位不需要單引號 dbconn.getCmd().CommandText = "Update FileData SET Content='" + objUpFile.GetFileContent() + "',Title='" + objUpFile.GetFileTitle() + "',Status='" + objUpFile.GetFileStatus() + "' WHERE FileNumber= '" + objUpFile.GetFileNumber() + "'"; dbconn.getCmd().CommandType = System.Data.CommandType.Text; dbconn.getConn().Open(); dbconn.getCmd().ExecuteNonQuery(); tf = true; } catch (Exception e) { System.Console.WriteLine("Error message :" + e.ToString()); } finally { if (dbconn.getConn() != null) { dbconn.getConn().Close(); } }; return(tf); }
public bool InsertUpFile(UpFile objUpFile) { Boolean tf = false; DBConnect dbconn = new DBConnect(); dbconn.ConnectDB(); try { Random r1 = new Random(); // 注意 : 字串要用單引號 ' ', 數字欄位不需要單引號 dbconn.getCmd().CommandText = "INSERT INTO FileData(FileNumber,Title,Content,FixContent,FileDate,UpTime,Status) VALUES('" + r1.Next(100000, 999999) + "','" + objUpFile.GetFileTitle() + "','" + objUpFile.GetFileContent() + "','無" + "','" + objUpFile.GetUpD() + "','" + objUpFile.GetUpT() + "','0" + "')"; dbconn.getCmd().CommandType = System.Data.CommandType.Text; dbconn.getConn().Open(); dbconn.getCmd().ExecuteNonQuery(); tf = true; } catch (Exception e) { System.Console.WriteLine("Error message :" + e.ToString()); } finally { if (dbconn.getConn() != null) { dbconn.getConn().Close(); } }; return(tf); }