Exemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            DialogResult result = MessageBox.Show("是否確定歸檔此公文?", "歸檔確認",
                                                  MessageBoxButtons.YesNo,
                                                  MessageBoxIcon.Question);
            UpFile set = new UpFile();

            set.SetFFixContent("無");
            set.SetFileStatus("3");
            set.SetFileNumber(comboBox1.Text); if (result == DialogResult.Yes)
            {
                try
                {
                    if (set.UpfdateUpFile(set))
                    {
                        MessageBox.Show("已成功歸檔公文:" + set.GetFileNumber() + "\n" + "歸檔時間:" + Convert.ToString(DateTime.Now), "送出結果"
                                        );


                        textBox2.Text = "";
                    }
                    else
                    {
                        MessageBox.Show("退件公文:" + set.GetFileNumber() + "失敗");
                    }
                    this.Close();
                }


                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString());
                }
            }
        }
Exemplo n.º 2
0
        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 = "";
        }
Exemplo n.º 3
0
        public UpFile Retrieveq(string num)
        {
            DBConnect dbconn = new DBConnect();

            dbconn.ConnectDB();
            UpFile objq = new UpFile();

            try
            {
                dbconn.getCmd().CommandText = "SELECT * from FileData WHERE FileNumber = '" + num + "'";
                dbconn.getCmd().CommandType = System.Data.CommandType.Text;
                dbconn.getConn().Open();

                OleDbDataReader reader = dbconn.getCmd().ExecuteReader();
                while (reader.Read())
                {
                    objq.SetFileNumber(reader["FileNumber"].ToString());
                    objq.SetFileTitle(reader["Title"].ToString());
                    objq.SetFileContent(reader["Content"].ToString());
                    objq.SetFileStatus(reader["Status"].ToString());
                    objq.SetFFixContent(reader["FixContent"].ToString());
                    objq.SetUpD(reader["FileDate"].ToString());
                    objq.SetUpT(reader["UpTime"].ToString());
                }
            }

            catch (Exception e)
            {
                System.Console.WriteLine("Error message :" + e.ToString());
            }
            finally
            {
                if (dbconn.getConn() != null)
                {
                    dbconn.getConn().Close();
                }
            }
            return(objq);
        }