コード例 #1
0
        public ActionResult invitejob(Guid userid)
        {
            Int32            jobid  = Convert.ToInt32(TempData.Peek("JobID"));
            tbl_JobEmployees jobemp = new tbl_JobEmployees();

            jobemp.Fk_JobId                = jobid;
            jobemp.fromUserId              = clsSession.UserID;
            jobemp.fromUserName            = clsSession.UserName;
            jobemp.toUserId                = userid;
            jobemp.EmplyeeFeePaymentStatus = "invitation sent";
            jobemp.CreatedDate             = DateTime.Now;
            jobemp.IsActive                = true;
            _dataContext.tbl_JobEmployees.Add(jobemp);
            _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 == userid).FirstOrDefault();
            //Get Job Detail...!!!
            tbl_Jobs    job     = _dataContext.tbl_Jobs.Where(s => s.Pk_JobId == jobid).FirstOrDefault();
            MailMessage message = new MailMessage(
                "*****@*****.**",                                                                                                               // From field
                touserdetail.EmailId,                                                                                                              // Recipient field
                "Job Request Sent by Client",                                                                                                      // Subject of the email message
                PopulateBody(clsSession.UserName, job.JobTitle, job.JobCategory, job.JobLocation, "$" + job.Amount.ToString(), job.JobDescription) // Email message body
                );

            _sendemail.SendEmail(message);
            return(PartialView("_invitationsentsuccess"));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
ファイル: JobsController.cs プロジェクト: ashwanisihag/DAV
        public async Task <IHttpActionResult> Posttbl_Jobs(tbl_Jobs tbl_Jobs)
        {
            LogApi.Log(User.Identity.GetUserId(), "PostJob " + User.Identity.GetUserName());

            var id = User.Identity.GetUserId();

            tbl_Jobs.col_PostedBy     = id;
            tbl_Jobs.col_Expired      = false;
            tbl_Jobs.col_PostDateTime = DateTime.Now;
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.tbl_Jobs.Add(tbl_Jobs);
            await db.SaveChangesAsync();

            try
            {
                var tokens = db.tbl_DeviceIds;
                foreach (var d in tokens)
                {
                    Notifications.NotifyAsync(d.col_DeviceToken, "Job", "New job: " + tbl_Jobs.col_JobTitle + "#" + tbl_Jobs.col_JobDescription);
                }
            }
            catch (Exception ex)
            {
            }
            return(Ok("Posted"));
        }
コード例 #4
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"));
        }
コード例 #5
0
ファイル: JobsController.cs プロジェクト: ashwanisihag/DAV
        public async Task <IHttpActionResult> Puttbl_Jobs(int id, tbl_Jobs tbl_Jobs)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != tbl_Jobs.col_JobID)
            {
                return(BadRequest());
            }

            db.Entry(tbl_Jobs).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!tbl_JobsExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
コード例 #6
0
        public ActionResult applyjob(Int32 id)
        {
            tbl_Jobs job = _dataContext.tbl_Jobs.Where(s => s.Pk_JobId == id).SingleOrDefault();

            if (job != null)
            {
                tbl_JobEmployees employeedata = new tbl_JobEmployees();
                employeedata.Fk_JobId                = id;
                employeedata.fromUserId              = clsSession.UserID;
                employeedata.fromUserName            = clsSession.UserName;
                employeedata.toUserId                = job.ClientUserId;
                employeedata.EmplyeeFeePaymentStatus = "employee requested";
                employeedata.IsActive                = true;
                employeedata.CreatedDate             = DateTime.Now;
                _dataContext.tbl_JobEmployees.Add(employeedata);
                _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 == job.ClientUserId).FirstOrDefault();
                //Get Job Detail...!!!
                MailMessage message = new MailMessage(
                    "*****@*****.**",                                                                                                                                        // From field
                    touserdetail.EmailId,                                                                                                                                       // Recipient field
                    "Job Request Sent by Employee",                                                                                                                             // Subject of the email message
                    PopulateBody(clsSession.UserName, job.JobTitle, job.JobCategory, job.JobLocation, "$" + job.Amount.ToString(), job.JobDescription, false, "", false, false) // Email message body
                    );
                _sendemail.SendEmail(message);
            }
            return(RedirectToAction("jobrequested"));
        }
コード例 #7
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"));
        }
コード例 #8
0
ファイル: JobsController.cs プロジェクト: ashwanisihag/DAV
        public async Task <IHttpActionResult> Gettbl_Jobs(int id)
        {
            tbl_Jobs tbl_Jobs = await db.tbl_Jobs.FindAsync(id);

            if (tbl_Jobs == null)
            {
                return(NotFound());
            }

            return(Ok(tbl_Jobs));
        }
