//[ActivePaidMember]
        public ActionResult New([Bind(Include = "messageID,subject,body,ID,dateCreated,replyMessageID,toID")] Messages messages)
        {
            Messages m = new Messages();

            if (ModelState.IsValid)
            {
                //get subject & body
                m.body        = messages.body;
                m.dateCreated = DateTime.Now;
                m.subject     = messages.subject;

                //From
                m.ID = (int)config.LoggedInMember.ID;

                //To
                //if not reply
                m.toMemberID = RouteID;

                Messages origMess = db.Messages.Where(q => q.ID == RouteID).FirstOrDefault();

                if (origMess != null)
                {
                    m.toMemberID     = origMess.ID;
                    m.replyMessageID = origMess.ID;
                }

                //Add message to database and save
                db.Messages.Add(m);
                db.SaveChanges();

                //Send email
                string _toEmail    = config.GetEmailAddress((long)m.toMemberID);
                string _fromMember = config.LoggedInMember.ScreenName;

                MailModel mm = new MailModel();
                mm.To      = _toEmail;
                mm.Subject = "New mail message from CouplesDatingScene.com member: " + _fromMember;
                mm.Body    = "SUBJECT " + messages.subject + " </hr> MESSAGE: " + messages.body + "</br> Click <a href='www.couplesdatingscene.com'>here</a> to go to site";

                SendMailerController.SendEmail(mm);

                //return screen
                return(PartialView("_Message", m));
            }

            //ViewBag.ID = new SelectList(db.Member, "ID", "FirstName1", messages.ID);
            return(PartialView("_Message", m));
        }
Пример #2
0
        public void SendFriendRequestMessage(Friends f)
        {
            //create message
            Messages message = new Messages();

            message.ID          = (int)f.Member1ID;
            message.toMemberID  = (int)f.Member2ID;
            message.subject     = "New Friend Request is waiting for you.";
            message.body        = "Click <a href='/friends/AcceptFriend/" + config.LoggedInMember.ID.ToString() + "'>here</a> to accept friend request.";
            message.dateCreated = DateTime.Now;

            db.Messages.Add(message);
            db.SaveChanges();

            //send email
            string _toEmail    = config.GetEmailAddress((long)f.Member2ID);
            string _fromMember = config.LoggedInMember.ScreenName;

            MailModel mm = new MailModel();

            mm.To      = _toEmail;
            mm.Subject = "You have a Friend Request from CouplesDatingScene.com member: " + _fromMember;
            mm.Body    = "</br> Click <a href='www.couplesdatingscene.com'>here</a> to go to site and find your new friend request in your Mailbox.";

            string _path = "/content/images/members/profilepics/test.jpg";//TODO

            try
            {
                _path = f.Member.MemberMedia.FirstOrDefault().path.ToString();
            }
            catch (Exception ex)
            {
            }

            SendMailerController.SendEmail(mm, _path);
        }
Пример #3
0
        public ActionResult DDRequest([Bind(Include = "doubleDateRequestID,requestDate,accepted,acceptedDate,requestingMemberID,requestToMemberID,memo,requestedDateMeetTime,requestingMemberReview,requestedMemberReview,requestingMemberRating,requestedMemberRating")] DoubleDateRequest doubleDateRequest, FormCollection fc)
        {
            if (ModelState.IsValid)
            {
                Dictionary <string, bool> places = new Dictionary <string, bool>();
                foreach (var key in fc.AllKeys)
                {
                    if (key.Contains("places"))
                    {
                        string _selected = fc.Get(key);
                        string _name     = key.ToString();
                        bool   _checked;

                        if (_selected == "on")
                        {
                            _checked = true;
                        }
                        else
                        {
                            _checked = false;
                        }
                        places.Add(_name, _checked);
                    }
                }

                DateTime rDate = Convert.ToDateTime(fc.GetValues("requestDate")[0]);
                string[] memo  = fc.GetValues("Memo");

                doubleDateRequest.RequestDate        = rDate;
                doubleDateRequest.RequestingMemberID = config.LoggedInMember.ID;
                doubleDateRequest.RequestToMemberID  = (long)RouteID;

                db.DoubleDateRequest.Add(doubleDateRequest);
                db.SaveChanges();

                if (places != null)
                {
                    foreach (var p in places)
                    {
                        string[] _name = p.Key.ToString().Split('-');

                        bool _checked = p.Value;

                        string gPID = _name[1].ToString();

                        DoubleDateDetails newDDDetail = new DoubleDateDetails();
                        newDDDetail.DoubleDateRequestID = doubleDateRequest.ID;
                        newDDDetail.gPlaceID            = gPID;
                        newDDDetail.DateCreated         = DateTime.Now;
                        //newDDDetail.meetTime = rDate;
                        newDDDetail.Memo = memo[0];

                        db.DoubleDateDetails.Add(newDDDetail);
                        db.SaveChanges();
                    }
                }

                //send email to

                //create message
                Messages message = new Messages();
                message.memberID   = config.LoggedInMember.ID;
                message.toMemberID = (long)RouteID;
                message.subject    = "New Date Request is waiting for you!";
                message.body       = "Click <a href='/DoubleDateRequests/Details/"
                                     + doubleDateRequest.ID
                                     + "'>here</a> to see the Date Request and to Accept or Deny it. ";

                message.dateCreated = DateTime.Now;

                db.Messages.Add(message);
                db.SaveChanges();

                //send email
                string _toEmail    = config.GetEmailAddress((long)RouteID);
                string _fromMember = config.LoggedInMember.ScreenName;

                MailModel mm = new MailModel();
                mm.To      = _toEmail;
                mm.Subject = "You have a Date Request from CouplesDatingScene.com member: " + _fromMember;
                mm.Body    = "</br> Click <a href='www.couplesdatingscene.com'>here</a> to go to site and find your new Date Request in your Mailbox. Click or use this url if the previous one doesn't work https://www.CouplesDatingScene.com";

                string _path = "/content/images/members/profilepics/test.jpg";
                _path = config.LoggedInMember.MemberMedia.FirstOrDefault().path.Replace("~", "");

                SendMailerController.SendEmail(mm, _path);

                //redirect to confirmation page?
                return(RedirectToAction("Details", "Members", new { id = (long)RouteID }));
            }

            ViewBag.requestingMemberID = new SelectList(db.Member, "memberId", "FirstName1", doubleDateRequest.RequestingMemberID);
            ViewBag.requestToMemberID  = new SelectList(db.Member, "memberId", "FirstName1", doubleDateRequest.RequestToMemberID);
            return(View(doubleDateRequest));
        }