// add favorite public ActionResult AddPlaylist(int?id, int?album_id) { if (function.CookieID() == null) { return(new HttpNotFoundResult()); } if (ModelState.IsValid) { var cookie = function.CookieID(); if (album_id == null) { var album = from al in db.Albums where al.user_id == cookie.user_id && al.album_name == "Yêu thích" select al.album_id; if (album == null) { albumsDAO.Add(new Album() { album_name = "Yêu thích", album_img = "", user_id = cookie.user_id }); } album_id = (from al in db.Albums where al.user_id == cookie.user_id && al.album_name == "Yêu thích" select al.album_id).First(); } PlayList playList = new PlayList(); playList.albums_id = album_id; playList.music_id = id; playListDAO.Add(playList); return(Redirect("/")); } return(View()); }
public ActionResult AddAlbum(Album album, HttpPostedFileBase img) { var cookie = function.CookieID(); if (ModelState.IsValid) { album.user_id = cookie.user_id; album.album_img = filesfunction.AddImages(img, "Album", Guid.NewGuid().ToString()); albumsDAO.Add(album); return(Redirect("/Albums/MyAlbums#")); } return(Redirect("/Albums/MyAlbums#")); }
//Bình luận public JsonResult Comment(string content, int?id) { var coo = new FunctionController(); var idus = coo.CookieID(); Comment comment = new Comment { music_id = id, comment_content = content, comment_datecreate = DateTime.Now, user_id = idus.user_id }; db.Comments.Add(comment); db.SaveChanges(); var list = from item in db.Comments where item.music_id == id orderby item.comment_dateupdate descending select new { id = item.comment_id, idcode = item.music_id, idus = item.user_id, date = item.comment_datecreate, update = item.comment_dateupdate, content = item.comment_content, nameid = item.User.user_name, imgid = item.User.user_img }; return(Json(list, JsonRequestBehavior.AllowGet)); }
public ActionResult EditAll(string phone, Nullable <bool> sex, string fa) { var cookie = new FunctionController(); var idus = cookie.CookieID(); User user = db.Users.Find(idus.user_id); if (phone != null) { user.user_phone = phone; } if (sex != null) { user.user_sex = sex; } if (fa != null) { user.user_favourite = fa; } db.SaveChanges(); return(Redirect("/Users/MyInfo?id=" + idus.user_id)); }
public JsonResult EditItem(string fakeid, int?id, string name, string mid, string content, string to, string end) { var cookie = new FunctionController(); var idus = cookie.CookieID(); ItemCv check = db.ItemCvs.SingleOrDefault(n => n.ic_fake == fakeid && n.ic_id == id && n.ic_usid == idus.user_id); check.ic_name = name; check.ic_mid = mid; check.ic_content = content; check.ic_todate = to; check.ic_enddate = end; db.SaveChanges(); List <ItemCv> itemCvs = db.ItemCvs.Where(n => n.ic_fake == fakeid && n.ic_usid == idus.user_id).ToList(); var list = db.ItemCvs.Where(n => n.ic_fake == fakeid && n.ic_usid == idus.user_id).Select(n => new { content = n.ic_content, enddate = n.ic_enddate, fake = n.ic_fake, id = n.ic_id, idtheme = (int)n.ic_theme_id, mid = n.ic_mid, name = n.ic_name, stt = (int)n.ic_stt, todate = n.ic_todate, usid = (int)n.ic_usid }).ToList(); return(Json(list, JsonRequestBehavior.AllowGet)); }
public ActionResult PayMoMo(int?id) { var coo = new FunctionController(); var idus = coo.CookieID(); Package pakage = db.Packages.Find(id); //request params need to request to MoMo system string endpoint = "https://test-payment.momo.vn/gw_payment/transactionProcessor"; string partnerCode = "MOMO5RGX20191128"; string accessKey = "M8brj9K6E22vXoDB"; string serectkey = "nqQiVSgDMy809JoPF6OzP5OdBUB550Y4"; string orderInfo = "Nâng cấp vip " + pakage.package_name + " cho tài khoản " + idus.user_email; string returnUrl = "https://localhost:44325/Pays/ReturnUrl"; string notifyurl = "https://localhost:44325/Pays/NotifyUrl"; string amount = pakage.pakage_price.ToString(); string orderid = Guid.NewGuid().ToString(); string requestId = Guid.NewGuid().ToString(); string extraData = ""; //Before sign HMAC SHA256 signature string rawHash = "partnerCode=" + partnerCode + "&accessKey=" + accessKey + "&requestId=" + requestId + "&amount=" + amount + "&orderId=" + orderid + "&orderInfo=" + orderInfo + "&returnUrl=" + returnUrl + "¬ifyUrl=" + notifyurl + "&extraData=" + extraData; MoMoSecurity crypto = new MoMoSecurity(); string signature = crypto.signSHA256(rawHash, serectkey); //build body json request JObject message = new JObject { { "partnerCode", partnerCode }, { "accessKey", accessKey }, { "requestId", requestId }, { "amount", amount }, { "orderId", orderid }, { "orderInfo", orderInfo }, { "returnUrl", returnUrl }, { "notifyUrl", notifyurl }, { "extraData", extraData }, { "requestType", "captureMoMoWallet" }, { "signature", signature } }; string responseFromMomo = PaymentRequest.sendPaymentRequest(endpoint, message.ToString()); JObject jmessage = JObject.Parse(responseFromMomo); Session["idpake"] = id; return(Redirect(jmessage.GetValue("payUrl").ToString())); }
public JsonResult GetViewCvEmployer() { var cookie = new FunctionController(); var idus = cookie.CookieID(); using (var connection = new SqlConnection(ConfigurationManager.ConnectionStrings["DataQuickJob"].ConnectionString)) { connection.Open(); using (SqlCommand command = new SqlCommand(@"SELECT [sb_id] ,[user_id] ,[job_id] ,[sb_datecreate] ,[sb_active] ,[sb_notecandidate] ,[sb_noteemployer] ,[sb_update] ,[cv_id] FROM [dbo].[SubmitCv]", connection)) { // Make sure the command object does not already have // a notification object associated with it. command.Notification = null; SqlDependency dependency = new SqlDependency(command); dependency.OnChange += new OnChangeEventHandler(show_ViewCvEmployer); if (connection.State == ConnectionState.Closed) { connection.Open(); } SqlDataReader reader = command.ExecuteReader(); var list = db.SubmitCvs.Where(n => n.user_id == idus.user_id).OrderByDescending(n => n.sb_update).Select(n => new { id = n.sb_id, idus = n.user_id, idjob = n.job_id, namejob = n.Job.job_title, logo = n.Job.User.employer_logo, company = n.Job.User.employer_company, textprice = n.Job.job_textprice, end = n.Job.job_payend, start = n.Job.job_paystart, datecreate = n.sb_datecreate.ToString(), update = n.sb_update.ToString(), notecandidate = n.sb_notecandidate, noteemployer = n.sb_noteemployer, idcv = n.cv_id, fullnamecv = n.Cv.cv_fullname, locationcv = n.Cv.cv_location, active = n.sb_active == 2 ? "Đã xem" : n.sb_active == 3 ? "Từ chối" : n.sb_active == 4 ? "Chấp nhận" : "Chưa xem", color = n.sb_active == 2 ? "table-primary" : n.sb_active == 3 ? "table-danger" : n.sb_active == 4 ? "table-success" : "table-dark", link = n.sb_active == 2 ? "Đã xem" : n.sb_active == 3 ? "<a href='/View/DetailsViewCvEmployer?id=" + n.sb_id + "' class='text-danger'><i class='fa fa-eye'> </i>Phản hồi</a>" : n.sb_active == 4 ? "<a class='text-danger' href='/View/DetailsViewCvEmployer?id=" + n.sb_id + "'><i class='fa fa-eye text-danger'> </i>Liên hệ</a>" : "Chưa xem" }).ToList(); return(Json(new { list = list }, JsonRequestBehavior.AllowGet)); } } }
public ActionResult HistoryPay() { var coo = new FunctionController(); var id = coo.CookieID(); Session["pakeid"] = null; return(View(db.Bills.Where(n => n.user_id == id.user_id).OrderByDescending(n => n.bill_datecreate).ToList())); }
public ActionResult MyInfo(int?id) { var fu = new FunctionController(); if (id != fu.CookieID().user_id) { return(Redirect("/")); } return(View(db.Users.Find(id))); }
//Danh sách yêu thích theo người dùng public JsonResult JsonFavourite(int?idmusic) { var cookie = new FunctionController(); var idus = cookie.CookieID(); var music = db.Groups.Where(n => n.group_item == 5 && n.user_id == idus.user_id && n.music_id == idmusic).OrderByDescending(n => n.group_datecreate).Select(n => new { id = n.group_id }).ToList(); return(Json(music, JsonRequestBehavior.AllowGet)); }
public ActionResult Details(int?id) { var coo = new FunctionController(); var idus = coo.CookieID(); if (idus.version_id == 2) { Response.Redirect("/Pays/IndexPakage"); } return(View(db.Pakages.Find(id))); }
//Danh sách yêu thích theo công việc public JsonResult IndexFavourite(int?id) { var cookie = new FunctionController(); var idus = cookie.CookieID(); var list = db.Groups.Where(n => n.group_item == Common.Common.GROUP_JOB_USERS && n.user_id == idus.user_id && n.job_id == id).Select(n => new { id = n.group_id }).ToList(); return(Json(list, JsonRequestBehavior.AllowGet)); }
//Danh sách theo theo trang cá nhân nhà tuyển dụng public JsonResult JsonIndexFollow(int?id) { var cookie = new FunctionController(); var idus = cookie.CookieID(); var list = db.Groups.Where(n => n.group_item == Common.Common.GROUP_EMPLOYER_CANDIDATE && n.user_id == idus.user_id && n.em_id == id).OrderByDescending(n => n.datecreate).Select(n => new { id = n.group_id }).ToList(); return(Json(list, JsonRequestBehavior.AllowGet)); }
//------------------- candidate public JsonResult GetCandidate(int?idem) { var cookie = new FunctionController(); var idus = cookie.CookieID(); var em = db.Users.Find(idem); var key = idus.user_id + "key" + em.user_id + idus.user_email.Substring(1, 5) + "key" + em.user_email.Substring(1, 5); var key2 = em.user_id + "key" + idus.user_id + em.user_email.Substring(1, 5) + "key" + idus.user_email.Substring(1, 5); using (var connection = new SqlConnection(ConfigurationManager.ConnectionStrings["DataQuickJob"].ConnectionString)) { connection.Open(); using (SqlCommand command = new SqlCommand(@"SELECT [chat_id] ,[chat_sender] ,[chat_receiver] ,[chat_content] ,[chat_datecreate] ,[chat_color] ,[chat_key] ,[chat_active] FROM [dbo].[Chats]", connection)) { // Make sure the command object does not already have // a notification object associated with it. command.Notification = null; SqlDependency dependency = new SqlDependency(command); dependency.OnChange += new OnChangeEventHandler(show_chatcandidate); if (connection.State == ConnectionState.Closed) { connection.Open(); } SqlDataReader reader = command.ExecuteReader(); var list = db.Chats.Where(n => n.chat_key == key || n.chat_key == key2).OrderByDescending(n => n.chat_datecreate).Select(n => new { id = n.chat_id, send = n.chat_sender, rec = n.chat_receiver, content = n.chat_content, date = n.chat_datecreate.ToString(), chatkey = n.chat_key }).ToList(); return(Json(new { list = list }, JsonRequestBehavior.AllowGet)); } } }
public JsonResult JsonIndexFavourite() { var cookie = new FunctionController(); var idus = cookie.CookieID(); var fa = db.Groups.Where(n => n.group_item == 5 && n.user_id == idus.user_id).OrderByDescending(n => n.group_datecreate).Select(n => new { id = n.group_id, idmusic = n.music_id, title = n.Music.music_name, img = n.Music.music_img }).ToList(); return(Json(fa, JsonRequestBehavior.AllowGet)); }
public ActionResult Rating(Rating rating) { var cookie = new FunctionController(); var idus = cookie.CookieID(); rating.rating_datecreate = DateTime.Now; rating.user_id = idus.user_id; db.Ratings.Add(rating); db.SaveChanges(); return(Redirect(Request.UrlReferrer.ToString())); }
public ActionResult EditBirth(DateTime birth) { var cookie = new FunctionController(); var idus = cookie.CookieID(); User user = db.Users.Find(idus.user_id); if (birth != null) { user.user_birth = birth; } db.SaveChanges(); return(Redirect("/Users/MyInfo?id=" + idus.user_id)); }
//Hủy yêu thích telex public ActionResult CancelFavouriteDetails(int?id) { var cookie = new FunctionController(); var idus = cookie.CookieID(); Group group = db.Groups.Find(id); var idjob = group.job_id; db.Groups.Remove(group); db.SaveChanges(); return(Redirect("/View/DetailsJob?id=" + idjob)); }
//Hủy thheo dõi telex public ActionResult CancelFollowDetails(int?id) { var cookie = new FunctionController(); var idus = cookie.CookieID(); Group group = db.Groups.Find(id); var emid = group.em_id; db.Groups.Remove(group); db.SaveChanges(); return(Redirect("/View/DetailsEmployer?id=" + emid)); }
public JsonResult GetAttentionEmployer() { var cookie = new FunctionController(); var idus = cookie.CookieID(); using (var connection = new SqlConnection(ConfigurationManager.ConnectionStrings["DataQuickJob"].ConnectionString)) { connection.Open(); using (SqlCommand command = new SqlCommand(@"SELECT [view_id] ,[view_view] ,[cv_id] ,[user_id] ,[view_dateupdate] FROM [dbo].[ViewCvs]", connection)) { // Make sure the command object does not already have // a notification object associated with it. command.Notification = null; SqlDependency dependency = new SqlDependency(command); dependency.OnChange += new OnChangeEventHandler(showAttentionEmployer); if (connection.State == ConnectionState.Closed) { connection.Open(); } SqlDataReader reader = command.ExecuteReader(); var list = db.SubmitJobs.Where(n => n.Cv.user_id == idus.user_id).OrderByDescending(n => n.sj_datecreate).Select(n => new { company = n.Job.User.employer_company, title = n.Job.job_title, textpeice = n.Job.job_textprice, payend = n.Job.job_payend, paystart = n.Job.job_paystart, fullname = n.Cv.cv_fullname, location = n.Cv.cv_location, id = n.sj_id, logo = n.Job.User.employer_logo }).ToList(); return(Json(new { list = list }, JsonRequestBehavior.AllowGet)); } } }
public ActionResult SubmitCv(SubmitCv submitCv, int?id) { var cookie = new FunctionController(); var idus = cookie.CookieID(); submitCv.sb_datecreate = DateTime.Now; submitCv.sb_update = DateTime.Now; submitCv.user_id = idus.user_id; submitCv.job_id = id; submitCv.sb_active = 1; db.SubmitCvs.Add(submitCv); db.SaveChanges(); return(Redirect("/View/ViewCvEmployer")); }
//Hủy lưu public JsonResult CancelFavourite(int?id) { var cookie = new FunctionController(); var idus = cookie.CookieID(); Group group = db.Groups.Find(id); var idmusic = group.music_id; db.Groups.Remove(group); db.SaveChanges(); var fa = db.Groups.Where(n => n.group_item == 5 && n.user_id == idus.user_id && n.music_id == idmusic).OrderByDescending(n => n.group_datecreate).Select(n => new { id = n.group_id }).ToList(); return(Json(fa, JsonRequestBehavior.AllowGet)); }
public ActionResult Create([Bind(Include = "news_id,news_title,news_contents,news_image,cate_id,news_tags,news_genres,news_datecreate,news_dateupdate,news_active,news_option,news_bin,user_id,news_view")] News news) { var coo = new FunctionController(); news.cate_id = 1; news.news_datecreate = DateTime.Now; news.news_dateupdate = DateTime.Now; news.news_active = true; news.news_option = true; news.news_bin = false; news.news_view = 1; news.user_id = coo.CookieID().user_id; db.News.Add(news); db.SaveChanges(); ViewBag.user_id = new SelectList(db.Users, "user_id", "user_email", news.user_id); return(RedirectToAction("Index")); }
//---------------------------Thông báo public JsonResult RMess() { var cookie = new FunctionController(); var idus = cookie.CookieID(); using (var connection = new SqlConnection(ConfigurationManager.ConnectionStrings["DataQuickJob"].ConnectionString)) { connection.Open(); using (SqlCommand command = new SqlCommand(@"SELECT [chat_id] ,[chat_sender] ,[chat_receiver] ,[chat_content] ,[chat_datecreate] ,[chat_color] ,[chat_key] FROM [dbo].[Chats]", connection)) { // Make sure the command object does not already have // a notification object associated with it. command.Notification = null; SqlDependency dependency = new SqlDependency(command); dependency.OnChange += new OnChangeEventHandler(showMessenger); if (connection.State == ConnectionState.Closed) { connection.Open(); } SqlDataReader reader = command.ExecuteReader(); var list = db.Chats.Where(n => n.chat_active == false).OrderByDescending(n => n.chat_datecreate).Select(n => new { id = n.chat_id, sender = n.chat_sender, receiver = n.chat_receiver, content = n.chat_content }).ToList(); return(Json(new { list = list }, JsonRequestBehavior.AllowGet)); } } }
public ActionResult JsonIndexFollowAll() { var cookie = new FunctionController(); var idus = cookie.CookieID(); db.Configuration.ProxyCreationEnabled = false; var list = db.Groups.Where(n => n.group_item == Common.Common.GROUP_EMPLOYER_CANDIDATE && n.user_id == idus.user_id).OrderByDescending(n => n.datecreate).Select(n => new { id = n.group_id, emid = n.em_id, logo = db.Users.FirstOrDefault(t => t.user_id == n.em_id).employer_logo, company = db.Users.FirstOrDefault(t => t.user_id == n.em_id).employer_company, addpress = db.Users.FirstOrDefault(t => t.user_id == n.em_id).employer_addpress, date = n.datecreate.Value.ToString() }).ToList(); return(Json(list, JsonRequestBehavior.AllowGet)); }
public ActionResult LoginAdmin(ViewLogin login) { if (function.CookieID() != null) { return(Redirect("/")); } if (ModelState.IsValid) { int status = usersDAO.Login(login.Email, login.Password); switch (status) { case 1: var user = db.Users.FirstOrDefault(t => t.user_email == login.Email); HttpCookie cookie = new HttpCookie("Admin", user.user_id.ToString()); cookie.Expires.AddDays(10); Response.Cookies.Set(cookie); return(Redirect("/Admin/HomeAdmin/Index")); if (user.role_id != 2) { return(Redirect("/Home/Index")); } case -1: TempData["noti_login"] = "******"; break; case -2: TempData["noti_login"] = "******"; break; case -3: TempData["noti_login"] = "******"; break; default: TempData["noti_login"] = "******"; break; } } return(View(login)); }
public JsonResult Create(string fakeid, int?id, int stt) { var cookie = new FunctionController(); var idus = cookie.CookieID(); ItemCv check = db.ItemCvs.SingleOrDefault(n => n.ic_fake == fakeid && n.ic_usid == idus.user_id && n.ic_id == id); ItemCv itemCv1 = new ItemCv { ic_name = check.ic_name, ic_content = check.ic_content, ic_mid = check.ic_mid, ic_fake = fakeid, ic_theme_id = check.ic_theme_id, ic_enddate = check.ic_enddate, ic_todate = check.ic_todate, ic_stt = stt, ic_usid = idus.user_id }; db.ItemCvs.Add(itemCv1); db.SaveChanges(); var list = db.ItemCvs.Where(n => n.ic_fake == fakeid && n.ic_usid == idus.user_id).Select(n => new { content = n.ic_content, enddate = n.ic_enddate, fake = n.ic_fake, id = n.ic_id, idtheme = (int)n.ic_theme_id, mid = n.ic_mid, name = n.ic_name, stt = (int)n.ic_stt, todate = n.ic_todate, usid = (int)n.ic_usid }).ToList(); return(Json(list, JsonRequestBehavior.AllowGet)); }
public JsonResult JsonIndexCvs() { var coo = new FunctionController(); var id = coo.CookieID(); var list = db.Cvs.Where(n => n.cv_bin == false && n.user_id == id.user_id).OrderByDescending(n => n.cv_datecreate).Select(n => new { id = n.cv_id, img = n.cv_img, option = n.cv_option, datecreate = n.cv_datecreate.ToString(), dateupdate = n.cv_dateupdate.ToString(), fakeid = n.cv_fakeid, title = n.cv_title, themeid = (int)n.theme_id, point = n.cv_point, key = n.cv_fakeid.Substring(0, 6), pass = n.cv_pass }).ToList(); return(Json(list, JsonRequestBehavior.AllowGet)); }
//In danh sách item của cv public JsonResult Item(string fakeid) { var cookie = new FunctionController(); var idus = cookie.CookieID(); var list = db.ItemCvs.Where(n => n.ic_fake == fakeid && n.ic_usid == idus.user_id).Select(n => new { content = n.ic_content, enddate = n.ic_enddate, fake = n.ic_fake, id = n.ic_id, idtheme = (int)n.ic_theme_id, mid = n.ic_mid, name = n.ic_name, stt = (int)n.ic_stt, todate = n.ic_todate, usid = (int)n.ic_usid }).ToList(); return(Json(list, JsonRequestBehavior.AllowGet)); }
public JsonResult JsonHistoryPay() { var coo = new FunctionController(); var id = coo.CookieID(); var list = db.Bills.Where(n => n.user_id == id.user_id).OrderByDescending(n => n.bill_datecreate).Select(n => new { id = n.bill_id, datecreate = n.bill_datecreate.ToString(), idus = n.user_id, sum = n.bill_sum, active = n.bill_active, deadline = n.bill_dealine.ToString(), idpake = n.pakege_id, key = n.bill_key, name = "Nâng cấp tài khoản lên " + n.Pakage.pakage_name, orderid = n.bill_orderid }).ToList(); return(Json(list, JsonRequestBehavior.AllowGet)); }