Exemple #1
0
 /// <summary>
 /// Checks if user with given password exists in the database
 /// </summary>
 /// <param name="_username">User name</param>
 /// <param name="_password">User password</param>
 /// <returns>True if user exist and password is correct</returns>
 public string IsValid(string username, string password)
 {
     try
     {
         var obj = new db_connect();
         return(obj.Login(username, password));
     }
     catch (Exception ex)
     {
         return("false");
     }
 }
Exemple #2
0
        /*Transport From*/
        public ActionResult submit_btn_transport(string name, string email, String phone, string from, string to)
        {
            try
            {
                var obj = new db_connect();
                var msg = "";
                obj.transportInsert(name, email, phone, from, to);

                MailMessage mail       = new MailMessage();
                SmtpClient  SmtpServer = new SmtpClient(mailServer);

                mail.From = new MailAddress(mailFrom);
                mail.To.Add(mailFrom);
                mail.Subject    = "Transport : " + name + " : " + from + " : " + to;
                mail.IsBodyHtml = true;

                string htmlBody;

                htmlBody = "<html> <head>  </head> <body>" +
                           "<div><img src=\"cid:icon_01\"> </div>" +
                           "<table border=\"1\" style=\"font - family:Georgia, Garamond, Serif; width: 100 %; color: blue; font - style:italic; \"> <tr bgcolor=\"#00FFFF\" align=\"center\"> <th> Name </th> <th> Email </th> <th> Phone </th> <th> Transport From </th> <th> Transport To </th>  </tr> <tr align=\"center\"> " +
                           "<td>" + name + "</td>" +
                           "<td>" + email + "</td>" +
                           "<td>" + phone + "</td>" +
                           "<td>" + from + "</td>" +
                           "<td>" + to + "</td>" +
                           "</tr> </table> </body> </html> ";

                mail.Body = htmlBody;
                //SmtpServer.Port = 587;
                SmtpServer.Credentials = new System.Net.NetworkCredential(mailFrom, mailPassword);
                //SmtpServer.EnableSsl = true;

                SmtpServer.Send(mail);
                TempData["AlertMessage"] = "Your details saved successfully, We will get back to you shortly.";
                return(RedirectToAction("Index", "Home"));
            }
            catch (Exception ex)
            {
                System.Web.HttpContext.Current.Response.Write("<script>alert('There is some issue while saving the details, please try again, Thanks.')</script>");
                return(RedirectToAction("Index", "Home"));
            }
        }