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; }
protected void InitializeGridViewBottom() { int userid = Convert.ToInt32(Session["UserId"]); bool isSingle = false; int roleid = Convert.ToInt32(Session["RoleId"]); RoleDepartmentAccess departmentAccess = new RoleDepartmentAccess(); var departmentlist = departmentAccess.GetRoleDepartmentList(roleid); if (departmentlist.Count < 1) { isSingle = true; } Analysis analysis = new Analysis(); List<Analysis> data = new List<Analysis>(); if (isSingle) data = analysis.GetAnalysis(Convert.ToDateTime(txtBoxBottomFromDate.Text), Convert.ToDateTime(txtBoxBottomToDate.Text), userid, txtBoxBottomJobId.Text.Trim(), txtBoxBottomCustomer.Text.Trim()); else { if (ddlBottomPersonel.Items.Count > 0) { if (ddlBottomPersonel.SelectedItem.Text.Trim() == "All") { data = analysis.GetAnalysis(Convert.ToInt32(ddlBottomDepartment.SelectedItem.Value), Convert.ToDateTime(txtBoxBottomFromDate.Text), Convert.ToDateTime(txtBoxBottomToDate.Text), txtBoxBottomJobId.Text.Trim(),txtBoxBottomCustomer.Text.Trim(), roleid); } else { data = analysis.GetAnalysis(Convert.ToDateTime(txtBoxBottomFromDate.Text), Convert.ToDateTime(txtBoxBottomToDate.Text), Convert.ToInt32(ddlBottomPersonel.SelectedItem.Value), txtBoxBottomJobId.Text.Trim(), txtBoxBottomCustomer.Text.Trim()); } } } gridViewBottom.DataSource = data; gridViewBottom.DataBind(); }