コード例 #9
0
        public ActionResult Index()
        {
            vm_Jobs         vm_Jobs = new vm_Jobs();
            List <tbl_Jobs> jobList = new List <tbl_Jobs>();

            string        mainconn = ConfigurationManager.ConnectionStrings["allpaxServiceRecordEntities"].ConnectionString;
            SqlConnection sqlconn  = new SqlConnection(mainconn);

            sqlconn.Open();

            string sqlquery1 =
                "SELECT tbl_Jobs.jobID, tbl_Jobs.description, tbl_Jobs.customerCode, tbl_Jobs.customerContact, tbl_Jobs.active, tbl_Jobs.location, tbl_Jobs.nrmlHoursStart, " +
                "tbl_Jobs.nrmlHoursEnd, tbl_Jobs.nrmlHoursDaily, tbl_Jobs.dblTimeHours, tbl_Jobs.id " +
                "FROM tbl_Jobs";

            SqlCommand     sqlcomm1 = new SqlCommand(sqlquery1, sqlconn);
            SqlDataAdapter sda1     = new SqlDataAdapter(sqlcomm1);
            DataTable      dt1      = new DataTable();

            sda1.Fill(dt1);
            foreach (DataRow dr1 in dt1.Rows)
            {
                tbl_Jobs job = new tbl_Jobs();

                job.jobID           = dr1[0].ToString();
                job.description     = dr1[1].ToString();
                job.customerCode    = dr1[2].ToString();
                job.customerContact = dr1[3].ToString();
                job.active          = (Boolean)dr1[4];
                job.location        = dr1[5].ToString();
                job.nrmlHoursStart  = dr1[6].ToString();
                job.nrmlHoursEnd    = dr1[7].ToString();
                job.nrmlHoursDaily  = (int)dr1[8];
                job.dblTimeHours    = (Boolean)dr1[9];
                job.id = (int)dr1[10];

                jobList.Add(job);
            }

            vm_Jobs.jobs          = jobList;
            vm_Jobs.customers     = customerList();
            vm_Jobs.subJobTypes   = subJobTypesByJobID("%");
            vm_Jobs.resourceTypes = resourceTypesByJobID("%");

            sqlconn.Close();

            return(View(vm_Jobs));
        }
コード例 #10
0
ファイル: JobsController.cs プロジェクト: ashwanisihag/DAV
        public async Task <IHttpActionResult> Deletetbl_Jobs(int id)
        {
            LogApi.Log(User.Identity.GetUserId(), "DeleteJob " + User.Identity.GetUserName());

            tbl_Jobs tbl_Jobs = await db.tbl_Jobs.FindAsync(id);

            if (tbl_Jobs == null)
            {
                return(NotFound());
            }

            db.tbl_Jobs.Remove(tbl_Jobs);
            await db.SaveChangesAsync();

            return(Ok("Deleted"));
        }
コード例 #11
0
        public void GetJobInfoByJobID(string jobID)
        {
            string          cs   = ConfigurationManager.ConnectionStrings["allpaxServiceRecordEntities"].ConnectionString;
            List <tbl_Jobs> jobs = new List <tbl_Jobs>();

            using (SqlConnection con = new SqlConnection(cs))
            {
                SqlCommand cmd = new SqlCommand("spGetJobInfoByJobID", con);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@jobID", jobID);

                con.Open();
                SqlDataReader rdr = cmd.ExecuteReader();
                while (rdr.Read())
                {
                    tbl_Jobs job = new tbl_Jobs();
                    job.jobID           = rdr["jobID"].ToString();
                    job.description     = rdr["description"].ToString();
                    job.customerCode    = rdr["customerCode"].ToString();
                    job.customerContact = rdr["customerContact"].ToString();

                    job.active         = (bool)rdr["active"];
                    job.location       = rdr["location"].ToString();
                    job.nrmlHoursStart = rdr["nrmlHoursStart"].ToString();
                    job.nrmlHoursEnd   = rdr["nrmlHoursEnd"].ToString();

                    job.dblTimeHours   = (bool)rdr["dblTimeHours"];
                    job.nrmlHoursDaily = (int)rdr["nrmlHoursDaily"];
                    job.id             = (int)rdr["id"];

                    jobs.Add(job);
                }
            }
            JavaScriptSerializer js = new JavaScriptSerializer();

            Context.Response.Write(js.Serialize(jobs));
        }
コード例 #12
0
        public ActionResult View(int id)
        {
            tbl_Jobs job = _dataContext.tbl_Jobs.Where(x => x.Pk_JobId == id).FirstOrDefault();

            return(View("~/Areas/user/Views/Job/ViewJob.cshtml", job));
        }