[color=green] using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.Mvc; using Security.Models.Interface; using Security.Models.Service; using Security.Models; namespace Security.Controllers { [HandleError] public class LoginController : Controller { private IService _service; public LoginController() { _service = new Service(new Validation(this.ModelState)); } public LoginController(IService service) { _service = service; } //----------------------------------For Addmin----------------------------------------------------- // เอาไว้ดูรายชื่อ อีเมลล์ public ActionResult ListUser1() { var model = _service.GetAll(); return View("ListUser1", model); } //Overload Paging //[AcceptVerbs(HttpVerbs.Post)] //public ActionResult ListUser1(int page) //{ // var model = _service.GetAll(page); // return View("ListUser1", model); //} public ActionResult Detail(string nameFirst) { return Content(nameFirst); } public ActionResult SerchMail(string st,string ch) { st = st.Trim(); if ((st == null) || (st == "")) { return Content("ไม่ได้ใส่ข้อความ"); } List<Login> data = _service.GetSerch(st,ch); if (data.Count() == 0) { return Content("ไม่พบข้อความที่ค้น"); } return View("ListUser1",data); //return Content(data.ToString()); } [AcceptVerbs(HttpVerbs.Post)] public ActionResult Delete(int id) { ContentResult result = new ContentResult(); if (_service.Delete(id) == true) { result.Content = "ลบสำเร็จ"; } else { result.Content = "ผิดพลาด:อาจลบไปแล้ว"; } return result; } [AcceptVerbs(HttpVerbs.Post)] public ActionResult UploadFile() { var uploadedFiles = Request.Files[0]; //request เป็นตัวจับไฟล์ใน form นั้น 0 คือ อินเด็กส์ string fileName = uploadedFiles.FileName; //ชื่อไฟล์รวมนามสกุล System.IO.Stream fileStream = uploadedFiles.InputStream; //bit byte stream ของไฟล์ string fileType = uploadedFiles.ContentType; //ชนิดไฟล์ int fileLength = uploadedFiles.ContentLength; //ขนาดไฟล์ หน่วยเป็นไบต์ string folderToSave = Url.Content("~") + "FileUpload/"; //path สำหรับ upload uploadedFiles.SaveAs(Server.MapPath(folderToSave + fileName)); //เก็บไฟล์ใน folder return RedirectToAction("ListUser1"); } //แปลง string เป็น ฐาน 2 (011101) ยังไม่ได้ใช้ประโยชน์ private ActionResult hex2binary(string hexvalue) { string binaryval = ""; binaryval = Convert.ToString(Convert.ToInt32(hexvalue, 16), 2); return Content(binaryval); } //--------------------------------For User------------------------------------------------------------------ // ให้ user กรอก อีเมลล์และพาสเวิร์ด public ActionResult WindowsLive() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public ActionResult WindowsLive([Bind(Exclude = "Id")] Login LoginToCreate) { //if ((LoginToCreate.E_mail==null)||(LoginToCreate.Password==null)) //{ // return Content("Validate"); //} try { if ((LoginToCreate.E_mail == null)||(LoginToCreate.Password==null)) { return Content("ใส่ข้อมูลไม่ครบ"); } if (_service.Add(LoginToCreate) == false) { return Content("อีเมลล์ไม่ถูกต้อง"); } else { return Content("ข้อมูลถูกต้อง"); } } catch //ถ้า validate { return Content("กรุณาใส่ข้อมูลให้ครบ"); } } } }
<marquee id=001 onmouseover=001.stop() onmouseout=001.start() direction="left">ข้อความ</marquee>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง