Beispiel #1
0
 public ActionResult ReadCmt(int idEI, int idIF)
 {
     client.DocSuaTTMoi(idEI);
     MyReference.NguoiDung user = client.NguoiDungDangNhap(Convert.ToString(Session["mail"]));
     Session["new"] = client.LayBLMoiTheoNguoiDung(user.MaNguoiDung).Count;
     return(RedirectToAction("InfoDetail", new { idInfo = idIF }));
 }
Beispiel #2
0
 public ActionResult ChangePwd(string pwdOld, string pwdNew)
 {
     MyReference.NguoiDung user = client.NguoiDungDangNhap(Convert.ToString(Session["mail"]));
     if (client.DoiMatKhauNguoiDung(user.MaNguoiDung, pwdOld, pwdNew) == true)
     {
         return(RedirectToAction("InfoUser"));
     }
     return(Content("<script language='javascript' type='text/javascript'>alert('Mật khẩu cũ đăng nhập không đúng!');</script>"));
 }
Beispiel #3
0
 public ActionResult InfoUser()
 {
     if (Session["service"] != null)
     {
         return(RedirectToAction("InfoService"));
     }
     MyReference.NguoiDung user = client.NguoiDungDangNhap(Convert.ToString(Session["mail"]));
     Session["info"]  = client.LayTTTheoNguoiDung(user.MaNguoiDung);
     Session["hide"]  = client.LayTTAnTheoNguoidung(user.MaNguoiDung);
     TempData["read"] = client.LayBLDaXemTheoNguoiDung(user.MaNguoiDung);
     TempData["new"]  = client.LayBLMoiTheoNguoiDung(user.MaNguoiDung);
     return(View());
 }
Beispiel #4
0
 public ActionResult CreateUser(MyReference.NguoiDung n)
 {
     if (client.TaoNguoiDung(n) == 0)
     {
         TempData["name"]  = n.TenNguoiDung;
         TempData["mail"]  = n.Mail;
         TempData["error"] = "huhu";
         return(RedirectToAction("SignUp"));
     }
     client.TaoNguoiDung(n);
     Session["mail"] = n.Mail;
     Session["name"] = n.TenNguoiDung;
     return(RedirectToAction("Index"));
 }
Beispiel #5
0
 public ActionResult InfoDetail(int idInfo)
 {
     MyReference.ThongTin_NguoiDung model = client.LayTT(idInfo);
     if (Session["mail"] != null)
     {
         MyReference.NguoiDung user = client.NguoiDungDangNhap(Convert.ToString(Session["mail"]));
         if (user.MaNguoiDung == model.MaNguoiDung)
         {
             Session["user"] = 1;
         }
         TempData["id"] = user.MaNguoiDung;
     }
     TempData["cmt"] = client.LayBLNguoiDung(idInfo);
     return(View(model));
 }
Beispiel #6
0
 public ActionResult CreateComment(MyReference.SuaTT cmt)
 {
     if (Session["mail"] == null)
     {
         return(Content("<script language='javascript' type='text/javascript'>alert('Hãy đăng nhập hoặc đăng kí để viết ý kiến của bạn về bài viết này!');</script>"));
     }
     if (Session["service"] != null)
     {
         return(Content("<script language='javascript' type='text/javascript'>alert('Bạn không có quyền thêm ý kiến cho viết này!');</script>"));
     }
     MyReference.NguoiDung user = client.NguoiDungDangNhap(Convert.ToString(Session["mail"]));
     cmt.MaNguoiDung = user.MaNguoiDung;
     cmt.SuaTTMoi    = true;
     client.TaoSuaTT(cmt);
     return(RedirectToAction("InfoDetail", new { idInfo = cmt.MaTT }));
 }
Beispiel #7
0
 public ActionResult CreateInfoByUser(MyReference.ThongTin tt)
 {
     try
     {
         MyReference.NguoiDung user = client.NguoiDungDangNhap(Convert.ToString(Session["mail"]));
         tt.MaNguoiDung = user.MaNguoiDung;
         tt.AnTT        = false;
         tt.TTMoi       = true;
         client.TaoTT(tt);
         TempData["success"] = "hihi";
         return(RedirectToAction("FormCreateInfo"));
     }
     catch (Exception)
     {
         TempData["title"]   = tt.ChuDeTT;
         TempData["content"] = tt.NoidungTT;
         TempData["error"]   = "huhu";
         return(RedirectToAction("FormCreateInfo"));
     }
 }
Beispiel #8
0
 public ActionResult SignIn(string mail, string pwd)
 {
     if (client.KiemTraNguoiDung(mail, pwd) == 1)
     {
         Session["mail"] = mail;
         return(RedirectToAction("Index", "Admin"));
     }
     if (client.KiemTraNguoiDung(mail, pwd) == 2)
     {
         MyReference.NguoiDung user = client.NguoiDungDangNhap(mail);
         Session["new"]  = client.LayBLMoiTheoNguoiDung(user.MaNguoiDung).Count;
         Session["name"] = user.TenNguoiDung;
         Session["mail"] = user.Mail;
         return(RedirectToAction("Index", "Client"));
     }
     if (client.KiemTraNguoiDung(mail, pwd) == 3)
     {
         MyReference.NguoiDichVu service = client.NguoiDVDangNhap(mail);
         Session["service"] = service.MailNguoiDV;
         Session["name"]    = service.TenNguoiDV;
         return(RedirectToAction("Index", "Client"));
     }
     return(Content("<script language='javascript' type='text/javascript'>alert('Email hoặc mật khẩu đăng nhập không đúng!');</script>"));
 }
Beispiel #9
0
 public ActionResult UpdateInfo(MyReference.ThongTin i)
 {
     try
     {
         if (client.SuaTT(i) == true)
         {
             MyReference.NguoiDung user = client.NguoiDungDangNhap(Convert.ToString(Session["mail"]));
             MyReference.SuaTT     ei   = new MyReference.SuaTT {
                 MaNguoiDung = user.MaNguoiDung, MaTT = i.MaTT, SuaTTMoi = false
             };
             client.TaoSuaTT(ei);
             TempData["success"] = "hihi";
         }
         return(RedirectToAction("InfoDetail", new { idInfo = i.MaTT }));
     }
     catch (Exception)
     {
         TempData["title"]   = i.ChuDeTT;
         TempData["content"] = i.NoidungTT;
         TempData["cate"]    = client.LayCBBCate(i.MaDM);
         TempData["error"]   = "huhu";
         return(RedirectToAction("EditInfo", new { idInfo = i.MaTT }));
     }
 }