~\17168erp\App_Code\encrypt.cs // 加密程式 ~\17168erp\App_Code\function.cs // 輔助功能 // 有加密的欄位 phone 聯絡電話 id_code 身份證號 passport 護照號碼 cellphone 手機號碼 contactor_phone 緊急連絡人電話 // Page_Load // ** 解密 DecryptAutoKey ** if (!isStrNull(prod.phone)) { MyWeb.encrypt encrypt = new MyWeb.encrypt(); contactor_phone.Text = encrypt.DecryptAutoKey(prod.phone.ToString()); } // edit_Click // ** 加密 EncryptAutoKey ** encrypt.EncryptAutoKey(textBox.Text.Trim()) // 使用參考 foreach (Control obj in cardBodyPanel.Controls) { if (obj is TextBox) { var ObjValue = followers.GetType().GetProperty(obj.ID); var textBox = (TextBox)obj; if (!isStrNull(textBox.Text)) { if (textBox.TextMode == TextBoxMode.Date) ObjValue.SetValue(followers, selectDate(textBox)); else if (!isStrNull(((TextBox)obj).Attributes["data-encrypt"]) && ValString(textBox.Attributes["data-encrypt"]).Equals("Y")) ObjValue.SetValue(followers, encrypt.EncryptAutoKey(textBox.Text.Trim())); else ObjValue.SetValue(followers, ((TextBox)obj).Text.Trim()); } else ObjValue.SetValue(followers, null); } }