コード例 #1
0
        public static bool checkPassword(string username, string password)
        {
            string sql1 = "select Password from LogIn where UserName=N'" + username + "'";
            string key  = ReadXML.GetString("MyResource.xml", "setting/KeyCrypt");
            string s    = StringPassword.DecrytString(MyConnect.getString(sql1), key);

            if (String.IsNullOrEmpty(s))
            {
                return(false);
            }
            if (s.Equals(password))
            {
                return(true);
            }
            return(false);
        }
コード例 #2
0
ファイル: MyAction.cs プロジェクト: VincentTr4n/ComputerStore
 public static bool sendEmail(string toEmail, string code)
 {
     try
     {
         SmtpClient client = new SmtpClient
         {
             Host           = ReadXML.GetString("MyResource.xml", "setting/hostID"),
             Port           = 587,
             EnableSsl      = true,
             DeliveryMethod = SmtpDeliveryMethod.Network,
             Credentials    = new System.Net.NetworkCredential(ReadXML.GetString("MyResource.xml", "setting/Email"), ReadXML.GetString("MyResource.xml", "setting/Password")),
             Timeout        = 10000,
         };
         MailMessage mess = new MailMessage(ReadXML.GetString("MyResource.xml", "setting/Email"), toEmail, "Recover password", code);
         client.Send(mess);
     }
     catch
     {
         return(false);
     }
     return(true);
 }
コード例 #3
0
 public static void Connect()
 {
     con = new SqlConnection(ReadXML.GetString("MyConnect.xml", "setting/connectionString"));
     con.Open();
 }