private void LoadDocket(int pageIndex, int pageSize) { Business.Service.Docket objDocket = new Business.Service.Docket(); Entity.Service.Docket docket = new Entity.Service.Docket(); int assignEngineer = 0; string callStatusIds = string.Empty; callStatusIds = string.Concat(((int)CallStatusType.DocketClose).ToString(), ",", ((int)CallStatusType.DocketFunctional).ToString());//DOCKET CLOSE && FUNCTIONAL if (HttpContext.Current.User.IsInRole(Entity.HR.Utility.CUSTOMER_LIST_SHOW_ALL)) { assignEngineer = 0; } else { assignEngineer = int.Parse(HttpContext.Current.User.Identity.Name); } docket.CallStatusIds = callStatusIds; docket.AssignEngineer = assignEngineer; docket.PageIndex = pageIndex; docket.PageSize = pageSize; DataSet response = objDocket.Service_Docket_GetByCallStatusIds(docket); gvDocketAsync.DataSource = response.Tables[0]; gvDocketAsync.VirtualItemCount = (response.Tables[1].Rows.Count > 0) ? Convert.ToInt32(response.Tables[1].Rows[0]["TotalCount"].ToString()) : 10; gvDocketAsync.DataBind(); }
private List <Models.DocketModel> GetDocket(int employeeId) { List <Models.DocketModel> model = new List <Models.DocketModel>(); Business.Service.Docket objDocket = new Business.Service.Docket(); Entity.Service.Docket docket = new Entity.Service.Docket(); Business.HR.EmployeeMaster objEmployeeMaster = new Business.HR.EmployeeMaster(); Entity.HR.EmployeeMaster employeeMaster = new Entity.HR.EmployeeMaster(); DataTable dtEmployee = objEmployeeMaster.EmployeeMaster_ById(new Entity.HR.EmployeeMaster() { EmployeeMasterId = employeeId }); if (dtEmployee.AsEnumerable().Any()) { employeeMaster = objEmployeeMaster.AuthenticateUser(dtEmployee.Rows[0]["EmployeeCode"].ToString()); } int assignEngineer = 0; if (employeeMaster != null) { string[] roles = employeeMaster.Roles.Split(','); if (roles.Contains(Entity.HR.Utility.CUSTOMER_LIST_SHOW_ALL)) { assignEngineer = 0; } else { assignEngineer = employeeId; } } string callStatusIds = string.Empty; callStatusIds = string.Concat(((int)CallStatusType.DocketClose).ToString(), ",", ((int)CallStatusType.DocketFunctional).ToString());//DOCKET CLOSE && FUNCTIONAL docket.CallStatusIds = callStatusIds; docket.AssignEngineer = assignEngineer; DataTable response = objDocket.Service_Docket_GetAllByCallStatusIds(docket); if (response != null && response.AsEnumerable().Any()) { foreach (DataRow dr in response.Rows) { model.Add(new Models.DocketModel { AssignedEngineerName = string.Format("Assigned Engineer: {0}", dr["AssignedEngineerName"].ToString()), CallStatus = string.Format("Call Status: {0}", dr["CallStatus"].ToString()), ContactPerson = string.Format("Contact Person: {0}", dr["ContactPerson"].ToString()), CustomerName = string.Format("Customer Name: {0}", dr["CustomerName"].ToString()), DocketDateTime = string.Format("Docket Date & Time: {0}", Convert.ToDateTime(dr["DocketDate"].ToString()).ToString("dd MMM yyyy")), DocketNo = string.Format("Docket No: {0}", dr["DocketId"].ToString()), IsCallAttended = string.Format("Call Attended: {0}", (dr["IsCallAttended"].ToString().Equals("1")) ? "True" : "False"), ProductName = string.Format("Product Name: {0}", dr["ProductName"].ToString()) }); } } return(model); }