public JsonResult Json() { var fu = new FunctionController(); var id = fu.CookieIDEm(); var list = db.Jobs.Where(n => n.user_id == id.user_id && n.job_bin == false).OrderByDescending(n => n.job_dateupdate).Select(n => new { id = n.job_id, title = n.job_title, provice = n.Groups.Where(t => t.group_item == Common.Common.GROUP_JOB_PROVICE).Select(t => t.Provice.provice_name), amout = n.job_amout, category = n.Groups.Where(t => t.group_item == Common.Common.GROUP_JOB_CATEGORY).Select(t => t.Category.cate_name), type = n.TypeJob.type_name, workplace = n.WorkPlace.wp_name, sex = n.job_sex, exp = n.Exp.exp_name, active = n.job_active, option = n.job_option, bin = n.job_bin, datecreate = n.job_datecreate.ToString(), deadline = n.job_datedeline.ToString(), update = n.job_dateupdate.ToString() }).ToList(); return(Json(list, JsonRequestBehavior.AllowGet)); }
public ActionResult DetailsCvs(int?id) { var fu = new FunctionController(); var idus = fu.CookieIDEm(); List <ViewCv> viewCv = db.ViewCvs.Where(n => n.user_id == idus.user_id && n.cv_id == id).ToList(); if (viewCv.Count == 0) { ViewCv view = new ViewCv { user_id = idus.user_id, cv_id = id, view_dateupdate = DateTime.Now, view_view = 1, }; db.ViewCvs.Add(view); db.SaveChanges(); } else { var idview = db.ViewCvs.SingleOrDefault(n => n.user_id == idus.user_id && n.cv_id == id); idview.view_view = idview.view_view + 1; db.SaveChanges(); } return(View(db.Cvs.Find(id))); }
// GET: Employer/JobsEmployer public ActionResult Index() { var fu = new FunctionController(); var id = fu.CookieIDEm(); var jobs = db.Jobs.Include(j => j.Exp).Include(j => j.TypeJob).Include(j => j.WorkPlace).Include(j => j.User); return(View(jobs.ToList())); }
public JsonResult GetViewCvEmployer() { var cookie = new FunctionController(); var idus = cookie.CookieIDEm(); 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_ViewCvCandidate); if (connection.State == ConnectionState.Closed) { connection.Open(); } SqlDataReader reader = command.ExecuteReader(); var list = db.SubmitCvs.Where(n => n.Job.User.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 ? "text-primary" : n.sb_active == 3 ? "text-danger" : n.sb_active == 4 ? "text-success" : "text-dark", imgcv = n.Cv.cv_img }).ToList(); return(Json(new { list = list }, JsonRequestBehavior.AllowGet)); } } }
public ActionResult HistoryPay() { var coo = new FunctionController(); var id = coo.CookieIDEm(); Session["pakeid"] = null; return(View(db.Bills.Where(n => n.user_id == id.user_id).OrderByDescending(n => n.bill_datecreate).ToList())); }
public JsonResult GetChat(int?idreceiver, int?idcv) { var cookie = new FunctionController(); var idus = cookie.CookieIDEm(); var receiver = db.Users.Find(idreceiver); var cv = db.Cvs.Find(idcv); var key = idus.user_id + "key" + receiver.user_id + idus.user_email.Substring(1, 5) + "key" + receiver.user_email.Substring(1, 5); var key2 = receiver.user_id + "key" + idus.user_id + receiver.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] 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(dependency_OnChange); 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, sender = n.chat_sender, receiver = n.chat_receiver, content = n.chat_content, datecreate = n.chat_datecreate.ToString(), color = n.chat_receiver != idus.user_id ? "media-chat-reverse" : "", key = n.chat_key, name = n.chat_receiver != idus.user_id ? "Tôi" : "Ứng viên", img = n.chat_receiver != idus.user_id ? "Employers/" + idus.employer_logo : "Cvs/" + cv.cv_img, active = n.chat_active == true ? "Đã xem" : "Chưa xem" }).ToList(); return(Json(new { list = list }, JsonRequestBehavior.AllowGet)); } } }
//---------------------------------------------- public JsonResult GetEmployer(int?idcan) { var cookie = new FunctionController(); var idus = cookie.CookieIDEm(); var em = db.Users.Find(idcan); 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_chatemployer); 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 ActionResult SubmitJob(SubmitJob submitJob, int?id) { var cookie = new FunctionController(); var idus = cookie.CookieIDEm(); submitJob.user_id = idus.user_id; submitJob.sj_datecreate = DateTime.Now; submitJob.cv_id = id; db.SubmitJobs.Add(submitJob); db.SaveChanges(); return(Redirect("/Employer/CvsEmployer/DetailsCvs?id=" + id)); }
// GET: Employer/JobsEmployer/Create public ActionResult Create() { var fu = new FunctionController(); var id = fu.CookieIDEm(); List <Job> job = db.Jobs.Where(n => n.user_id == id.user_id).ToList(); if (id.employer_pageload == null) { return(Redirect("/Employer/UsersEmployer/PersonalPage")); } if (id.employer_amoutjob - job.Count == 0) { return(Redirect("/Employer/PayEmployer/Index")); } ViewBag.exp_id = new SelectList(db.Exps, "exp_id", "exp_name"); ViewBag.type_id = new SelectList(db.TypeJobs, "type_id", "type_name"); ViewBag.wp_id = new SelectList(db.WorkPlaces, "wp_id", "wp_name"); ViewBag.user_id = new SelectList(db.Users, "user_id", "user_email"); return(View()); }
public JsonResult ChatEmployer(string content, int?idcan) { var cookie = new FunctionController(); var idus = cookie.CookieIDEm(); var em = db.Users.Find(idcan); var key = idus.user_id + "key" + em.user_id + idus.user_email.Substring(1, 5) + "key" + em.user_email.Substring(1, 5); Chat chat = new Chat() { chat_content = content, chat_datecreate = DateTime.Now, chat_key = key, chat_receiver = idcan, chat_sender = idus.user_id, chat_active = false }; db.Chats.Add(chat); db.SaveChanges(); return(Json(null)); }
public ActionResult CreateAD([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, HttpPostedFileBase img) { var coo = new FunctionController(); var code = Guid.NewGuid().ToString(); var addi = coo.AddImages(img, Common.Common.LINK_NEW, code); news.news_image = addi; news.cate_id = 2; news.news_datecreate = DateTime.Now; news.news_dateupdate = DateTime.Now; news.news_active = false; news.news_option = true; news.news_bin = false; news.news_view = 1; news.user_id = coo.CookieIDEm().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")); }
public ActionResult Create([Bind(Include = "job_id,job_title,job_addpress,job_amout,wp_id,type_id,job_sex,exp_id,job_payend,job_paystart,job_datedeline,job_name,job_phone,job_describe,job_request,job_right,job_active,job_option,job_datecreate,job_dateupdate,job_bin,job_view,user_id,job_textprice")] Job job, int[] cate, int[] provice) { var fu = new FunctionController(); var code = Guid.NewGuid().ToString(); if (ModelState.IsValid) { job.job_key = code; job.job_active = false; job.job_option = true; job.job_bin = false; job.job_datecreate = DateTime.Now; job.job_dateupdate = DateTime.Now; job.job_view = 0; job.user_id = fu.CookieIDEm().user_id; if (job.job_textprice == "Từ") { job.job_payend = "0"; } else if (job.job_textprice == "Lên đến") { job.job_payend = "0"; } else if (job.job_textprice == "Trong khoảng") { } else { job.job_payend = "0"; job.job_paystart = "0"; } if (job.job_amout == null) { job.job_amout = 0; } db.Jobs.Add(job); db.SaveChanges(); Job check = db.Jobs.SingleOrDefault(n => n.job_key == code); //Cate foreach (var item in cate) { Group group = new Group { datecreate = DateTime.Now, job_id = check.job_id, category_id = item, group_item = Common.Common.GROUP_JOB_CATEGORY }; db.Groups.Add(group); db.SaveChanges(); } //Provice foreach (var item in provice) { Group group = new Group { datecreate = DateTime.Now, job_id = check.job_id, provice_id = item, group_item = Common.Common.GROUP_JOB_PROVICE }; db.Groups.Add(group); db.SaveChanges(); } return(RedirectToAction("Index")); } ViewBag.exp_id = new SelectList(db.Exps, "exp_id", "exp_name", job.exp_id); ViewBag.type_id = new SelectList(db.TypeJobs, "type_id", "type_name", job.type_id); ViewBag.wp_id = new SelectList(db.WorkPlaces, "wp_id", "wp_name", job.wp_id); ViewBag.user_id = new SelectList(db.Users, "user_id", "user_email", job.user_id); return(View(job)); }
public ActionResult PersonalPage(User user, HttpPostedFileBase logo, HttpPostedFileBase banner) { var code1 = Guid.NewGuid().ToString(); var code2 = Guid.NewGuid().ToString(); var fu = new FunctionController(); var id = fu.CookieIDEm(); //Logo if (logo == null) { user.employer_logo = id.employer_logo; } else { var img = fu.AddImages(logo, Common.Common.LINK_EMPLOYER, code1); user.employer_logo = img; } //Banner if (banner == null) { user.employer_banner = "satisfied-job.jpg"; } else { var img = fu.AddImages(banner, Common.Common.LINK_EMPLOYER, code2); user.employer_banner = img; } if (id.employer_pageload == null) { user.employer_pageload = false; } else { user.employer_pageload = id.employer_pageload; } user.user_id = id.user_id; user.user_email = id.user_email; user.user_pass = id.user_pass; user.user_active = id.user_active; user.user_option = id.user_option; user.user_datecreate = id.user_datecreate; user.user_dateupdate = id.user_dateupdate; user.user_img = id.user_img; user.user_sex = id.user_sex; user.user_birth = id.user_birth; user.user_favourite = id.user_favourite; user.role_id = id.role_id; user.user_name = id.user_name; user.user_phone = id.user_phone; user.user_note = id.user_note; user.user_key = id.user_key; user.wp_id = id.wp_id; user.version_id = id.version_id; user.employer_amoutjob = id.employer_amoutjob; db.Entry(user).State = EntityState.Modified; db.SaveChanges(); return(Redirect("/Employer/HomeEmployer/Index")); }
public ActionResult ReturnUrl(int errorCode, int amount) { if (Session["pakeid"] == null) { return(RedirectToAction("HistoryPay")); } else { var coo = new FunctionController(); var idus = coo.CookieIDEm(); User us = db.Users.Find(idus.user_id); int pake = Int32.Parse(Session["pakeid"].ToString()); Pakage pakege = db.Pakages.Find(pake); if (errorCode.Equals(0)) { ViewBag.Note = "Thanh toán thành công"; if (pakege.pakage_id == 11) { us.employer_amoutjob = 30; us.version_id = Common.Common.VER_EM_CC1; us.user_deadline = DateTime.Now.AddMonths(1); } else if (pakege.pakage_id == 12) { us.employer_amoutjob = 50; us.version_id = Common.Common.VER_EM_CC2; us.user_deadline = DateTime.Now.AddMonths(1); } else if (pakege.pakage_id == 13) { us.employer_amoutjob = 80; us.version_id = Common.Common.VER_EM_PRO; us.user_deadline = DateTime.Now.AddMonths(1); } else if (pakege.pakage_id == 14) { us.employer_amoutjob = 120; us.version_id = Common.Common.VER_EM_MAX; us.user_deadline = DateTime.Now.AddMonths(1); } else { us.user_active = false; } Bill bill = new Bill { bill_active = true, bill_datecreate = DateTime.Now, bill_dealine = DateTime.Now.AddMonths(1), bill_sum = amount, user_id = us.user_id, pakege_id = pake }; db.Bills.Add(bill); db.SaveChanges(); Session["pakeid"] = null; return(RedirectToAction("HistoryPay")); } else { ViewBag.Note = "Thanh toán thất bại"; Bill bill = new Bill { bill_active = false, bill_datecreate = DateTime.Now, bill_dealine = DateTime.Now, bill_sum = amount, user_id = us.user_id, pakege_id = pake }; db.Bills.Add(bill); db.SaveChanges(); Session["pakeid"] = null; return(RedirectToAction("HistoryPay")); } } }
public ActionResult PayMoMo(int?id) { var coo = new FunctionController(); var idus = coo.CookieIDEm(); Pakage pakage = db.Pakages.Find(id); var money = pakage.pakage_money * (1 - (float)pakage.pakage_precent / 100); //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 tài khoản " + idus.user_email + " lên " + pakage.pakage_name; string returnUrl = "https://localhost:44350/Employer/PayEmployer/ReturnUrl"; string notifyurl = "https://localhost:44350/Employer/PayEmployer/ReturnNotify"; string amount = money.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["pakeid"] = id; return(Redirect(jmessage.GetValue("payUrl").ToString())); }