protected void gridViewDetail_RowCreated(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.Header)
     {
         GridViewRow gvr = new GridViewRow(0, 0, DataControlRowType.Header, DataControlRowState.Normal);
         TableHeaderCell thc = new TableHeaderCell();
         thc.ColumnSpan = 4;
         thc.Text = "General Info";
         //thc.BackColor = System.Drawing.Color.Yellow;
         gvr.Cells.Add(thc);
         System.Drawing.Color backcolor = System.Drawing.ColorTranslator.FromHtml("#164BDB");
         System.Drawing.Color forecolor = System.Drawing.Color.White;
         Department dept = new Department();
         JobTypeDepartment jobtypeDepartment = new JobTypeDepartment();
         //var departments = dept.GetJobOverviewDepartment();
         int rowIndex = 4;
         for (int i = 0; i < joboverviewDepartment.Count; i++)
         {
             if (i % 2 != 0)
             {
                 backcolor = System.Drawing.ColorTranslator.FromHtml("#0D72FF");
                 //forecolor = System.Drawing.ColorTranslator.FromHtml("#2e6e9e");
                 forecolor = System.Drawing.Color.White;
             }
             else
             {
                 backcolor = System.Drawing.ColorTranslator.FromHtml("#164BDB");
                 forecolor = System.Drawing.Color.White;
             }
             //var jobtypes = jobtypeDepartment.GetJobOverviewJobType(joboverviewDepartment[i].Id);
             if (joboverviewJobType[i].Count > 0)
             {
                 thc = new TableHeaderCell();
                 thc.BackColor = backcolor;
                 thc.ForeColor = forecolor;
                 thc.ColumnSpan = joboverviewJobType[i].Count;
                 thc.Text = joboverviewDepartment[i].Description;
                 gvr.Cells.Add(thc);
             }
             for (int x = 0; x < joboverviewJobType[i].Count; x++)
             {
                 e.Row.Cells[rowIndex].BackColor = backcolor;
                 e.Row.Cells[rowIndex].ForeColor = forecolor;
                 rowIndex++;
             }
         }
         gridViewDetail.Controls[0].Controls.AddAt(0, gvr);
     }
 }
        public List<Analysis> GetAnalysis(int departmentid, DateTime startdate, DateTime enddate, string stringjobid,string customer,int roleid)
        {
            List<Analysis> data = new List<Analysis>();
            JobTracker jobtracker = new JobTracker();
            List<JobTracker> joblist = new List<JobTracker>();
            JobTypeDepartment jobtypeDepartment = new JobTypeDepartment();
            List<JobType> jobtypelist = new List<JobType>();
            if (departmentid == 0)
            {
                //joblist = jobtracker.GetJobTrackerForAnalysis(startdate, enddate);
                JobType jobtype = new JobType();
                jobtypelist = jobtype.GetJobTypeListByRoleId(roleid);
            }
            else
            {
                //joblist = jobtracker.GetJobTrackerForAnalysis(departmentid, startdate, enddate);
                jobtypelist = jobtypeDepartment.GetJobTypeList(departmentid);
            }
            for (int i = 0; i < jobtypelist.Count; i++)
            {
                Analysis newAnalysis = new Analysis();
                newAnalysis.jobtype = jobtypelist[i].Description;
                newAnalysis.jobtypeid = jobtypelist[i].Id.ToString();
                newAnalysis.totalworktime = jobtracker.GetTotalHours(jobtypelist[i].Id, startdate, enddate, "Approved", departmentid, stringjobid,customer);
                newAnalysis.totalforapproval = jobtracker.GetTotalHours(jobtypelist[i].Id, startdate, enddate, "For Approval", departmentid, stringjobid,customer);
                newAnalysis.totaljobTime = "";
                if (stringjobid.Trim() != "" || customer.Trim() != "")
                {
                    newAnalysis.totaljobTime = jobtracker.GetTotalHours(jobtypelist[i].Id, Convert.ToDateTime("1900-01-01"), DateTime.Now, "Approved", departmentid, stringjobid, customer);
                }
                //newAnalysis.totalrejectedtime = jobtracker.GetTotalHours(jobtypelist[i].Id, startdate, enddate, "Rejected", departmentid, stringjobid,customer);
                //newAnalysis.totalunclosedjobs = jobtracker.GetTotalUnclosedJobs(jobtypelist[i].Id, startdate, enddate, "Pending", departmentid, stringjobid).ToString();
                data.Add(newAnalysis);
            }

            return data;
        }
        private void GenerateSummaryRows(ref DataTable table)
        {
            Department dept = new Department();
            JobTypeDepartment jobtypeDepartment = new JobTypeDepartment();
            JobTracker jobtracker = new JobTracker();
            //joboverviewDepartment = dept.GetJobOverviewDepartment();
            distincProjectList = jobtracker.GetDistinctProjectList(Convert.ToDateTime(txtBoxStartDate.Text + " 00:00:00"), Convert.ToDateTime(txtBoxEndDate.Text + " 23:59:59"), txtBoxJobId.Text.Trim());
            joboverviewRow = new List<List<List<JobTracker>>>();
            for (int y = 0; y < distincProjectList.Count;y++ )
            {
                joboverviewRow.Add(new List<List<JobTracker>>());
                DataRow row = table.NewRow();
                row["HW No"] = distincProjectList[y].HWNo == null ? "" : distincProjectList[y].HWNo.Trim();
                row["SW No"] = distincProjectList[y].SWNo == null ? "" : distincProjectList[y].SWNo.Trim();
                row["Customer"] = distincProjectList[y].Customer == null ? "" : distincProjectList[y].Customer.Trim();
                row["Description"] = distincProjectList[y].Description == null ? "" : distincProjectList[y].Description.Trim();
                for (int x = 0; x < joboverviewDepartment.Count; x++)
                {
                    List<JobTracker> jtlist = new List<JobTracker>();
                    for (int i = 0; i < joboverviewJobType[x].Count; i++)
                    {
                        JobTracker l = jobtracker.GetJobTrackerJobOverview(joboverviewJobType[x][i].Id, distincProjectList[y].SWNo, distincProjectList[y].HWNo, Convert.ToDateTime(txtBoxStartDate.Text + " 00:00:00"), Convert.ToDateTime(txtBoxEndDate.Text + " 23:59:59"), joboverviewDepartment[x].Id);
                        jtlist.Add(l);
                    }
                    joboverviewRow[y].Add(jtlist);
                    JobTracker j = new JobTracker();
                    string curstatus = "";
                    int curindex = -1;
                    for (int i = 0; i < jtlist.Count; i++)
                    {
                        if (jtlist[i] == null)
                            continue;
                        else if (jtlist[i].JobStatus.IndexOf("On Hold") > -1)
                        {
                            curstatus = "On Hold";
                            curindex = i;

                            break;
                        }
                        else if (jtlist[i].JobStatus.IndexOf("In Progress") > -1)
                        {
                            if (curstatus != "In Progress")
                            {
                                curstatus = "In Progress";
                                curindex = i;
                            }
                        }
                        else if (jtlist[i].JobStatus.IndexOf("Completed") > -1 && curindex < 0)
                        {
                            if (curstatus == "")
                            {
                                curstatus = "Completed";
                                curindex = i;
                            }
                        }
                    }
                    if (curindex != -1)
                    {
                        j = jtlist[curindex];
                    }
                    //JobTracker j = jobtracker.GetJobTrackerJobOverview(p.SWNo, p.HWNo, Convert.ToDateTime(txtBoxStartDate.Text + " 00:00:00"), Convert.ToDateTime(txtBoxEndDate.Text + " 23:59:59"), d.Id);
                    if (j == null)
                    {
                        row[joboverviewDepartment[x].Acronym + "" + joboverviewDepartment[x].Id] = "";
                    }
                    else
                    {
                        row[joboverviewDepartment[x].Acronym + "" + joboverviewDepartment[x].Id] = joboverviewDepartment[x].Id + "|" + j.JobStatus + " " + Convert.ToDateTime(j.EndTime).ToString("dd-MMM-yyyy") + "|" + distincProjectList[y].HWNo + "|" + distincProjectList[y].SWNo;
                    }
                }
                table.Rows.Add(row);
            }
        }
        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;
        }
        private void GenerateDetailsRows(ref DataTable table)
        {
            Department dept = new Department();
            JobTypeDepartment jobtypeDepartment = new JobTypeDepartment();
            JobTracker jobtracker = new JobTracker();
            //var departments = dept.GetJobOverviewDepartment();
            //var distinctProjectList = jobtracker.GetDistinctProjectList(Convert.ToDateTime(txtBoxStartDate.Text + " 00:00:00"), Convert.ToDateTime(txtBoxEndDate.Text + " 23:59:59"), txtBoxJobId.Text.Trim());

            for (int y = 0; y < distincProjectList.Count;y++ )
            {
                DataRow row = table.NewRow();
                row["HW No"] = distincProjectList[y].HWNo == null ? "" : distincProjectList[y].HWNo.Trim();
                row["SW No"] = distincProjectList[y].SWNo == null ? "" : distincProjectList[y].SWNo.Trim();
                row["Customer"] = distincProjectList[y].Customer == null ? "" : distincProjectList[y].Customer.Trim();
                row["Description"] = distincProjectList[y].Description == null ? "" : distincProjectList[y].Description.Trim();
                for (int x = 0; x < joboverviewDepartment.Count; x++)
                {
                    //var jobtypes = jobtypeDepartment.GetJobOverviewJobType(d.Id);
                    for (int i = 0; i < joboverviewJobType[x].Count; i++)
                    {
                        //JobTracker j = jobtracker.GetJobTrackerJobOverview(joboverviewJobType[x][i].Id, p.SWNo, p.HWNo, Convert.ToDateTime(txtBoxStartDate.Text + " 00:00:00"), Convert.ToDateTime(txtBoxEndDate.Text + " 23:59:59"), joboverviewDepartment[x].Id);
                        if (joboverviewRow[y][x][i] == null)
                        {
                            row[joboverviewJobType[x][i].Acronym + "" + joboverviewDepartment[x].Id] = "";
                        }
                        else
                        {
                            row[joboverviewJobType[x][i].Acronym + "" + joboverviewDepartment[x].Id] = joboverviewRow[y][x][i].Id + "|" + joboverviewRow[y][x][i].JobStatus + " " + Convert.ToDateTime(joboverviewRow[y][x][i].EndTime).ToString("dd-MMM-yyyy");
                        }
                    }
                }
                table.Rows.Add(row);
            }
        }
        private DataTable GenerateDetailsColumns()
        {
            DataTable table = new DataTable();

            Department dept = new Department();
            JobTypeDepartment jobtypeDepartment = new JobTypeDepartment();
            //var departments = 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";

            gridViewDetail.Columns.Add(bfHw);
            gridViewDetail.Columns.Add(bfSw);
            gridViewDetail.Columns.Add(bfCus);
            gridViewDetail.Columns.Add(bfDes);

            //joboverviewJobType = new List<List<JobType>>();
            for (int x = 0; x < joboverviewDepartment.Count;x++ ) //Creates the columns
            {
                //var jobtypes = jobtypeDepartment.GetJobOverviewJobType(joboverviewDepartment[x].Id);
                //joboverviewJobType.Add(jobtypes);
                for (int i = 0; i < joboverviewJobType[x].Count; i++)
                {
                    DataColumn col = new DataColumn(joboverviewJobType[x][i].Acronym + "" + joboverviewDepartment[x].Id, typeof(System.String));
                    table.Columns.Add(col);

                    TemplateField tfield = new TemplateField();
                    tfield.HeaderText = joboverviewJobType[x][i].Acronym;
                    gridViewDetail.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();
     }
 }
        protected void InitializeGridViewJobType()
        {
            GetMyAccessRights();
            if (myAccessRights.CanAdd == true)
                linkBtnAdd.Visible = true;
            else
                linkBtnAdd.Visible = false;
            JobTypeDepartment jobtypeDepartment = new JobTypeDepartment();
            JobType jobtype = new JobType();
            List<JobType> jobtypeList = new List<JobType>();

            if (dropDownListDepartment.SelectedItem.Text == "All")
                jobtypeList = jobtype.GetJobTypeList();
            else
                jobtypeList = jobtypeDepartment.GetJobTypeList(Convert.ToInt32(dropDownListDepartment.SelectedItem.Value));

            gridViewJobType.DataSource = jobtypeList;
            gridViewJobType.DataBind();
        }
        private void JobTypeDepartmentAction(int jobtypeid)
        {
            JobTypeDepartment jobtypedepartment = new JobTypeDepartment();
            for (int i = 0; i < modalGridViewDepartment.Rows.Count; i++)
            {
                Label labelDeptId = (Label)modalGridViewDepartment.Rows[i].FindControl("modalLabelDepartmentId");
                CheckBox cbSelect = (CheckBox)modalGridViewDepartment.Rows[i].FindControl("modalChkBoxSelect");
                TextBox tbPosition = (TextBox)modalGridViewDepartment.Rows[i].FindControl("modalTxtBoxDeptPosition");

                if (cbSelect.Checked == false && labelDeptId.ToolTip != "ToolTip") //Delete
                {
                    jobtypedepartment.Delete(Convert.ToInt32(labelDeptId.ToolTip));
                }
                else if (cbSelect.Checked == true && labelDeptId.ToolTip == "ToolTip") //Add
                {
                    jobtypedepartment.DepartmentId = Convert.ToInt32(labelDeptId.Text);
                    jobtypedepartment.Position = Convert.ToInt32(tbPosition.Text.Trim() == "" ? modalTxtBoxPosition.Text : tbPosition.Text);
                    jobtypedepartment.JobTypeId = jobtypeid;
                    jobtypedepartment.Insert(jobtypedepartment);
                }
                else if (cbSelect.Checked == true && labelDeptId.ToolTip != "ToolTip") //Update
                {
                    jobtypedepartment.Id = Convert.ToInt32(labelDeptId.ToolTip);
                    jobtypedepartment.DepartmentId = Convert.ToInt32(labelDeptId.Text);
                    jobtypedepartment.Position = Convert.ToInt32(tbPosition.Text.Trim() == "" ? modalTxtBoxPosition.Text : tbPosition.Text);
                    jobtypedepartment.JobTypeId = jobtypeid;
                    jobtypedepartment.Update(jobtypedepartment);
                }
            }
        }
 private void InitializeModalDepartmentCheckBox(int jobtypeid)
 {
     JobTypeDepartment jobtypeDepartment = new JobTypeDepartment();
     var jobdeptlist = jobtypeDepartment.GetJobTypeDepartmentListByJobType(jobtypeid);
     for (int i = 0; i < modalGridViewDepartment.Rows.Count; i++)
     {
         Label labelDeptId = (Label)modalGridViewDepartment.Rows[i].FindControl("modalLabelDepartmentId");
         CheckBox cbSelect = (CheckBox)modalGridViewDepartment.Rows[i].FindControl("modalChkBoxSelect");
         TextBox tbPosition = (TextBox)modalGridViewDepartment.Rows[i].FindControl("modalTxtBoxDeptPosition");
         for (int j = 0; j < jobdeptlist.Count; j++)
         {
             if (labelDeptId.Text.Trim() == jobdeptlist[j].DepartmentId.ToString())
             {
                 cbSelect.Checked = true;
                 tbPosition.Text = jobdeptlist[j].Position == null ? "" : jobdeptlist[j].Position.ToString();
                 labelDeptId.ToolTip = jobdeptlist[j].Id.ToString();
                 jobdeptlist.RemoveAt(j);
                 break;
             }
         }
     }
 }
        public List<JobType> GetJobTypeListByRoleId(int roleid)
        {
            TimeTrackerEntities db = new TimeTrackerEntities();
            RoleDepartmentAccess deptAccess = new RoleDepartmentAccess();
            var deptlist = deptAccess.GetRoleDepartmentList(roleid);
            JobTypeDepartment jobtypeDept = new JobTypeDepartment();
            List<JobType> data = new List<JobType>();
            foreach (RoleDepartmentAccess r in deptlist)
            {
                var jobtypelist = jobtypeDept.GetJobTypeList(r.DepartmentId);
                //data.AddRange(jobtypelist);
                foreach(JobType j in jobtypelist)
                {
                    if (data.FirstOrDefault(d => d.Id == j.Id) == null)
                    {
                        data.Add(j);
                    }
                }
            }
            //data = data.Distinct().ToList();
            db.Dispose();

            return data;
        }
 public void Update(JobTypeDepartment jobtypedepartment)
 {
     using (TimeTrackerEntities db = new TimeTrackerEntities())
     {
         try
         {
             T_JobTypeDepartment t_jobtypedepartment = db.T_JobTypeDepartment.FirstOrDefault(d => d.Id == jobtypedepartment.Id);
             t_jobtypedepartment.JobTypeId = jobtypedepartment.JobTypeId;
             t_jobtypedepartment.DepartmentId = jobtypedepartment.DepartmentId;
             t_jobtypedepartment.Position = jobtypedepartment.Position;
             db.SaveChanges();
         }
         catch (Exception ex)
         {
             string msg = ex.Message;
         }
     }
 }
        public void Insert(JobTypeDepartment jobtypedepartment)
        {
            T_JobTypeDepartment t_jobtypedepartment = new T_JobTypeDepartment();
            t_jobtypedepartment.JobTypeId = jobtypedepartment.JobTypeId;
            t_jobtypedepartment.DepartmentId = jobtypedepartment.DepartmentId;
            t_jobtypedepartment.Position = jobtypedepartment.Position;

            using (TimeTrackerEntities db = new TimeTrackerEntities())
            {
                try
                {
                    db.T_JobTypeDepartment.Add(t_jobtypedepartment);
                    db.SaveChanges();
                }
                catch (Exception ex)
                {
                    string msg = ex.Message;
                }
            }
        }
 protected void InitializeModalDropDownJobType(int departmentId,string selectedvalue = "")
 {
     JobTypeDepartment jobtypeDepartment = new JobTypeDepartment();
     List<JobType> jobTypelist = new List<JobType>();
     jobTypelist = jobtypeDepartment.GetJobTypeList(departmentId);
     modalDropDownJobType.DataSource = jobTypelist;
     modalDropDownJobType.DataTextField = "Description";
     modalDropDownJobType.DataValueField = "Id";
     modalDropDownJobType.DataBind();
     if (selectedvalue != null && selectedvalue.Trim() != "")
     {
         foreach (ListItem i in modalDropDownJobType.Items)
         {
             if (i.Value.Trim() == selectedvalue.Trim())
             {
                 i.Selected = true;
                 break;
             }
         }
     }
 }
        //protected void InitializeModal()
        //{
        //    JobType jobtype = new JobType();
        //    var data = jobtype.GetJobTypeList(Convert.ToInt32(Session["DepartmentId"]));
        //    modalDropDownJobType.DataSource = data;
        //    modalDropDownJobType.DataTextField = "Description";
        //    modalDropDownJobType.DataValueField = "Id";
        //    modalDropDownJobType.DataBind();
        //    Time time = new Time();
        //    var starttime = time.GetStartTimeList();
        //    modalDropDownStartTime.DataSource = starttime;
        //    modalDropDownStartTime.DataTextField = "Description";
        //    modalDropDownStartTime.DataValueField = "C24hrConversion";
        //    modalDropDownStartTime.DataBind();
        //    bool hasSelected = false;
        //    foreach (ListItem i in modalDropDownStartTime.Items)
        //    {
        //        TimeSpan selectedTime = TimeSpan.Parse(i.Value);
        //        TimeSpan curtime = TimeSpan.Parse(DateTime.Now.Hour + ":" + DateTime.Now.Minute);
        //        if (selectedTime >= curtime && hasSelected == false)
        //        {
        //            i.Selected = true;
        //            hasSelected = true;
        //        }
        //        else
        //            i.Selected = false;
        //    }
        //    var endtime = time.GetEndTimeList(modalDropDownStartTime.SelectedValue);
        //    modalDropDownEndTime.DataSource = endtime;
        //    modalDropDownEndTime.DataTextField = "Description";
        //    modalDropDownEndTime.DataValueField = "C24hrConversion";
        //    modalDropDownEndTime.DataBind();
        //}
        private void InitializeModalJobType(string value = "")
        {
            JobTypeDepartment jobtypeDepartment = new JobTypeDepartment();
            var data = jobtypeDepartment.GetJobTypeList(Convert.ToInt32(Session["DepartmentId"]));
            modalDropDownJobType.DataSource = data;
            modalDropDownJobType.DataTextField = "Description";
            modalDropDownJobType.DataValueField = "Id";
            modalDropDownJobType.DataBind();
            if (value.Trim() != "")
            {
                foreach (ListItem i in modalDropDownJobType.Items)
                {
                    if (i.Value.Trim() == value.Trim())
                    {
                        i.Selected = true;

                        //if (jobType != null)
                        //{
                        //    //modalTxtBoxJobId.Enabled = Convert.ToBoolean(jobType.RequiredJobId);
                        //    modalReqJobId.Enabled = Convert.ToBoolean(jobType.RequiredJobId);
                        //}
                        //if (modalTxtBoxJobId.Enabled == false)
                        //{
                        //    modallabelCustomer.Text = "";
                        //    modallabelBoxJobDescription.Text = "";
                        //    modalTxtBoxJobId.Text = "";
                        //    modalLabelError.Visible = false;
                        //}
                        break;
                    }
                }
            }
            int jobtypeId = Convert.ToInt32(modalDropDownJobType.SelectedValue);
            JobType jobType = new JobType();
            jobType = jobType.GetJobType(jobtypeId);
            if (jobType != null)
            {
                modalReqJobId.Enabled = Convert.ToBoolean(jobType.RequiredJobId);
                modalReqJobStatus.Enabled = Convert.ToBoolean(jobType.ComputeTime); //If time is computed, require Job Status, otherwise do not require it.
                //modalDropDownJobStatus.Enabled = Convert.ToBoolean(jobType.RequiredJobId);
            }
        }