public List<JobType> GetAvailableJobTypeForJobFlow() { TimeTrackerEntities db = new TimeTrackerEntities(); Department dept = new Department(); var deptlist = dept.GetDepartmentList(); int deptCount = deptlist.Count; var data = (from j in db.T_JobType where j.M_JobTypeFlows.Count < deptCount orderby j.Position select new JobType() { Id = j.Id, Description = j.Description, CreatedBy = j.CreatedBy, LastUpdatedBy = j.LastUpdatedBy, CreateDate = j.CreateDate, LastUpdateDate = j.LastUpdateDate, RequiredJobId = j.RequiredJobId, ComputeTime = j.ComputeTime, Position = j.Position, ShowInJobOverview = j.ShowInJobOverview, Acronym = j.Acronym, IsDefaultBreak = j.IsDefaultBreak }).ToList(); db.Dispose(); return data; }
protected void InitializeModalDropDownDepartment(string value = "") { Department department = new Department(); var departmentList = department.GetDepartmentList(); if (departmentList.Count > 0) { if (departmentList[0].Description == "All") departmentList.RemoveAt(0); } modalDropDownDepartment.DataSource = departmentList; modalDropDownDepartment.DataTextField = "Description"; modalDropDownDepartment.DataValueField = "Id"; modalDropDownDepartment.DataBind(); if (value != null && value.Trim() != "") { foreach (ListItem i in modalDropDownDepartment.Items) { if (value.Trim() == i.Value.ToString().Trim()) { i.Selected = true; break; } } } }
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); } }
protected void InitializeDropDownDepartment() { Department department = new Department(); var departmentList = department.GetDepartmentList(); if (departmentList.Count > 1) { department.Description = "All"; department.Id = 0; departmentList.Insert(0, department); } dropDownListDepartment.DataSource = departmentList; dropDownListDepartment.DataTextField = "Description"; dropDownListDepartment.DataValueField = "Id"; dropDownListDepartment.DataBind(); }
protected void InitializeGridViewDepartment() { GetMyAccessRights(); if (myAccessRights.CanAdd == true) linkBtnAdd.Visible = true; else linkBtnAdd.Visible = false; Department department = new Department(); List<Department> deptlist = new List<Department>(); deptlist = department.GetDepartmentList(); if (deptlist.Count > 0) { if (deptlist[0].Description == "All") deptlist.RemoveAt(0); } gridViewDepartment.DataSource = deptlist; gridViewDepartment.DataBind(); }
protected void gridViewDepartment_Command(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "Select") { GetMyAccessRights(); modalLabelError.Text = ""; modalLabelError.Visible = false; int index = Convert.ToInt32(e.CommandArgument); int departmentId = Convert.ToInt32(((Label)gridViewDepartment.Rows[index].FindControl("labelDepartmentId")).Text); modalBtnSubmit.CommandArgument = "Update"; Department department = new Department(); department = department.GetDepartment(departmentId); modalLabelDepartmentId.Text = department.Id.ToString(); modalTxtBoxDescription.Text = department.Description; modalTxtBoxAcronym.Text = department.Acronym; modalTxtBoxPosition.Text = department.Position.ToString(); this.programmaticModalPopup.Show(); } }
//Parsing done before Updating record in the database private void UpdateParse(T_Department t_department, Department department) { t_department.Description = department.Description; t_department.LastUpdateDate = department.LastUpdateDate; t_department.LastUpdatedBy = department.LastUpdatedBy; t_department.Position = department.Position; t_department.Acronym = department.Acronym; }
//Parsing done before Inserting record in the database private T_Department InsertParse(Department department) { T_Department t_department = new T_Department(); t_department.Description = department.Description; t_department.CreateDate = department.CreateDate; t_department.LastUpdateDate = department.LastUpdateDate; t_department.CreatedBy = department.CreatedBy; t_department.LastUpdatedBy = department.LastUpdatedBy; t_department.Position = department.Position; t_department.Acronym = department.Acronym; return t_department; }
//Update a department in the database public void Update(Department department) { using (TimeTrackerEntities db = new TimeTrackerEntities()) { try { T_Department t_department = db.T_Department.FirstOrDefault(d => d.Id == department.Id); UpdateParse(t_department, department); db.SaveChanges(); } catch (Exception ex) { string msg = ex.Message; } } }
//Insert new department in database public void Insert(Department department) { T_Department t_department = InsertParse(department); using (TimeTrackerEntities db = new TimeTrackerEntities()) { try { db.T_Department.Add(t_department); db.SaveChanges(); } catch (Exception ex) { string msg = ex.Message; } } }
protected void InitializeModalDropDownDepartment(string departmentId = "") { Department department = new Department(); var departmentList = department.GetDepartmentList(); modalDropDownDepartment.DataSource = departmentList; modalDropDownDepartment.DataTextField = "Description"; modalDropDownDepartment.DataValueField = "Id"; modalDropDownDepartment.DataBind(); if (departmentId != null && departmentId.Trim() != "") { foreach (ListItem i in modalDropDownDepartment.Items) { if (departmentId.Trim() == i.Value.Trim()) { i.Selected = true; break; } } } }
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 InitializeModalGridViewDepartment(int jobtypeid = 0) { Department department = new Department(); var departmentList = department.GetDepartmentList(); modalGridViewDepartment.DataSource = departmentList; modalGridViewDepartment.DataBind(); if (jobtypeid > 0) { InitializeModalDepartmentCheckBox(jobtypeid); if (modalGridViewDepartment.Rows.Count > 1) modalChkboxAll.Visible = true; else modalChkboxAll.Visible = false; } }
private void InitializeModalDepartment() { modalBtnAdd.Visible = true; Department department = new Department(); List<Department> deptlist = new List<Department>(); int selectedjobTypeId = Convert.ToInt32(modalDropDownJobType.SelectedValue); deptlist = department.GetDepartmentList(); if (deptlist.Count > 0) { department.Id = 0; department.Description = "All"; department.Position = 0; department.Acronym = "All"; deptlist.Insert(0, department); } for (int i = 0; i < gridViewModal.Rows.Count; i++) { Label labelJobTypeId = (Label)gridViewModal.Rows[i].FindControl("modalLabelJobTypeId"); Label labelDeptId = (Label)gridViewModal.Rows[i].FindControl("modalLabelDepartmentId"); int deptId = labelDeptId.Text.Trim() == "" ? 0 : Convert.ToInt32(labelDeptId.Text); int jobtypeId = labelJobTypeId.Text.Trim() == "" ? 0 : Convert.ToInt32(labelJobTypeId.Text); for (int j = 0; j < deptlist.Count; j++) { if (deptlist[j].Id == deptId && selectedjobTypeId == jobtypeId) { deptlist.RemoveAt(j); break; } } } if (deptlist.Count == 0) { modalBtnAdd.Visible = false; } modalDropDownDepartment.DataSource = deptlist; modalDropDownDepartment.DataTextField = "Description"; modalDropDownDepartment.DataValueField = "Id"; modalDropDownDepartment.DataBind(); }
protected void modalBtnSubmit_Command(object sender, CommandEventArgs e) { if (modalLabelError.Visible == true) this.programmaticModalPopup.Show(); else { int userid = Convert.ToInt32(Session["UserId"]); Department department = new Department(); if (modalLabelDepartmentId.Text.Trim() != "") { department = department.GetDepartment(Convert.ToInt32(modalLabelDepartmentId.Text)); } department.Description = modalTxtBoxDescription.Text.Trim(); department.Acronym = modalTxtBoxAcronym.Text.Trim(); department.Position = Convert.ToInt32(modalTxtBoxPosition.Text); department.LastUpdateDate = DateTime.Now; department.LastUpdatedBy = userid; if (e.CommandArgument.ToString() == "Add") { department.CreateDate = DateTime.Now; department.CreatedBy = userid; department.Insert(department); } else if(e.CommandArgument.ToString() == "Update") { department.Update(department); } InitializeGridViewDepartment(); } }
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; }
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); } }
protected void InitializeBottomDropDownDepartment() { ddlBottomDepartment.Enabled = true; int roleid = Convert.ToInt32(Session["RoleId"]); RoleDepartmentAccess departmentAccess = new RoleDepartmentAccess(); var departmentlist = departmentAccess.GetRoleDepartmentList(roleid); if (departmentlist.Count > 1) { departmentAccess.DepartmentId = 0; departmentAccess.department = "All"; departmentlist.Insert(0, departmentAccess); } else if (departmentlist.Count < 1) { int userid = Convert.ToInt32(Session["UserId"]); Department department = new Department(); User user = new User(); user = user.GetUser(userid); department = department.GetDepartment(Convert.ToInt32(user.DepartmentId)); departmentAccess.DepartmentId = department.Id; departmentAccess.department = department.Description; departmentlist.Insert(0, departmentAccess); ddlBottomDepartment.Enabled = false; } ddlBottomDepartment.DataSource = departmentlist; ddlBottomDepartment.DataTextField = "department"; ddlBottomDepartment.DataValueField = "DepartmentId"; ddlBottomDepartment.DataBind(); }
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 void InitializeModalGridViewDepartment(int roleid = 0) { Department department = new Department(); var departmentList = department.GetDepartmentList(); modalGridViewDepartment.DataSource = departmentList; modalGridViewDepartment.DataBind(); if (roleid > 0) { InitializeModalDepartmentCheckBox(roleid); if (modalGridViewDepartment.Rows.Count > 1) modalChkboxAll.Visible = true; else modalChkboxAll.Visible = false; } else { for (int i = 0; i < modalGridViewDepartment.Rows.Count; i++) { CheckBox cb = (CheckBox)modalGridViewDepartment.Rows[i].FindControl("modalChkBoxSelect"); cb.Checked = false; } } }