public JsonResult Contact(string MyChecked)
 {
     Contact n = new Contact();
     ContactData nd = new ContactData();
     var array = MyChecked.Split(',');
     if (MyChecked != "" && MyChecked != null)
     {
         for (var i = 0; i < array.Length; i++)
         {
             //var Original = nd.Get().ToList().Where(a => a.num.ToString() == array[i]).SingleOrDefault();
             //var DelPath = System.IO.Path.Combine(Server.MapPath("~/upload/News/"), Original.pic1);
             //System.IO.File.Delete(DelPath);
             //if (Original.jsonimg != "no_img.jpg")
             //{
             //    var jsonstr = JsonConvert.DeserializeObject<List<jsonSer>>(Original.jsonimg);
             //    var DelJsonPath = Server.MapPath("~/upload/photograhy/");
             //    foreach (var j in jsonstr)
             //    {
             //        var DelJsonPathing = System.IO.Path.Combine(DelJsonPath, j.content);
             //        System.IO.File.Delete(DelJsonPathing);
             //    }
             //}
             n.isdel = 1;
             n.udate = DateTime.Now;
             n.num = Convert.ToInt32(array[i]);
             nd.Delete(n);
         }
     }
     return Json("");
 }
Пример #2
0
 public JsonResult Contact(string MyChecked)
 {
     Contact ct = new Contact();
     ContactData ctd = new ContactData();
     var array = MyChecked.Split(',');
     if (MyChecked != "" && MyChecked != null)
     {
         for (var i = 0; i < array.Length; i++)
         {
             //var Original = dred.Get().ToList().Where(a => a.num.ToString() == array[i]).SingleOrDefault();
             ////var DelPath = System.IO.Path.Combine(Server.MapPath("~/upload/dressdesign/"), Original.img);
             ////System.IO.File.Delete(DelPath);
             //if (Original.jsonimg != "no_img.jpg")
             //{
             //    var jsonstr = JsonConvert.DeserializeObject<List<jsonSer>>(Original.jsonimg);
             //    var DelJsonPath = Server.MapPath("~/upload/dressdesign/");
             //    foreach (var j in jsonstr)
             //    {
             //        var DelJsonPathing = System.IO.Path.Combine(DelJsonPath, j.content);
             //        System.IO.File.Delete(DelJsonPathing);
             //    }
             //}
             ct.num = Convert.ToInt32(array[i]);
             ctd.Delete(ct);
         }
     }
     return Json("");
 }
        public ActionResult SendToForm(Contact contact, string[] ckcheck,string code)
        {
            //Dictionary<string, object> dic = new Dictionary<string, object>();
            if (Session["contactcode"].ToString() == code)
            {
            if (ckcheck != null && ckcheck.Length > 0)
            {
                for (var i = 0; i < ckcheck.Length; i++)
                {
                    con.ckcheck += ckcheck[i].ToString() + ",";
                }
            }
            contact.ckcheck = con.ckcheck.Substring(0, con.ckcheck.Length - 1);
            contact.wdate = DateTime.Now;
            contact.udate = DateTime.Now;
            cond.Create(contact);

            var strsplit = con.ckcheck.Split(',');
            var strResult = "";
            if (strsplit.Length > 0 && strsplit != null)
            {
                for (var j = 0; j < strsplit.Length; j++)
                {
                    strResult += GetQA(strsplit[j].ToString()) + ",";
                }

            }
            var result = "<table border='1' cellspacing='1' cellpadding='1'>";
            result += "<tbody>";

            result += "<tr>";
            result += "<th>姓名</th>";
            result += "<td>" + contact.uName + "</td>";
            result += "</tr>";

            result += "<tr>";
            result += "<th>電話</th>";
            result += "<td>" + contact.uPhone + "</td>";
            result += "</tr>";

            result += "<tr>";
            result += "<th>Email</th>";
            result += "<td>" + contact.uEmail + "</td>";
            result += "</tr>";

            result += "<tr>";
            result += "<th>地址</th>";
            result += "<td>" + contact.uAddress + "</td>";
            result += "</tr>";

            result += "<tr>";
            result += "<th>問題類別</th>";
            result += "<td>" + strResult.Substring(0, strResult.Length - 1) + "</td>";
            result += "</tr>";

            result += "<tr>";
            result += "<th>訊息</th>";
            result += "<td>" + contact.uMsg + "</td>";
            result += "</tr>";

            result += "</tbody>";
            result += "</table><br>";

            SendMailToEveryOne.SendMail("*****@*****.**", contact.uEmail, "NOPORVis ContactUs Form", "NOPORVis ContactUs Form", result, false);

            //dic.Add("success", true);
            //dic.Add("msg", "已寄出");
            }
            else
            {
                TempData["contact_error"] = "驗證碼錯誤";
                return RedirectToAction("Index");
            }

            TempData["contact_msg"] = "已寄出";

            return RedirectToAction("Index");
        }