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);
        }
 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);
 }
 public static void Connect()
 {
     con = new SqlConnection(ReadXML.GetString("MyConnect.xml", "setting/connectionString"));
     con.Open();
 }