public ActionResult approvejob(Int32 id, Guid fromId) { tbl_JobEmployees jobstatus = _dataContext.tbl_JobEmployees.Where(s => s.Fk_JobId == id && s.fromUserId == fromId).FirstOrDefault(); jobstatus.EmplyeeFeePaymentStatus = "Approved"; _dataContext.SaveChanges(); //For Change Job Status...!!! tbl_Jobs job = _dataContext.tbl_Jobs.Where(s => s.Pk_JobId == id).FirstOrDefault(); List <tbl_JobEmployees> jobemployeedata = _dataContext.tbl_JobEmployees.Where(s => s.Fk_JobId == id && s.EmplyeeFeePaymentStatus == "Approved").ToList(); if (jobemployeedata.Count >= job.NoOfEmployeeNeeded) { job.JobStatus = "Approved"; _dataContext.SaveChanges(); } //Sent Email to employee to introduce about job detail...!!! //Get send user details...!!! tbl_Users touserdetail = _dataContext.tbl_Users.Where(s => s.Pk_UserId == jobstatus.fromUserId).FirstOrDefault(); string userid = EncrytDecrypt.passwordEncrypt(clsSession.UserID.ToString(), true); string jobid = EncrytDecrypt.passwordEncrypt(job.Pk_JobId.ToString(), true); string paymenturl = "http://hardyhat.com/user/payment/checkout?userid=" + clsSession.UserID.ToString() + "&jobid=" + job.Pk_JobId.ToString(); //Get Job Detail...!!! MailMessage message = new MailMessage( "*****@*****.**", // From field touserdetail.EmailId, // Recipient field "Job Approved by Client", // Subject of the email message PopulateBody(clsSession.UserName, job.JobTitle, job.JobCategory, job.JobLocation, "$" + job.Amount.ToString(), job.JobDescription, true, paymenturl, false, false) // Email message body ); return(RedirectToAction("clientjobproposal")); }
public ActionResult checkout(string userid, string jobid) { var gateway = config.GetGateway(); var clientToken = gateway.ClientToken.generate(); ViewBag.ClientToken = clientToken; //Check for this jobid,userid,transaction Id status if (!string.IsNullOrEmpty(userid) && !string.IsNullOrEmpty(jobid)) { userid = EncrytDecrypt.passwordDecrypt(userid.ToString(), true); jobid = EncrytDecrypt.passwordDecrypt(jobid.ToString(), true); try { var table = new DataTable(); SqlConnection conn = new SqlConnection("Data source=148.72.232.166; Database=hardyhat;User Id=vineshnilesh888;Password=VineshNilesh88"); conn.Open(); SqlCommand cmd = new SqlCommand("select * from [vineshnilesh888].[tbl_JobPayment] where Fk_JobId=" + jobid + " and UserId='" + userid + "';", conn); // create data adapter SqlDataAdapter da = new SqlDataAdapter(cmd); // this will query your database and return the result to your datatable da.Fill(table); conn.Close(); da.Dispose(); if (table.Rows.Count == 0) { //insert into the job payment table...!!! Decimal companyFee = Convert.ToDecimal("2.00"); conn.Open(); SqlCommand cmdInsert = new SqlCommand("insert into [vineshnilesh888].[tbl_JobPayment] (Fk_JobId,UserId,Amount) values(" + jobid + ",'" + userid + "'," + companyFee + ");", conn); int id = cmdInsert.ExecuteNonQuery(); conn.Close(); string pk_paymentId = Convert.ToString(id); clsSession.paymentID = pk_paymentId; Console.WriteLine("Inserting Data Successfully"); } else if (Convert.ToString(table.Rows[0]["PaymentStatus"]) == "submitted_for_settlement") { return(RedirectToRoute("error-authorized")); } else { string pk_paymentId = Convert.ToString(table.Rows[0]["Pk_JobPaymentId"]); clsSession.paymentID = pk_paymentId; } } catch (Exception e) { } } else { return(RedirectToRoute("error-authorized")); } return(View()); }
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")); }