private DataTable GenerateFlowColumns()
        {
            DataTable table = new DataTable();

            JobFlow jobflow = new JobFlow();
            JobTypeFlow jobtypeflow = new JobTypeFlow();
            jobflowList = jobflow.GetJobOverviewJobFlow();
            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";

            gridViewJobFlow.Columns.Add(bfHw);
            gridViewJobFlow.Columns.Add(bfSw);
            gridViewJobFlow.Columns.Add(bfCus);
            gridViewJobFlow.Columns.Add(bfDes);
            jobtypeflowlist = new List<List<JobTypeFlow>>();
            for (int x = 0; x < jobflowList.Count;x++ ) //Creates the columns
            {
                var jobtypes = jobtypeflow.GetJobTypeFlowListByJobFlow(jobflowList[x].Id);
                jobtypeflowlist.Add(jobtypes);
                for (int i = 0; i < jobtypes.Count; i++)
                {
                    string deptacro = "";
                    if (jobtypes[i].DepartmentId != null)
                        deptacro = jobtypes[i].departmentAcronym;
                    DataColumn col = new DataColumn(jobtypes[i].jobtypeAcronym + deptacro + "" + jobflowList[x].Id, typeof(System.String));
                    table.Columns.Add(col);

                    TemplateField tfield = new TemplateField();
                    string sdept = "";
                    if (jobtypes[i].DepartmentId != null)
                        sdept = jobtypes[i].departmentAcronym + "-";
                    tfield.HeaderText = sdept + jobtypes[i].jobtypeAcronym;
                    gridViewJobFlow.Columns.Add(tfield);
                }
            }

            return table;
        }
        private void InitializeModalGridView()
        {
            JobTypeFlow jobtypeflow = new JobTypeFlow();
            int jobflowid = 0;
            if (modalLabelJobFlowId.Text.Trim() != "")
            {
                jobflowid = Convert.ToInt32(modalLabelJobFlowId.Text);
            }
            var data = jobtypeflow.GetJobTypeFlowListByJobFlow(jobflowid);
            gridViewModal.DataSource = data;
            gridViewModal.DataBind();

            for (int i = 0; i < gridViewModal.Rows.Count; i++)
            {
                CheckBox cb = (CheckBox)gridViewModal.Rows[i].FindControl("modalChkJobType");
                Label labelJobTypeId = (Label)gridViewModal.Rows[i].FindControl("modalLabelJobTypeId");
                Label labelDeptId = (Label)gridViewModal.Rows[i].FindControl("modalLabelDepartmentId");
                if (labelDeptId.Text.Trim() == "")
                {
                    Label labelDept = (Label)gridViewModal.Rows[i].FindControl("modalLabelDepartment");
                    labelDept.Text = "All";
                    labelDeptId.Text = "0";
                }
                labelJobTypeId.ToolTip = data[i].Id.ToString();
                labelDeptId.ToolTip = data[i].Id.ToString();
            }
            Session["JobFlows"] = data;
        }