private bool jobExists(string username) { jobsList = client.CheckAccManagerJobExists(username); if (jobsList.Count > 0) { return(true); } return(false); }
private void FillJobCollection() { jobList = client.CheckAccManagerJobExists(username); for (int i = 0; i < jobList.Count; i++) { DbJob job = jobList[i]; _JobCollection.Add(new DbJob { Location = job.Location.ToString(), Company = job.Company.ToString(), Title = job.Title.ToString(), DatePosted = job.DatePosted }); } }
public void fillMyJobsDataGrid() { myJobsGridView.Rows.Clear(); // setting the properties of DataGrid myJobsGridView.RowTemplate.Height = 50; myJobsGridView.RowHeadersVisible = false; //filling the variables by the service method calls string username = service.FindUsernameBySessionId(sessionId); myFullJobsList = service.CheckAccManagerJobExists(username); //Setting the first cloumn of DataGrid to be a View column DataGridViewLinkColumn lbl = new DataGridViewLinkColumn(); myJobsGridView.Columns.Add(lbl); lbl.HeaderText = "Select"; lbl.Text = "select"; lbl.Name = "lbl"; lbl.UseColumnTextForLinkValue = true; //Setting the second column of DataGrid to be an Edit column DataGridViewLinkColumn editlbl = new DataGridViewLinkColumn(); myJobsGridView.Columns.Add(editlbl); editlbl.HeaderText = " Edit "; editlbl.Text = "Edit"; editlbl.Name = "editlbl"; editlbl.UseColumnTextForLinkValue = true; //Setting the third column of the DataGrid to ba a delete column DataGridViewLinkColumn dellbl = new DataGridViewLinkColumn(); myJobsGridView.Columns.Add(dellbl); dellbl.HeaderText = "Delete"; dellbl.Text = "Delete"; dellbl.Name = "dellbl"; dellbl.UseColumnTextForLinkValue = true; //Setting rest of the five columns of DataGrid to display useful information myJobsGridView.ColumnCount = 8; myJobsGridView.Columns[3].Name = "Title"; myJobsGridView.Columns[4].Name = "Company"; myJobsGridView.Columns[5].Name = "Date Posted"; myJobsGridView.Columns[6].Name = "Location"; myJobsGridView.Columns[7].Name = "Status"; //Filling the last five columns with the data from the databse string[] row = new string[] { }; for (int j = 0; j < myFullJobsList.Count; j++) { row = new string[] { "", "", "", myFullJobsList[j].Title, myFullJobsList[j].Company, myFullJobsList[j].DatePosted.ToString(), myFullJobsList[j].Location, myFullJobsList[j].Status }; myJobsGridView.Rows.Add(row); myJobsGridView.Columns[j].AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells; //Filling first column with a view image DataGridViewImageCell imgCell = new DataGridViewImageCell(); string exeFile = (new System.Uri(Assembly.GetEntryAssembly().CodeBase)).AbsolutePath; string exeDir = Path.GetDirectoryName(exeFile); string fullPath = Path.Combine(exeDir, "..\\..\\Image\\view.bmp"); imgCell.Value = Image.FromFile(fullPath); this.myJobsGridView[0, j] = imgCell; myJobsGridView.Columns[0].AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader; //Filling second column with an edit image DataGridViewImageCell imgCell2 = new DataGridViewImageCell(); string fullPath2 = Path.Combine(exeDir, "..\\..\\Image\\edit.bmp"); imgCell2.Value = Image.FromFile(fullPath2); this.myJobsGridView[1, j] = imgCell2; myJobsGridView.Columns[1].AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader; //Filling third column with a delete image DataGridViewImageCell imgCell3 = new DataGridViewImageCell(); string fullPath3 = Path.Combine(exeDir, "..\\..\\Image\\delete.bmp"); imgCell3.Value = Image.FromFile(fullPath3); this.myJobsGridView[2, j] = imgCell3; myJobsGridView.Columns[2].AutoSizeMode = DataGridViewAutoSizeColumnMode.ColumnHeader; } //Getting rid of the grid border myJobsGridView.BorderStyle = BorderStyle.None; myJobsGridView.DefaultCellStyle.SelectionBackColor = myJobsGridView.DefaultCellStyle.BackColor; myJobsGridView.DefaultCellStyle.SelectionForeColor = myJobsGridView.DefaultCellStyle.ForeColor; }