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 }
private void button3_Click(object sender, EventArgs e) { QR QRcode = new QR(Sent_QRcode, Sent_staff_Name, Sent_Encode_ID); QRcode.ShowDialog(this); }