Пример #1
0
        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"));
        }
Пример #2
0
        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"));
        }