private SearchTicketsResponse GetResponse(bool isPageModel) { SearchTicketsRequest request = new SearchTicketsRequest( SearchTicketsType.TicketsForReport, string.Format(" {0} {1} ", OrderBy, OrderDirection), isPageModel); request.CurrentPage = CurrentPageIndex; request.PageCount = anpReport.PageSize; request.Keyword = txtKeyWord.Text.Trim().NoHTML(); if (UserInfo.Role == RolesEnum.CLIENT) { request.CompanyID = UserInfo.CompanyID; request.UserID = UserInfo.UserID; } else { request.CompanyID = 0; } request.TicketType = ddlTicketType.SelectedItem.Text.Trim(); request.ProjectID = int.Parse(ddlProject.SelectedValue); request.Status = fbmHandler.GetSearchTicketStatuses(int.Parse(ddlStatus.SelectedValue)); SearchTicketsResponse response = ticketAPP.SearchTickets(request); return(response); }
private int GetTicketReportCount() { SearchTicketsRequest request = new SearchTicketsRequest( SearchTicketsType.TicketsForReport, string.Format(" {0} {1} ", "ModifiedOn", "desc"), true); request.CurrentPage = 1; request.PageCount = 0; if (UserInfo.Role == RolesEnum.CLIENT) { request.CompanyID = UserInfo.CompanyID; request.UserID = UserInfo.UserID; } else { request.CompanyID = 0; } request.TicketType = "ALL"; request.Status = fbmHandler.GetSearchTicketStatuses(-1); request.Keyword = string.Empty; SearchTicketsResponse response = ticketAPP.SearchTickets(request); return(response.ResultCount); }
private void InitControl() { int category = QS("id", 0); if (category == 0) { ShowArgumentErrorMessageToClient(); return; } CateGoryEntity model = cgApp.GetCateGory(category); if (model == null || model.IsDelete == true) { ShowArgumentErrorMessageToClient(); Response.Redirect("/error.html?sourceurl=" + Request.Url.ToString()); } SearchTicketsRequest request = new SearchTicketsRequest(SearchTicketsType.CateGory, " OrderNum ASC ,Priority DESC,TicketTitle ASC ", true); request.SheetDate = request.SheetDate = ObjectFactory.GetInstance <ISystemDateTime>().Now.Date; request.CateGoryID = category; request.CurrentPage = anpTickets.CurrentPageIndex; SearchTicketsResponse response = tickApp.SearchTickets(request); rptTickets.DataSource = response.ResultList; rptTickets.DataBind(); anpTickets.RecordCount = response.ResultCount; }
private SearchTicketsResponse GetResponse(bool isPageModel, string projectID) { SearchTicketsRequest request = new SearchTicketsRequest( SearchTicketsType.TicketsForReport, string.Format(" {0} {1} ", hidOrderBy.Value, hidOrderDirection.Value), isPageModel); request.CurrentPage = anpTicketReport.CurrentPageIndex; request.PageCount = anpTicketReport.PageSize; request.Keyword = txtKeywords.Text.Trim().NoHTML(); if (UserInfo.Role == RolesEnum.CLIENT) { request.CompanyID = UserInfo.CompanyID; request.UserID = UserInfo.UserID; } else { request.CompanyID = 0; } if (int.Parse(ddlStatus.SelectedValue) == (int)ClientTicketState.Waiting_Feedback) { request.SearchTicketID = true; request.TicketIDS = fbmHandler.FeedBackRequiredTicketIDs; } request.TicketType = ddlTicketType.SelectedItem.Text.Trim(); request.ProjectID = int.Parse(projectID); request.Status = fbmHandler.GetSearchTicketStatuses(int.Parse(ddlStatus.SelectedValue)); SearchTicketsResponse response = tickApp.SearchTickets(request); return(response); }
private void InitControl() { CateGoryEntity model = CurrentModel; if (model == null || model.IsDelete == true) { Response.Redirect(ErrorPageUrl); } SetControlsStatus(model); SearchTicketsRequest request = new SearchTicketsRequest(SearchTicketsType.CateGory, " OrderNum ASC ,Priority DESC,TicketTitle ASC ", false); request.OrderBy = string.Format("{0} {1}", OrderBy, OrderDirection); request.SheetDate = request.SheetDate = ObjectFactory.GetInstance <ISystemDateTime>().Now.Date; request.CateGoryID = model.GID; request.CurrentPage = CurrentPageIndex; SearchTicketsResponse response = tickApp.SearchTickets(request); if (response.ResultList != null && response.ResultList.Count > 0) { rptTicketsList.DataSource = response.ResultList; rptTicketsList.DataBind(); trNoTickets.Visible = false; } else { trNoTickets.Visible = true; rptTicketsList.Visible = false; } }
public SearchTicketsResponse SearchTickets(SearchTicketsRequest request) { this.ClearBrokenRuleMessages(); SearchTicketsResponse response = ticketRepository.SearchTickets(request); if (response.IsError) { this.AddBrokenRuleMessage(); } return(response); }
private void BindTickets() { if (ddlProject.SelectedValue == "0") { ddlTickets.Items.Add(new ListItem("All", "0")); } else { TicketsApplication tickApp = new TicketsApplication(); SearchTicketsRequest request = new SearchTicketsRequest(SearchTicketsType.TicketsListByPID, " TicketTitle Asc", false); request.ProjectID = int.Parse(ddlProject.SelectedValue); SearchTicketsResponse response = tickApp.SearchTickets(request); response.ResultList.BindDropdown <ExpandTicketsEntity>(ddlTickets, "Title", "ID", "All", "0"); } }
protected void ddlProject_SelectedIndexChanged(object sender, EventArgs e) { ddlTickets.Items.Clear(); if (ddlProject.SelectedValue == "0") { ddlTickets.Items.Add(new ListItem("All", "0")); } else { TicketsApplication tickApp = new TicketsApplication(); SearchTicketsRequest request = new SearchTicketsRequest(SearchTicketsType.TicketsListByPID, " TicketTitle Asc", false); request.ProjectID = int.Parse(ddlProject.SelectedValue); SearchTicketsResponse response = tickApp.SearchTickets(request); response.ResultList.BindDropdown <ExpandTicketsEntity>(ddlTickets, "Title", "ID", "All", "0"); } }
private SearchTicketsResponse GetTicketsByProject(int projID, DateTime sheetDate) { SearchTicketsRequest request = new SearchTicketsRequest(SearchTicketsType.TicketsForTimesheets, "TicketTitle ASC ", false); request.SheetDate = sheetDate; request.UserID = IdentityContext.UserID; request.ProjectID = projID; request.OrderBy = "TicketID"; List <TicketsState> listStatus = TicketsStateHelper.TimeSheetStates; request.Status = listStatus; TicketsApplication tickApp = new TicketsApplication(); SearchTicketsResponse response = tickApp.SearchTickets(request); return(response); }
private void TicketsDataBind() { SearchTicketsResponse response = GetResponse(true); if (response.IsError || response.ResultList == null || response.ResultList.Count == 0) { trNoTickets.Visible = true; rptTicketsList.Visible = false; } else { trNoTickets.Visible = false; rptTicketsList.Visible = true; rptTicketsList.DataSource = response.ResultList; rptTicketsList.DataBind(); anpReport.RecordCount = response.ResultCount; } }
private void InitControls() { if (ddlProjects.SelectedValue == "0") { trNoTickets.Visible = true; } else { int projectID = 0; if (int.TryParse(ddlProjects.SelectedValue, out projectID) && projectID > 0) { SearchTicketsRequest request = new SearchTicketsRequest(SearchTicketsType.Priority, " OrderNum ASC ,Priority DESC,TicketTitle ASC ", false); request.SheetDate = ObjectFactory.GetInstance <ISystemDateTime>().Now.Date; request.ProjectID = projectID; SearchTicketsResponse response = ticketApp.SearchTickets(request); if (response.ResultList == null || response.ResultList.Count <= 0) { rptTickets.Visible = false; trNoTickets.Visible = true; } else { rptTickets.Visible = true; rptTickets.DataSource = response.ResultList; rptTickets.DataBind(); trNoTickets.Visible = false; } } else { rptTickets.Visible = false; trNoTickets.Visible = true; } } }
private string GetTicketsByProject(int projID, DateTime sheetDate) { SearchTicketsRequest request = new SearchTicketsRequest(SearchTicketsType.TicketsForTimesheets, "TicketTitle ASC ", false); request.SheetDate = sheetDate; request.UserID = IdentityContext.UserID; request.ProjectID = projID; List <TicketsState> listStatus = TicketsStateHelper.TimeSheetStates; request.Status = listStatus; TicketsApplication tickApp = new TicketsApplication(); SearchTicketsResponse response = tickApp.SearchTickets(request); if (!response.IsError) { string json = UtilFactory.Helpers.JSONHelper.GetJson <List <ExpandTicketsEntity> >(response.ResultList); return(json); } else { return("[]"); } }
private void ExportExcel() { Response.ContentType = "application/vnd.ms-excel"; string datetime = DateTime.Now.ToString().Replace("/", "").Replace(" ", "").Replace(":", ""); string projectName = "ALL"; projectName = ddlProject.SelectedValue == "0" ? projectName : ddlProject.SelectedItem.Text; string ticketType = "ALL"; ticketType = ddlTicketType.SelectedValue == "-1" ? ticketType : ddlTicketType.SelectedItem.Text; string ticketStatu = "ALL"; ticketStatu = ddlStatus.SelectedValue == "-1" ? ticketStatu : ddlStatus.SelectedItem.Text; string filename = string.Empty; if (projectName == "ALL" && ticketType == "ALL" && ticketStatu == "ALL") { filename = string.Format("ALL_{0}.xls", datetime); } else { projectName = projectName == "ALL" ? "AllProject" : projectName; ticketType = ticketType == "ALL" ? "ALLType" : ticketType; ticketStatu = ticketStatu == "ALL" ? "ALLStatus" : ticketStatu; filename = string.Format("{0}_{1}_{2}.xls", projectName, ticketStatu, ticketType); } Response.AddHeader("Content-Disposition", "attachment;filename=" + filename); HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = (HSSFSheet)workbook.CreateSheet(); //Set Sheet ColumnWidth sheet.SetColumnWidth(0, 30 * 256); sheet.SetColumnWidth(2, 50 * 256); sheet.SetColumnWidth(3, 20 * 256); sheet.SetColumnWidth(4, 20 * 256); sheet.SetColumnWidth(5, 20 * 256); sheet.SetColumnWidth(6, 20 * 256); sheet.SetColumnWidth(7, 20 * 256); sheet.SetColumnWidth(8, 100 * 256); sheet.DisplayGridlines = false; HSSFRow row_head = (HSSFRow)sheet.CreateRow(0); row_head.HeightInPoints = 20; row_head.CreateCell((short)0).SetCellValue("Project"); row_head.CreateCell((short)1).SetCellValue("Type"); row_head.CreateCell((short)2).SetCellValue("Ticket Code / Ticket Title"); row_head.CreateCell((short)3).SetCellValue("Created Date"); row_head.CreateCell((short)4).SetCellValue("Updated Date"); row_head.CreateCell((short)5).SetCellValue("Status"); row_head.CreateCell((short)6).SetCellValue("Priority"); row_head.CreateCell((short)7).SetCellValue("Created By"); row_head.CreateCell((short)8).SetCellValue("Description"); HSSFCellStyle hStyle = (HSSFCellStyle)workbook.CreateCellStyle(); //hStyle.BorderTop = (NPOI.SS.UserModel.CellBorderType)NPOI.SS.UserModel.BorderStyle.THIN; hStyle.BorderRight = (NPOI.SS.UserModel.CellBorderType)NPOI.SS.UserModel.BorderStyle.THIN; //hStyle.BorderLeft = (NPOI.SS.UserModel.CellBorderType)NPOI.SS.UserModel.BorderStyle.THIN; hStyle.BorderBottom = (NPOI.SS.UserModel.CellBorderType)NPOI.SS.UserModel.BorderStyle.THIN; //Set head row background color hStyle.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.TEAL.index; hStyle.FillPattern = NPOI.SS.UserModel.FillPatternType.SQUARES; hStyle.FillBackgroundColor = NPOI.HSSF.Util.HSSFColor.TEAL.index; HSSFFont font = (HSSFFont)workbook.CreateFont(); font.Color = NPOI.HSSF.Util.HSSFColor.WHITE.index; font.FontName = "Verdana"; font.FontHeightInPoints = 12; hStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.CENTER; hStyle.SetFont(font); foreach (var c in row_head.Cells) { c.CellStyle = hStyle; } SearchTicketsResponse response = GetResponse(false); int i = 1; foreach (ExpandTicketsEntity ticket in response.ResultList) { HSSFRow rownumber = (HSSFRow)sheet.CreateRow(i); rownumber.CreateCell((short)0).SetCellValue(ticket.ProjectTitle); rownumber.CreateCell((short)1).SetCellValue(ticket.TicketType.ToString()); rownumber.CreateCell((short)2).SetCellValue(ticket.TicketID + " " + ticket.Title); rownumber.CreateCell((short)3).SetCellValue(string.Format("{0:M/d/yyyy}", ticket.CreatedOn)); rownumber.CreateCell((short)4).SetCellValue(string.Format("{0:M/d/yyyy}", ticket.ModifiedOn)); rownumber.CreateCell((short)5).SetCellValue( GetClientStatusNameBySatisfyStatus((int)ticket.Status, ticket.TicketID, false)); rownumber.CreateCell((short)6).SetCellValue(ticket.Priority.ToString()); rownumber.CreateCell((short)7).SetCellValue(string.Format("{0} {1}", ticket.FirstName, ticket.LastName)); rownumber.CreateCell((short)8).SetCellValue(ticket.FullDescription); HSSFCellStyle rStyle = (HSSFCellStyle)workbook.CreateCellStyle(); rStyle.BorderRight = (NPOI.SS.UserModel.CellBorderType)NPOI.SS.UserModel.BorderStyle.THIN; rStyle.BorderBottom = (NPOI.SS.UserModel.CellBorderType)NPOI.SS.UserModel.BorderStyle.THIN; rStyle.WrapText = true; rStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.CENTER; rStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.LEFT; foreach (var c in rownumber.Cells) { c.CellStyle = rStyle; } i++; } workbook.Write(Response.OutputStream); }
protected void iBtnDownload_Click(object sender, ImageClickEventArgs e) { Response.ContentType = "application/vnd.ms-excel"; string datetime = DateTime.Now.ToString().Replace("/", "").Replace(" ", "").Replace(":", ""); string ticktype = ddlStatus.SelectedItem.Text; ticktype = ticktype == ddlStatus.Items[0].Text ? "ALL_Tickets_" : ticktype + "_Tickets_"; string filename = HttpUtility.UrlDecode(ticktype + datetime + ".xls"); Response.AddHeader("Content-Disposition", "attachment;filename=" + filename); HSSFWorkbook workbook = new HSSFWorkbook(); HSSFSheet sheet = (HSSFSheet)workbook.CreateSheet(); //Set Sheet ColumnWidth sheet.SetColumnWidth(0, 30 * 256); sheet.SetColumnWidth(2, 50 * 256); sheet.SetColumnWidth(3, 20 * 256); sheet.SetColumnWidth(4, 20 * 256); sheet.SetColumnWidth(5, 20 * 256); sheet.SetColumnWidth(6, 20 * 256); sheet.SetColumnWidth(7, 20 * 256); sheet.SetColumnWidth(8, 100 * 256); sheet.DisplayGridlines = false; HSSFRow row_head = (HSSFRow)sheet.CreateRow(0); row_head.HeightInPoints = 20; row_head.CreateCell((short)0).SetCellValue("Project"); row_head.CreateCell((short)1).SetCellValue("Type"); row_head.CreateCell((short)2).SetCellValue("Ticket Code / Ticket Title"); row_head.CreateCell((short)3).SetCellValue("Created Date"); row_head.CreateCell((short)4).SetCellValue("Updated Date"); row_head.CreateCell((short)5).SetCellValue("Status"); row_head.CreateCell((short)6).SetCellValue("Priority"); row_head.CreateCell((short)7).SetCellValue("Created By"); row_head.CreateCell((short)8).SetCellValue("Description"); HSSFCellStyle hStyle = (HSSFCellStyle)workbook.CreateCellStyle(); //hStyle.BorderTop = (NPOI.SS.UserModel.CellBorderType)NPOI.SS.UserModel.BorderStyle.THIN; hStyle.BorderRight = (NPOI.SS.UserModel.CellBorderType)NPOI.SS.UserModel.BorderStyle.THIN; //hStyle.BorderLeft = (NPOI.SS.UserModel.CellBorderType)NPOI.SS.UserModel.BorderStyle.THIN; hStyle.BorderBottom = (NPOI.SS.UserModel.CellBorderType)NPOI.SS.UserModel.BorderStyle.THIN; //Set head row background color hStyle.FillForegroundColor = NPOI.HSSF.Util.HSSFColor.TEAL.index; hStyle.FillPattern = NPOI.SS.UserModel.FillPatternType.SQUARES; hStyle.FillBackgroundColor = NPOI.HSSF.Util.HSSFColor.TEAL.index; HSSFFont font = (HSSFFont)workbook.CreateFont(); font.Color = NPOI.HSSF.Util.HSSFColor.WHITE.index; font.FontName = "Verdana"; font.FontHeightInPoints = 12; hStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.CENTER; hStyle.SetFont(font); foreach (var c in row_head.Cells) { c.CellStyle = hStyle; } List <int> projectIdList = GetProjectIDsFilter(); //List<TicketsState> statusList = GetStautsFilterList(); string keyword = txtKeywords.Text.Trim().NoHTML(); Guid createdByUserId = Guid.Empty; SearchTicketsResponse response = GetResponse(false, ddlProject.SelectedValue); int i = 1; foreach (ExpandTicketsEntity ticket in response.ResultList) { HSSFRow rownumber = (HSSFRow)sheet.CreateRow(i); rownumber.CreateCell((short)0).SetCellValue(ticket.ProjectTitle); rownumber.CreateCell((short)1).SetCellValue(ticket.TicketType.ToString()); rownumber.CreateCell((short)2).SetCellValue("[" + ticket.TicketCode + "]" + ticket.Title); rownumber.CreateCell((short)3).SetCellValue(string.Format("{0:M/d/yyyy}", ticket.CreatedOn)); rownumber.CreateCell((short)4).SetCellValue(string.Format("{0:M/d/yyyy}", ticket.ModifiedOn)); rownumber.CreateCell((short)5).SetCellValue(ticket.Status.ToString()); rownumber.CreateCell((short)6).SetCellValue(ticket.Priority.ToString()); rownumber.CreateCell((short)7).SetCellValue(string.Format("{0} {1}", ticket.FirstName, ticket.LastName)); rownumber.CreateCell((short)8).SetCellValue(ticket.FullDescription); HSSFCellStyle rStyle = (HSSFCellStyle)workbook.CreateCellStyle(); rStyle.BorderRight = (NPOI.SS.UserModel.CellBorderType)NPOI.SS.UserModel.BorderStyle.THIN; rStyle.BorderBottom = (NPOI.SS.UserModel.CellBorderType)NPOI.SS.UserModel.BorderStyle.THIN; rStyle.WrapText = true; rStyle.VerticalAlignment = NPOI.SS.UserModel.VerticalAlignment.CENTER; rStyle.Alignment = NPOI.SS.UserModel.HorizontalAlignment.LEFT; foreach (var c in rownumber.Cells) { c.CellStyle = rStyle; } i++; } workbook.Write(Response.OutputStream); }