private DataTable GenerateSummaryColumns() { DataTable table = new DataTable(); Department dept = new Department(); JobTypeDepartment jobtypeDepartment = new JobTypeDepartment(); joboverviewDepartment = dept.GetJobOverviewDepartment(); DataColumn hwCol = new DataColumn("HW No", typeof(System.String)); DataColumn swCol = new DataColumn("SW No", typeof(System.String)); DataColumn cusCol = new DataColumn("Customer", typeof(System.String)); DataColumn jdCol = new DataColumn("Description", typeof(System.String)); table.Columns.Add(hwCol); table.Columns.Add(swCol); table.Columns.Add(cusCol); table.Columns.Add(jdCol); BoundField bfHw = new BoundField(); bfHw.HeaderText = "HW No"; bfHw.DataField = "HW No"; BoundField bfSw = new BoundField(); bfSw.HeaderText = "SW No"; bfSw.DataField = "SW No"; BoundField bfCus = new BoundField(); bfCus.HeaderText = "Customer"; bfCus.DataField = "Customer"; BoundField bfDes = new BoundField(); bfDes.HeaderText = "Description"; bfDes.DataField = "Description"; gridViewSummary.Columns.Add(bfHw); gridViewSummary.Columns.Add(bfSw); gridViewSummary.Columns.Add(bfCus); gridViewSummary.Columns.Add(bfDes); joboverviewJobType = new List<List<JobType>>(); foreach (Department d in joboverviewDepartment) //Creates the columns { var jobtypes = jobtypeDepartment.GetJobOverviewJobType(d.Id); joboverviewJobType.Add(jobtypes); DataColumn col = new DataColumn(d.Acronym + "" + d.Id, typeof(System.String)); table.Columns.Add(col); TemplateField tfield = new TemplateField(); tfield.HeaderText = d.Description; gridViewSummary.Columns.Add(tfield); } return table; }
protected void lnkBtn_Command(object sender, CommandEventArgs e) { if (e.CommandName == "JobOverviewDetails") { JobTracker j = new JobTracker(); j = j.GetJobTracker(Convert.ToInt32(e.CommandArgument),false); modalDetailLabelName.Text = j.fullname; modalDetailLabelJobType.Text = j.jobtype; modalDetailLabelJobStatus.Text = j.JobStatus; modalDetailLabelDate.Text = Convert.ToDateTime(j.ScheduleDate).ToString("dd-MMM-yyyy"); modalDetailLabelStartTime.Text = Convert.ToDateTime(j.StartTime).ToString("hh:mm tt"); modalDetailLabelEndTime.Text = Convert.ToDateTime(j.EndTime).ToString("hh:mm tt"); modalDetailTxtBoxRemarks.Text = j.Remarks; this.programmaticModalPopupDetail.Show(); } else if (e.CommandName == "JobOverviewSummary") { JobTypeDepartment jobtypeDepartment = new JobTypeDepartment(); JobTracker jobtracker = new JobTracker(); string argument = e.CommandArgument.ToString(); string[] s = argument.Split('|'); var jobtypes = jobtypeDepartment.GetJobOverviewJobType(Convert.ToInt32(s[0])); Dictionary<string, string> repeaterdata = new Dictionary<string, string>(); for (int i = 0; i < jobtypes.Count; i++) { JobTracker j = jobtracker.GetJobTrackerJobOverview(jobtypes[i].Id, s[2], s[1], Convert.ToDateTime(txtBoxStartDate.Text + " 00:00:00"), Convert.ToDateTime(txtBoxEndDate.Text + " 23:59:59"), Convert.ToInt32(s[0])); if (j == null) { repeaterdata.Add(jobtypes[i].Description, ""); } else { repeaterdata.Add(jobtypes[i].Description, j.JobStatus + " " + Convert.ToDateTime(j.EndTime).ToString("dd-MMM-yyyy")); } } modalSummaryRepeater.DataSource = repeaterdata; modalSummaryRepeater.DataBind(); programmaticModalPopupSummary.Show(); } }