示例#1
0
        public User getProfileInfo(string email)
        {
            UserDaoImpl uDao = new UserDaoImpl();
            User currentUser = uDao.getUserByEmail(email);

            return currentUser;
        }
示例#2
0
        public bool authenticate(string userEmail, string pass)
        {
            bool valid = false;
            UserDaoImpl user = new UserDaoImpl();
            Credentials c = user.getCredentialsByEmail(userEmail);
            Credentials inputCreds = new Credentials(userEmail, pass);

            if (c.Password.Equals(inputCreds.Password) && c.Email.Equals(inputCreds.Email))
            {
                User u = user.getUserByEmail(c.Email);
                valid = true;
            }
            return valid;
        }
        public void sendInvoiceEmail(string email, DataSet ds)
        {
            UserDao dao = new UserDaoImpl();
            User toUser = dao.getUserByEmail(email);

            string toAddress = toUser.Email; // not ", "
            string[] toArray = toAddress.Split(',');

            string newUserId = toUser.UserID.ToString();
            string newUserfName = toUser.FirstName;
            string newUserlName = toUser.LastName;

            string senderEmail = "*****@*****.**";
            string senderName = "The Baby Fold Festival of Trees";

            MailAddress messageFrom = new MailAddress(senderEmail.ToLower(), senderName);
            //                    MailAddress messageTo = new MailAddress(to.Text);
            MailMessage emailMessage = new MailMessage();
            emailMessage.From = messageFrom;
            for (int i = 0; i < toArray.Length; ++i)
            {
                MailAddress messageTo = new MailAddress(toArray[i]);
                emailMessage.To.Add(messageTo.Address);
            }

            string html = @"<html><body><img src=""cid:LogoId""><div>Hello " + newUserfName + " " + newUserlName + ",<br /> Thank you so much for coming to Festival of Trees.<br />"
            + getHtml(ds)
            + "<br />Thank you for your support,"
            + "<br />  Festivel Of Trees Team</body></html>";
            AlternateView altView = AlternateView.CreateAlternateViewFromString(html, null, MediaTypeNames.Text.Html);

            LinkedResource yourPictureRes = new LinkedResource(HttpContext.Current.Server.MapPath("~\\assets\\image\\Email.jpg"), MediaTypeNames.Image.Jpeg);
            yourPictureRes.ContentId = "LogoId";
            altView.LinkedResources.Add(yourPictureRes);

            emailMessage.AlternateViews.Add(altView);

            string messageSubject = "Festival Of Trees: Your Invoice";
            string messageBody = html;
            emailMessage.Subject = messageSubject;
            emailMessage.Body = messageBody;
            SmtpClient mailClient = new SmtpClient("smtp.ilstu.edu");

            mailClient.UseDefaultCredentials = true;
            mailClient.Send(emailMessage);
        }
示例#4
0
        public bool isAdmin(string userEmail, string pass)
        {
            bool admin = false;
            UserDaoImpl user = new UserDaoImpl();
            Credentials c = user.getCredentialsByEmail(userEmail);

            if (c != null)
            {
                User u = user.getUserByEmail(c.Email);
                if (u.Admin)
                {
                    admin = true;
                }
            }
            return admin;
        }