private void Generate_QR_Click(object sender, EventArgs e) { string Message = Check_TextBox(); if (Message.Length > 0) { MessageBoxButtons buttons = MessageBoxButtons.OK; MessageBox.Show(Message, "請檢察欄位", buttons); } else { //確認資料庫是否重複姓名 using (OleDbCommand cmd = new OleDbCommand()) { Pic_pro = new Picture_Process(); OleDbDataReader dr; cmd.Connection = Access_DataBase.DB_Conn_Open(connectionStaffDB); cmd.CommandText = "SELECT * FROM staff_info WHERE Name = @name OR(ID = @id)";//" Name_Textbox.Text =Name " " + IDnumber_Textbox.Text + " = ID cmd.Parameters.AddWithValue("@name", Name_Textbox.Text); cmd.Parameters.AddWithValue("@id", IDnumber_Textbox.Text); dr = cmd.ExecuteReader(); if (!dr.HasRows) { //Convert.ToBase64String(//AES加密後); //Encoding.UTF8.GetString(//AES解密後) string Encode_str = Encode(IDnumber_Textbox.Text); //加密 byte[] Zxing_QR = ZXing_QR(Encode_str); Insert(Encode_str, IDnumber_Textbox.Text, SavePhoto(photopath_TextBox.Text), Zxing_QR); //存入D QR QRForm = new QR(Zxing_QR, Name_Textbox.Text, Encode_str); QRForm.ShowDialog(this); Refush_GirdView(); Initial_New_StaffTB(); } else//repeat { //TODO MessageBox Warning MessageBoxButtons buttons = MessageBoxButtons.OK; MessageBox.Show("員工重複申請", "重複", buttons); } } } //先確認資料欄位有沒有資料 //存檔資料庫 連同照片轉成binaray }
public ShowInfo(List <Table_Row> table_row, Main_System Main_Form, String TableName, String Path) { Pic_pro = new Picture_Process(); InitializeComponent(); connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Path + ";"; ID_text.Text = table_row[0].Id; Name_text.Text = table_row[0].Name; Sex_text.Text = table_row[0].Sex; CarNum_text.Text = table_row[0].CarNumP; Job_text.Text = table_row[0].Job; Main_Form_Get = Main_Form; TableName_Get = TableName; using (MemoryStream memStream = new MemoryStream(table_row[0].Photo)) { Photo.Image = Image.FromStream(memStream); } //檢查進出狀況 Check_In_Off(); }