Пример #1
0
        public ActionResult ReplyComplaint(long id, replyComplaint rply, FormCollection frm)
        {
            replyComplaint rplyComp = new replyComplaint();

            if (rply.user_complaints_comments != null)
            {

                string comments = rply.user_complaints_comments.Comments;
                long comid = rply.user_complaints_comments.CommentsBy;
                string name = rply.user_complaints_comments.CommentsByName;
                string email = rply.user_complaints.EmailID;

                if (email == null)
                {
                    email = ViewBag.email;
                }
                string isadmin = "N";
                string resolved = "N";

                bool isChecked = false;
                if (Boolean.TryParse(Request.Form.GetValues("resoled")[0], out isChecked) == true)
                {
                    if (isChecked == true)
                    {
                        resolved = "Y";
                    }
                }
                if (Request.Cookies["memsid"] != null && Request.Cookies["memsid"].Value == "14")
                {
                    isadmin = "Y";
                }

                int i = -1;
                i = db.User_Complaints_Comments_Add(id, comments, comid, name, isadmin, System.DateTime.Now, resolved);
                string subject = "NextDhoom Support & Complaints";
                string body = "Dear : " + email + " we got your complaint on NextDhoom.com please Visit Our Sites for Reply <a href='http://www.nextdhoom.com/Home/ReplyComplaint/" + id + "'>Click Here</a>";
                MailMessage mail = new MailMessage();
                //mail.To.Add(_objModelMail.To);
                mail.To.Add(email);
                mail.From = new MailAddress("*****@*****.**");
                mail.Subject = subject;
                string Body = body;
                mail.Body = Body;
                mail.IsBodyHtml = true;
                SmtpClient smtp = new SmtpClient();
                smtp.Host = "mail.nextdhoom.com";
                smtp.Port = 25;
                smtp.UseDefaultCredentials = false;
                smtp.Credentials = new System.Net.NetworkCredential
                ("*****@*****.**", "Amin1234*");// Enter seders User name and password
                //  smtp.EnableSsl = true;




                if (i > 0)
                {
                    ViewBag.Success = true;
                    ViewBag.Message = "Reply Posted Successfully";
                    smtp.Send(mail);
                }
                else
                {
                    ViewBag.Success = false;
                    ViewBag.Message = "Unable to Post";
                }
            }
            rplyComp.user_complaints = db.User_Complaints.Find(id);
            rplyComp.replyComments = db.User_Complaints_Comments.Where(c => c.ComplaintsID == id).ToList();
            return View(rplyComp);


        }
Пример #2
0
        public ActionResult ReplyComplaint(long id, int? i)
        {
            replyComplaint rplyComp = new replyComplaint();

            rplyComp.user_complaints = db.User_Complaints.Find(id);

            long memid = 0;
            ViewBag.mem = false;

            if (Request.Cookies["memsid"] != null)
            {
                if (Request.Cookies["memsid"].Value == "14")
                {
                    memid = Convert.ToInt64(Request.Cookies["memsid"].Value);
                }
                else
                {
                    long mid = Convert.ToInt64(Request.Cookies["memsid"].Value);

                    long mem = (from c in db.User_Complaints
                                join m in db.Mems on c.EmailID equals m.email
                                where c.ComplaintID == id
                                select m.memsid).FirstOrDefault();

                    if (mem == mid)
                    {
                        memid = mid;
                    }
                }
                if (memid > 0)
                {
                    rplyComp.user_complaints_comments = new User_Complaints_Comments
                    {
                        CommentsBy = memid,
                        CommentsByName = Request.Cookies["fname"].Value,
                        Comments = "",
                    };
                    ViewBag.mem = true;
                }
                else
                {
                    ViewBag.mem = false;
                }

            }

            if (i > 0)
            {
                ViewBag.success = true;
                ViewBag.Message = "Reply Is Deleted";
            }
            else if (i == -1)
            {
                ViewBag.success = false;
                ViewBag.Message = "Unable to Deleted";
            }
            rplyComp.replyComments = db.User_Complaints_Comments.Where(c => c.ComplaintsID == id)
                                       .OrderByDescending(c => c.CommentsDate).ToList();
            return View(rplyComp);
        }