public List <jobModel> GetJobs()
        {
            List <jobModel> JobData = new List <jobModel>();

            SqlCommand sc = new SqlCommand("[Digital_School].get_AnotherDatabase", Connections.GetConnection());

            sc.CommandType = CommandType.StoredProcedure;

            SqlDataReader sdr = sc.ExecuteReader();

            while (sdr.Read())
            {
                jobModel gc = new jobModel();
                //gc.CourseId = Convert.ToInt32(sdr["courseId"]);
                gc.jobId            = Convert.ToInt32(sdr["jobId"]);
                gc.jobTitle         = sdr["jobTitle"].ToString();
                gc.imageUrl         = sdr["imageUrl"].ToString();
                gc.date             = Convert.ToString(sdr["date"]);
                gc.shortDescription = sdr["shortDescription"].ToString();
                gc.longDescription  = sdr["longDescription"].ToString();
                gc.views            = Convert.ToInt32(sdr["views"]);
                //lv.Name = sdr["Name"].ToString(
                JobData.Add(gc);
            }
            sdr.Close();
            return(JobData);
        }
Beispiel #2
0
        public ActionResult Edit(jobModel job)
        {
            string connectionString = @"server=localhost;user id=root;database=mvcdb";

            using (MySqlConnection connection = new MySqlConnection(connectionString))
            {
                connection.Open();
                string       update = "UPDATE `job info` SET `Task Name` =@taskName, Description=@description, `Date Started`=@dateStarted, `Date Finished`=@dateFinished, `Status`=@status WHERE `JobID` = @jobID";
                MySqlCommand cmd    = new MySqlCommand(update, connection);
                cmd.Parameters.AddWithValue("@jobID", job.jobID);
                cmd.Parameters.AddWithValue("@taskName", job.taskName);
                cmd.Parameters.AddWithValue("@description", job.description);
                cmd.Parameters.AddWithValue("@dateStarted", job.dateStarted);
                cmd.Parameters.AddWithValue("@dateFinished", job.dateFinished);
                cmd.Parameters.AddWithValue("@status", job.status);


                cmd.ExecuteNonQuery();
                System.Diagnostics.Debug.WriteLine(job.jobID);
                System.Diagnostics.Debug.WriteLine(job.taskName);
                System.Diagnostics.Debug.WriteLine(job.description);
                System.Diagnostics.Debug.WriteLine(job.dateStarted);
                System.Diagnostics.Debug.WriteLine(job.dateFinished);
                System.Diagnostics.Debug.WriteLine(job.status);
            }
            return(RedirectToAction("List"));
        }
Beispiel #3
0
        public ActionResult Edit(int id)
        {
            string    connectionString = @"server=localhost;user id=root;database=mvcdb";
            jobModel  job         = new jobModel();
            DataTable dtblProduct = new DataTable();


            using (MySqlConnection connection = new MySqlConnection(connectionString))
            {
                connection.Open();
                string           select = "SELECT * FROM  `job info` WHERE JobID = @jobID";
                MySqlDataAdapter da     = new MySqlDataAdapter(select, connection);
                da.SelectCommand.Parameters.AddWithValue("@jobID", id);
                da.Fill(dtblProduct);
            }

            if (dtblProduct.Rows.Count == 1)
            {
                job.jobID        = Convert.ToInt32(dtblProduct.Rows[0][0]);
                job.taskName     = dtblProduct.Rows[0][1].ToString();
                job.description  = dtblProduct.Rows[0][2].ToString();
                job.dateStarted  = dtblProduct.Rows[0][3].ToString();
                job.dateFinished = dtblProduct.Rows[0][4].ToString();
                job.status       = dtblProduct.Rows[0][5].ToString();


                System.Diagnostics.Debug.WriteLine(job.jobID);
                System.Diagnostics.Debug.WriteLine(job.taskName);
                System.Diagnostics.Debug.WriteLine(job.description);
                System.Diagnostics.Debug.WriteLine(job.dateStarted);
                System.Diagnostics.Debug.WriteLine(job.dateFinished);
                System.Diagnostics.Debug.WriteLine(job.status);
                return(View(job));
            }
            else
            {
                return(RedirectToAction("List"));
            }
        }
