public ActionResult createJob(tbl_Jobs job) { if (ModelState.IsValid) { var companyfee = _dataContext.tbl_Setting.SingleOrDefault(); job.CompanyFee = companyfee.CompanyFee; job.ClientUserId = clsSession.UserID; job.IsActive = true; job.UniqueJobId = Guid.NewGuid().ToString().Split('-')[0]; job.ClientFeePaymentStatus = "Pending"; job.JobStatus = "Pending"; job.CreatedDate = DateTime.Now; _dataContext.tbl_Jobs.Add(job); _dataContext.SaveChanges(); } List <SelectListItem> list = new List <SelectListItem>(); list.Add(new SelectListItem { Text = "IT", Value = "IT" }); list.Add(new SelectListItem { Text = "Hardware", Value = "Hardware" }); list.Add(new SelectListItem { Text = "Painting", Value = "Painting" }); ViewBag.JobCategoryList = list; return(View(job)); }
public ActionResult Index(tbl_ContactUs contactus) { //Save record into table contactus.IsActive = true; contactus.CreatedDate = DateTime.Now; contactus.ModifiedDate = DateTime.Now; _dataContext.tbl_ContactUs.Add(contactus); _dataContext.SaveChanges(); return(RedirectToRoute("ThankYou")); //Send email to the user }
public ActionResult activate(Guid id) { tbl_Users user = _dataContext.tbl_Users.Where(s => s.Pk_UserId == id).SingleOrDefault(); if (user != null) { user.IsActive = !(user.IsActive); user.cpassword = user.Password; if (ModelState.IsValid) { try { // save changes _dataContext.SaveChanges(); } catch (DbEntityValidationException dbValEx) { var outputLines = new StringBuilder(); foreach (var eve in dbValEx.EntityValidationErrors) { outputLines.AppendFormat("{0}: Entity of type \"{1}\" in state \"{2}\" has the following validation errors:" , DateTime.Now, eve.Entry.Entity.GetType().Name, eve.Entry.State); foreach (var ve in eve.ValidationErrors) { outputLines.AppendFormat("- Property: \"{0}\", Error: \"{1}\"" , ve.PropertyName, ve.ErrorMessage); } } throw new DbEntityValidationException(string.Format("Validation errors\r\n{0}" , outputLines.ToString()), dbValEx); } } } tbl_Roles role = _dataContext.tbl_Roles.Where(x => x.RoleName == "Client").FirstOrDefault(); List <tbl_Users> lstUsers = _dataContext.tbl_Users.Where(x => x.Fk_RoleId == role.Pk_RoleId).ToList(); return(View("~/Areas/user/Views/ClientList/Index.cshtml", lstUsers)); }
public ActionResult approve(Int32 id) { tbl_JobEmployees jobstatus = _dataContext.tbl_JobEmployees.Where(s => s.Fk_JobId == id && s.toUserId == clsSession.UserID).FirstOrDefault(); jobstatus.EmplyeeFeePaymentStatus = "Approved"; _dataContext.SaveChanges(); //For Change Job Status...!!! tbl_Jobs job = _dataContext.tbl_Jobs.Where(s => s.Pk_JobId == id).FirstOrDefault(); //Sent Email to employee to introduce about job detail...!!! //Get send user details...!!! tbl_Users touserdetail = _dataContext.tbl_Users.Where(s => s.Pk_UserId == clsSession.UserID).FirstOrDefault(); //Get Job Detail...!!! string userid = EncrytDecrypt.passwordEncrypt(clsSession.UserID.ToString(), true); string jobid = EncrytDecrypt.passwordEncrypt(id.ToString(), true); string paymenturl = "http://hardyhat.com/user/payment/checkout?userid=" + clsSession.UserID.ToString() + "&jobid=" + id.ToString(); MailMessage message = new MailMessage( "*****@*****.**", // From field touserdetail.EmailId, // Recipient field "Pending For Payment Approval", // Subject of the email message PopulateBody(clsSession.UserName, job.JobTitle, job.JobCategory, job.JobLocation, "$" + job.Amount.ToString(), job.JobDescription, false, paymenturl, true, false) // Email message body ); _sendemail.SendEmail(message); List <tbl_JobEmployees> jobemployeedata = _dataContext.tbl_JobEmployees.Where(s => s.Fk_JobId == id && s.EmplyeeFeePaymentStatus == "Approved").ToList(); bool updateFlag = false; if (jobemployeedata.Count >= job.NoOfEmployeeNeeded) { updateFlag = true; //Sent Email to employee to introduce about job detail...!!! //Get send user details...!!! tbl_Users touserdetailClient = _dataContext.tbl_Users.Where(s => s.Pk_UserId == jobstatus.fromUserId).FirstOrDefault(); //Get Job Detail...!!! string touserid = EncrytDecrypt.passwordEncrypt(touserdetailClient.Pk_UserId.ToString(), true); string tojobid = EncrytDecrypt.passwordEncrypt(job.Pk_JobId.ToString(), true); string paymenturlClient = "http://hardyhat.com/user/payment/checkout?userid=" + touserdetailClient.Pk_UserId.ToString() + "&jobid=" + job.Pk_JobId.ToString(); MailMessage messageClient = new MailMessage( "*****@*****.**", // From field touserdetail.EmailId, // Recipient field "Pending For Payment Approval", // Subject of the email message PopulateBody(clsSession.UserName, job.JobTitle, job.JobCategory, job.JobLocation, "$" + job.Amount.ToString(), job.JobDescription, false, paymenturlClient, false, true) // Email message body ); _sendemail.SendEmail(messageClient); } if (updateFlag) { tbl_Jobs jobupdate = _dataContext.tbl_Jobs.Find(id); if (TryValidateModel(jobupdate)) { jobupdate.JobStatus = "Approved"; _dataContext.SaveChanges(); } } return(RedirectToAction("jobproposals")); }
public ActionResult Signup(tbl_Users model, FormCollection fc, HttpPostedFileBase profilephoto, HttpPostedFileBase Gov_IssueId, HttpPostedFileBase PoliceVerification, HttpPostedFileBase EligibleWorkId) { string type = Convert.ToString(fc["type"]); if (type == "Employer") { tbl_Roles role = _dataContext.tbl_Roles.Where(s => s.RoleName == "Employee").FirstOrDefault(); model.Fk_RoleId = role.Pk_RoleId; } if (type == "Client") { tbl_Roles role = _dataContext.tbl_Roles.Where(s => s.RoleName == "Client").FirstOrDefault(); model.Fk_RoleId = role.Pk_RoleId; } model.Pk_UserId = Guid.NewGuid(); model.IsActive = false; model.IsBlocked = false; model.CreatedDate = DateTime.Now; model.ModifiedDate = DateTime.Now; model.Fk_CountryId = 38; model.Country = "Canada"; model.State = _dataContext.StateMasters.Where(s => s.ID == model.Fk_StateId).SingleOrDefault().Name; model.City = _dataContext.CityMasters.Where(s => s.ID == model.Fk_CityId).SingleOrDefault().Name; if (ModelState.IsValid) { if (profilephoto != null) { var Image = Guid.NewGuid().ToString().Replace("-", ""); string extension = Path.GetExtension(profilephoto.FileName); var path = Path.Combine(Server.MapPath("~/profile_photo/"), Image + extension); profilephoto.SaveAs(path); model.UserImage = Image + extension; } if (Gov_IssueId != null) { var Image = Guid.NewGuid().ToString().Replace("-", ""); string extension = Path.GetExtension(Gov_IssueId.FileName); var path = Path.Combine(Server.MapPath("~/user_doc/"), Image + extension); Gov_IssueId.SaveAs(path); model.Gov_IssueId = Image + extension; } if (PoliceVerification != null) { var Image = Guid.NewGuid().ToString().Replace("-", ""); string extension = Path.GetExtension(PoliceVerification.FileName); var path = Path.Combine(Server.MapPath("~/user_doc/"), Image + extension); PoliceVerification.SaveAs(path); model.PoliceVerification = Image + extension; } if (EligibleWorkId != null) { var Image = Guid.NewGuid().ToString().Replace("-", ""); string extension = Path.GetExtension(EligibleWorkId.FileName); var path = Path.Combine(Server.MapPath("~/user_doc/"), Image + extension); EligibleWorkId.SaveAs(path); model.EligibleWorkId = Image + extension; } _dataContext.tbl_Users.Add(model); _dataContext.SaveChanges(); } else { ViewBag.StateList = _dataContext.StateMasters.Where(s => s.CountryID == 38).ToList().Select(s => new SelectListItem { Text = s.Name, Value = s.ID.ToString() }); return(View(model)); } //For Send Mail...!!! MailMessage message = new MailMessage( "*****@*****.**", // From field model.EmailId, // Recipient field "Register Successfully", // Subject of the email message PopulateBody(model.FirstName + "" + model.LastName) // Email message body ); _sendemail.SendEmail(message); return(RedirectToRoute("ThankYou")); }