Beispiel #4
0
        public ActionResult Index(jobModel job)
        {
            {
                string          connectionString = @"server=localhost;user id=root;database=mvcdb";
                MySqlConnection connection       = null;


                connection = new MySqlConnection(connectionString);
                connection.Open();
                MySqlCommand cmd = new MySqlCommand();
                cmd.Connection  = connection;
                cmd.CommandText = "INSERT INTO `job info`(`Task Name`, `Description`, `Date Started`, `Date Finished`, `Status`) VALUES (@taskName, @description, @dateStarted, @dateFinished, @status)";

                cmd.Parameters.AddWithValue("@taskName", job.taskName);
                cmd.Parameters.AddWithValue("@description", job.description);
                cmd.Parameters.AddWithValue("@dateStarted", job.dateStarted);
                cmd.Parameters.AddWithValue("@dateFinished", job.dateFinished);
                cmd.Parameters.AddWithValue("@status", job.status);

                cmd.ExecuteNonQuery();

                return(View(job));
            }
        }
        public async Task startupMethod(string jobid)
        {
            JobsServices js = new JobsServices();

            try
            {
                jobModel jobmodels = null;

                if (string.IsNullOrEmpty(jobid) == false)
                {
                    jobmodels = await js.GeTJobDetails(URLConfig.getjobdetailsapiurl, jobid);
                }

                _jobModel = jobmodels;


                int counter = 0;
                if (DateTime.Now > _jobModel.expireDate)
                {
                    edstring = "Expired";
                }
                else
                {
                    var newExpiary = CalculateExpirayText(counter);
                    Device.StartTimer(TimeSpan.FromSeconds(60), () =>
                    {
                        newExpiary = CalculateExpirayText(counter);

                        if (DateTime.Now >= newExpiary)
                        {
                            return(false);
                        }
                        counter++;
                        if (JobListHelper.ExpireTimerEnabled)
                        {
                            return(true);
                        }

                        return(false);
                    });
                }

                if (jobmodels.hasPublicTransportation == true)
                {
                    PublicTransportation = "checkmarkpng.png";
                }
                else
                {
                    PublicTransportation = "crosimage.png";
                }
                if (jobmodels.hasParking == true)
                {
                    Parking = "checkmarkpng.png";
                }
                else
                {
                    Parking = "crosimage.png";
                }
                if (_jobModel.workAttireAvailable == true)
                {
                    jobModel.workAttireAvailablestring = "checkmarkpng.png";
                }
                else
                {
                    jobModel.workAttireAvailablestring = "crosimage.png";
                }
                if (_jobModel.labCoatAvailable == true)
                {
                    _jobModel.labCoatAvailablestring = "checkmarkpng.png";
                }
                else
                {
                    jobModel.labCoatAvailablestring = "crosimage.png";
                }
                if (_jobModel.scrubAvailable == true)
                {
                    _jobModel.scrubAvailablestring = "checkmarkpng.png";
                }
                else
                {
                    _jobModel.scrubAvailablestring = "crosimage.png";
                }


                var cassstlist = jobmodels.jobSchedules.OrderBy(c => c.from).ToList();
                ObservableCollection <JobSchedule> jobSchedulesCollection = new ObservableCollection <JobSchedule>(cassstlist);
                jobscollection = jobSchedulesCollection;
                var x = jobscollection.FirstOrDefault();
                var Y = jobscollection.LastOrDefault();
                _jobModel.fromtodateString = "“" + x.from.ToString("D") + "”" + "," + "from" + "“" + x.from.Hour.ToString() + x.from.ToString("tt ") + "”" + " to " + "“" + x.to.Hour.ToString() + x.to.ToString("tt ") + "”";

                _jobModel.distance = _jobModel.distance + " Miles";


                foreach (var item in jobscollection)
                {
                    _jobModel.fromtostring = item.from.Hour.ToString() + " " + item.from.ToString("tt ") + " - " + item.to.Hour.ToString() + " " + item.to.ToString("tt ");
                    item.Datefromto        = item.from.ToString("dddd") + " - " + item.from.Date.ToString("MM/dd/yyyy") + " - " + item.from.Hour.ToString() + item.from.ToString("tt ") + " / " + item.to.Hour.ToString() + item.to.ToString("tt ");
                }
                ObservableCollection <JobSkill> jobSkillsCollection = new ObservableCollection <JobSkill>(jobmodels.jobSkills);
                jobSkillCollection = jobSkillsCollection;

                foreach (var item in jobSkillCollection)
                {
                    if (item.skillCategory == 1)
                    {
                        item.Categorytitle = SkillCategories.Languages.ToString();
                    }
                    else if (item.skillCategory == 2)
                    {
                        item.Categorytitle = SkillCategories.ComputerSkills.ToString();
                    }
                    else if (item.skillCategory == 10)
                    {
                        item.Categorytitle = SkillCategories.Other.ToString();
                    }
                    else
                    {
                        return;
                    }
                }
                try
                {
                    if (jobModel.locationLatitude == null || _jobModel.locationLongitude == null)
                    {
                        locationlat  = 0.0;
                        locationLong = 0.0;
                    }
                    else
                    {
                        locationlat  = (double)_jobModel.locationLatitude;
                        locationLong = (double)_jobModel.locationLongitude;
                    }
                }
                catch (Exception ex)
                {
                    var logged = new LoggedException.LoggedException("Error in jobdetailsviewmodel", ex);
                    await logged.LoggAPI();
                }



                //TODO : this Block of Code needs to handeld
                //start of the Block
                if (_jobModel.isPartialyAllowed == true)
                {
                    foreach (var item in jobscollection)
                    {
                        item.imagesource = "UNCWWBackround.png";
                    }
                }
                else if (_jobModel.isPartialyAllowed == false)
                {
                    foreach (var item in jobscollection)
                    {
                        item.imagesource = "CheckedCaroot.png";
                        DatesSelected    = jobscollection;
                        var LISTCASST = DatesSelected.OrderBy(xz => xz.from);
                        ObservableCollection <JobSchedule> castlistordering = new ObservableCollection <JobSchedule>(LISTCASST);
                        DatesSelected = castlistordering;
                        var xlenght = DatesSelected.Count();
                        //int counter = 0;
                        if (DatesSelected != null)
                        {
                            foreach (var element in DatesSelected)
                            {
                                element.DayNumber = "Day" + (counter + 1).ToString();
                                counter++;
                            }
                        }
                    }
                }
                //end of the Block



                //in case of employee already applied on job
                foreach (var item in jobscollection)
                {
                    if (item.isSelected == true)
                    {
                        item.imagesource = "CheckedCaroot.png";
                    }
                    else
                    {
                        item.imagesource = "UNCWWBackround.png";
                    }
                }
            }
            catch (Exception ex)
            {
                var logged = new LoggedException.LoggedException("Error in jobdetialaviewmodel", ex);
                await logged.LoggAPI();
            }


            SkillsString = _jobModel.skillsText;
        }
        public static FormattedString LabelTextFormating(jobModel temps, int sldrvalue)
        {
            try
            {
                var fs = new FormattedString();
                fs.Spans.Add(new Span {
                    Text = "Awesome, ", ForegroundColor = Color.Black, Font = Font.SystemFontOfSize(14, FontAttributes.Italic)
                });
                fs.Spans.Add(new Span {
                    Text = "let’s confirm your job details. You’re applying for a, ", ForegroundColor = Color.Black, Font = Font.Default
                });

                fs.Spans.Add(new Span {
                    Text = $"{temps.jobTypeTitle}", ForegroundColor = Color.FromHex("#60afdf"), Font = Font.SystemFontOfSize(14, FontAttributes.Bold)
                });

                fs.Spans.Add(new Span {
                    Text = " job, in ", ForegroundColor = Color.Black, Font = Font.Default
                });

                fs.Spans.Add(new Span {
                    Text = $"{temps.states}", ForegroundColor = Color.FromHex("#60afdf"), Font = Font.SystemFontOfSize(14, FontAttributes.Bold)
                });

                fs.Spans.Add(new Span {
                    Text = ", for ", ForegroundColor = Color.Black, Font = Font.Default
                });

                fs.Spans.Add(new Span {
                    Text = "$", ForegroundColor = Color.FromHex("#60afdf"), Font = Font.SystemFontOfSize(14, FontAttributes.Bold)
                });
                fs.Spans.Add(new Span {
                    Text = $"{sldrvalue}", ForegroundColor = Color.FromHex("#60afdf"), Font = Font.SystemFontOfSize(14, FontAttributes.Bold)
                });
                fs.Spans.Add(new Span {
                    Text = "/hr", ForegroundColor = Color.FromHex("#60afdf"), Font = Font.SystemFontOfSize(14, FontAttributes.Bold)
                });

                fs.Spans.Add(new Span {
                    Text = ", on ", ForegroundColor = Color.Black, Font = Font.Default
                });

                fs.Spans.Add(new Span {
                    Text = $"{temps.jobSchedules.FirstOrDefault().from.ToString("D")}", ForegroundColor = Color.FromHex("#60afdf"), Font = Font.SystemFontOfSize(14, FontAttributes.Bold)
                });

                fs.Spans.Add(new Span {
                    Text = ", from ", ForegroundColor = Color.Black, Font = Font.Default
                });

                fs.Spans.Add(new Span {
                    Text = $"{  temps.jobSchedules.FirstOrDefault().from.Hour + temps.jobSchedules.FirstOrDefault().from.ToString("tt ")  }", ForegroundColor = Color.FromHex("#60afdf"), Font = Font.SystemFontOfSize(14, FontAttributes.Bold)
                });

                fs.Spans.Add(new Span {
                    Text = ", to ", ForegroundColor = Color.Black, Font = Font.Default
                });

                fs.Spans.Add(new Span {
                    Text = $"{ temps.jobSchedules.FirstOrDefault().to.Hour + temps.jobSchedules.FirstOrDefault().to.ToString("tt ") }", ForegroundColor = Color.FromHex("#60afdf"), Font = Font.SystemFontOfSize(14, FontAttributes.Bold)
                });

                fs.Spans.Add(new Span {
                    Text = ".", ForegroundColor = Color.FromHex("#60afdf"), Font = Font.Default
                });

                return(fs);
            }
            catch (Exception ex)
            {
                var logged = new LoggedException.LoggedException("Error in jobdetailstexthelper.cs", ex);
                logged.LoggAPI();
            }
            return(AlertMessages.textformating);
        }