private void DoSearch() { if (!_catalog.IsOpen) { MessageBox.Show("Open a _catalog first!"); return; } HelpFilter filter = null; //no fancy adv filtering yet UpdateStatus(false); searchListView.VirtualListSize = 0; Cursor.Current = Cursors.WaitCursor; try { _searchTopics = _catalogRead.GetSearchResults(_catalog, _sQuery, filter, SearchOptions.None, _pageSize, _pageNumber, out _totalAvailableHits); searchListView.VirtualListSize = _searchTopics.Count; UpdateStatus(true); } catch { searchListView.VirtualListSize = 0; _pageNumber = 1; _totalAvailableHits = 0; MessageBox.Show("Exception calling ICatalogRead.GetSearchResults(..)"); return; } finally { Cursor.Current = Cursors.Default; } }
public int _totalAvailableHits = 0; //total hits in all _pages -- Do a search call to fill each page private void DoSearch() { if (!Globals.catalog.IsOpen) { MessageBox.Show("Open a catalog first!"); return; } HelpFilter filter = null; //no fancy adv filtering yet UpdateStatus(false); Cursor.Current = Cursors.WaitCursor; resultsPanel.Clear(); try { ITopicCollection helpTopics = Globals.catalogRead.GetSearchResults(Globals.catalog, _sQuery, filter, _searchOptions, _pageSize, _pageNumber, out _totalAvailableHits); resultsPanel.SetVirtualList(helpTopics); UpdateStatus(true); } catch { resultsPanel.Clear(); _pageNumber = 1; _totalAvailableHits = 0; MessageBox.Show("Exception calling ICatalogRead.GetSearchResults(..)"); return; } finally { Cursor.Current = Cursors.Default; } }
private void btnPrint_Click(object sender, EventArgs e) { string filterStudent = ""; string filterSalesPerson = ""; HelpFilter hp = new HelpFilter(); if (!this.txtStudent.Text.Trim().Equals("")) { filterStudent = "a.SStudentId = '" + this.txtStudent.Text.Trim() + "'"; } else { filterStudent = hp.Get_Filter("a.SStudentId", DS_StudentRight); } if (!this.txtRepCode.Text.Trim().Equals("")) { filterSalesPerson = "e.SRepCode = '" + this.txtRepCode.Text.Trim() + "'"; } else { filterSalesPerson = hp.Get_Filter("e.SRepCode", DS_SalesPersonRight); } //validate if (!filterStudent.Trim().Equals("")) { filterStudent = " and " + filterStudent; } if (!filterSalesPerson.Trim().Equals("")) { filterSalesPerson = " and " + filterSalesPerson; } string filterDate = " where a.DDate>='" + txtDateFrom.Value.ToShortDateString() + "' and a.DDate <= '" + txtDateTo.Value.ToShortDateString() + "'"; DatabaseConnection dbCon = new DatabaseConnection(); string cQuery = "Select a.SRefNo,a.DAddDate as DDate,c.SName,iif(SRepName is null,'NONE',SRepName) as SRepName,b.NAlloAmount," + " a.SAddUser from File_PaymentH a " + " inner join File_PaymentD b on a.SRefNo = b.SRefNo inner join File_Student c on a.SStudentId = c.SStudentId " + " left join File_InvoiceH e on b.SInvNo = e.SRefNo left join File_SalesPerson d on d.SRepCode = e.SRepCode " + filterDate + " " + filterStudent + " " + filterSalesPerson; DataSet Payment_ListingDataSet = dbCon.Get_ReportData(cQuery, "DT_PaymentListing"); Report_View newReport = new Report_View(GlobalVariables.ReportPath + "Rpt_Payment_Listing.rpt", Payment_ListingDataSet, "Payment Listing"); if (Payment_ListingDataSet.Tables[0].Rows.Count > 0) { newReport.ShowInTaskbar = false; newReport.ShowDialog(); } else { MessageBox.Show("No Data To Print"); } }
// TOC Command private void DoTOCCmd() { if (!Globals.catalog.IsOpen) { MessageBox.Show("Open a catalog first!"); return; } String TopicId = TopicIdCbo.Text.Trim(); if (String.IsNullOrEmpty(TopicId)) { MessageBox.Show("Topic ID required. "); return; } HelpFilter filter = null; //no fancy adv filtering yet resultsPanel.Clear(); TocReturnDetail tocDetail = (TocReturnDetail)tocDetailsCbo.SelectedIndex; Cursor.Current = Cursors.WaitCursor; try { ITopicCollection helpTopics = Globals.catalogRead.GetTableOfContents(Globals.catalog, TopicId, filter, tocDetail); resultsPanel.SetVirtualList(helpTopics); } catch { resultsPanel.Clear(); MessageBox.Show("Exception calling ICatalogRead.GetTableOfContents(..)"); } finally { Cursor.Current = Cursors.Default; } }
public Stream UrlToStream(String sURL, Boolean okToRender) { if (MsxhelpProtocol.Catalog == null || !MsxhelpProtocol.Catalog.IsOpen) return null; HelpQuery helpQuery; URLType urltype = UrlInfo(sURL, out helpQuery); String url = sURL.Replace("&", "&"); Stream stream = null; String assetPath = ""; CatalogRead _catalogRead = new CatalogRead(); // Indexed Topic -- ms-xhelp:///?method=page&id=SouthPark.Index&vendor=ACME Company&topicVersion=-1&topicLocale=EN-US // or an unrendered url: ms-xhelp:///?Id=SouthPark.EricCartman if (urltype == URLType.Topic) { _helpQuery = new HelpQuery(helpQuery.ToString()); HelpFilter filter = new HelpFilter(); if (!String.IsNullOrEmpty(_helpQuery.Vendor)) filter.Add("vendor", _helpQuery.Vendor); if (!String.IsNullOrEmpty(_helpQuery.TopicLocale)) filter.Add("topiclocale", _helpQuery.TopicLocale); if (!String.IsNullOrEmpty(_helpQuery.TopicVersion)) filter.Add("topicversion", _helpQuery.TopicVersion); //Get topic obj frome store String [] root = _helpQuery.AssetId.Split(new String[] {"%7c"}, StringSplitOptions.None); if (root.Length == 1) { _topic = (Topic)_catalogRead.GetIndexedTopicDetails(MsxhelpProtocol.Catalog, _helpQuery.AssetId, filter); } else if (root.Length == 3 && root[0] == "VS") { String[] path = root[2].Split(new string[] {"%5c"}, StringSplitOptions.None); if (root[1] == "winui") { // Create keyword list String name = path[path.Length-1]; if (name.IndexOf(".") != -1) name = name.Substring(0, name.IndexOf(".")); String[] prioritizedF1Keywords = new String[1]; prioritizedF1Keywords[0] = "winuser/" + name; //Get topic obj frome store _topic = (Topic)_catalogRead.GetTopicDetailsForF1Keyword(MsxhelpProtocol.Catalog, prioritizedF1Keywords, filter); } } if (_topic != null) { // _topic.Package == _topic.Url = package.mshc;\\path (so we need to split to get the package) String[] url2 = _topic.Url.Split(new char[] { ';' }); if (url2.Length > 0) helpQuery.Package = url2[0]; // "package.mshc" _helpQuery.Package = helpQuery.Package; if (!String.IsNullOrEmpty(_topic.Locale)) _helpQuery.Locale = _topic.Locale; if (String.IsNullOrEmpty(_helpQuery.Locale)) _helpQuery.Locale = MSLocales.ThreadLocale; if (!String.IsNullOrEmpty(_topic.TopicLocale)) _helpQuery.TopicLocale = _topic.TopicLocale; if (!String.IsNullOrEmpty(_topic.TopicVersion)) _helpQuery.TopicVersion = _topic.TopicVersion; if (!String.IsNullOrEmpty(_topic.Vendor)) _helpQuery.Vendor = _topic.Vendor; //Special Case: Force modified text if (!String.IsNullOrEmpty(MsxhelpProtocol.UserTopicText)) { stream = MsxhelpProtocol.GetUserTopicAsStream(); } else { try { stream = (Stream)_topic.FetchContent(); //Normal fetch topic from store //this would also return the stream //stream = (Stream)_catalogRead.GetIndexedTopic(MsxhelpProtocol.Catalog, _topic.Id, null); } catch { stream = null; } } if (stream != null && okToRender) { new TopicStreamExpand(stream, helpQuery); // expand all links etc in the stream } } } // F1Keyword query "ms-xhelp:///?method=f1&query=SouthPark.Text" else if (urltype == URLType.F1Keyword) { _helpQuery = new HelpQuery(helpQuery.ToString()); MessageBox.Show(_helpQuery.QueryValue,"hi",MessageBoxButtons.OK); HelpFilter filter = new HelpFilter(); if (!String.IsNullOrEmpty(_helpQuery.Vendor)) filter.Add("vendor", _helpQuery.Vendor); if (!String.IsNullOrEmpty(_helpQuery.TopicLocale)) filter.Add("topiclocale", _helpQuery.TopicLocale); if (!String.IsNullOrEmpty(_helpQuery.TopicVersion)) filter.Add("topicversion", _helpQuery.TopicVersion); // Create keyword list String[] prioritizedF1Keywords = new String[1]; prioritizedF1Keywords[0] = _helpQuery.QueryValue; //Get topic obj frome store _topic = (Topic)_catalogRead.GetTopicDetailsForF1Keyword(MsxhelpProtocol.Catalog, prioritizedF1Keywords, filter); if (_topic != null) { // _topic.Package == _topic.Url = package.mshc;\\path (so we need to split to get the package) String[] url2 = _topic.Url.Split(new char[] { ';' }); if (url2.Length > 0) helpQuery.Package = url2[0]; // "package.mshc" _helpQuery.Package = helpQuery.Package; if (!String.IsNullOrEmpty(_topic.Locale)) _helpQuery.Locale = _topic.Locale; if (String.IsNullOrEmpty(_helpQuery.Locale)) _helpQuery.Locale = MSLocales.ThreadLocale; if (!String.IsNullOrEmpty(_topic.TopicLocale)) _helpQuery.TopicLocale = _topic.TopicLocale; if (!String.IsNullOrEmpty(_topic.TopicVersion)) _helpQuery.TopicVersion = _topic.TopicVersion; if (!String.IsNullOrEmpty(_topic.Vendor)) _helpQuery.Vendor = _topic.Vendor; //Special Case: Force modified text if (!String.IsNullOrEmpty(MsxhelpProtocol.UserTopicText)) { stream = MsxhelpProtocol.GetUserTopicAsStream(); } else { try { stream = (Stream)_topic.FetchContent(); //Normal fetch topic from store //this would also return the stream //stream = (Stream)_catalogRead.GetIndexedTopic(MsxhelpProtocol.Catalog, _topic.Id, null); } catch { stream = null; } } if (stream != null && okToRender) { new TopicStreamExpand(stream, helpQuery); // expand all links etc in the stream } } } // Branding package path "ms-xhelp:///?76555C51-8CF1-4FEB-81C4-BED857D94EBB_EN-US_Microsoft;/branding.js" else if (urltype == URLType.Branding) { if (url.StartsWith("76555C51-8CF1-4FEB-81C4-BED857D94EBB_", StringComparison.OrdinalIgnoreCase)) // xxxxx.css assetPath = url.Replace("/", @"\"); else assetPath = url.Substring("ms-xhelp:///?".Length).Replace("/", @"\"); String[] parts = assetPath.Split(new char[] { '_' }); String brandingLocale = parts[1]; assetPath = url.Split(new char[] { ';' })[1]; assetPath = assetPath.TrimStart(new char[] { '/' }); // For now we have branding files in a folder ".\Branding" Assembly thisAssembly = System.Reflection.Assembly.GetExecutingAssembly(); String BrandingDir = Path.Combine(Path.GetDirectoryName(thisAssembly.Location), "Branding"); String filePath = Path.Combine(BrandingDir, assetPath); if (!Directory.Exists(BrandingDir)) { MessageBox.Show("Branding folder not found: " + BrandingDir); stream = null; } else if (!File.Exists(filePath)) { MessageBox.Show("Branding file not found: " + filePath); stream = null; } else { FileStream fs = File.OpenRead(filePath); byte[] b = new byte[fs.Length]; fs.Read(b, 0, b.Length); fs.Close(); stream = new MemoryStream(b); } } // Asset -- "ms-xhelp:///?method=asset&id=XyzStyles.css&package=SOURCE HELP.mshc&topiclocale=EN-US" // Or some unrendered asset link ms-xhelp:///?xxxxx.css else if (urltype == URLType.Asset) { if (!String.IsNullOrEmpty(helpQuery.AssetId)) assetPath = helpQuery.AssetId.Replace("/", @"\"); else assetPath = url.Substring("ms-xhelp:///".Length).Replace("/", @"\"); if (String.IsNullOrEmpty(_helpQuery.Package) && !String.IsNullOrEmpty(helpQuery.Package)) _helpQuery.Package = helpQuery.Package; if (!String.IsNullOrEmpty(_helpQuery.Package) && !String.IsNullOrEmpty(assetPath)) stream = (Stream)_catalogRead.GetLinkedAsset(MsxhelpProtocol.Catalog, _helpQuery.Package, assetPath, _helpQuery.Locale); } return stream; }
private void btnPrint_Click(object sender, EventArgs e) { HelpFilter hp = new HelpFilter(); string filterStudent = ""; string filterCourse = ""; string filterSalesPerson = ""; if (!this.txtStudent.Text.Trim().Equals("")) { filterStudent = "a.SStudentId = '" + this.txtStudent.Text.Trim() + "'"; } else { filterStudent = hp.Get_Filter("a.SStudentId", DS_StudentRight); } if (!this.txtCourse.Text.Trim().Equals("")) { filterCourse = "b.SCourseCode = '" + this.txtCourse.Text.Trim() + "'"; } else { filterCourse = hp.Get_Filter("b.SCourseCode", DS_CourseRight); } if (!this.txtRepCode.Text.Trim().Equals("")) { filterSalesPerson = "e.SRepCode = '" + this.txtRepCode.Text.Trim() + "'"; } else { filterSalesPerson = hp.Get_Filter("e.SRepCode", DS_SalesPersonRight); } //validate if (!filterStudent.Trim().Equals("")) { filterStudent = " and " + filterStudent; } if (!filterCourse.Trim().Equals("")) { filterCourse = " and " + filterCourse; } if (!filterSalesPerson.Trim().Equals("")) { filterSalesPerson = " and " + filterSalesPerson; } DatabaseConnection dbCon = new DatabaseConnection(); string cQuery = "select a.SRefNo,a.DDate,a.SStudentId,d.SName,b.SCourseCode,c.SCourseName,b.NAmount," + "b.NDiscount,iif(SRepName is null, 'NONE', SRepName) as SRepName,a.SAddUser,a.DAddDate from " + " File_InvoiceH a inner join File_InvoiceD b on a.SRefNo = b.SRefNo inner join File_Course c on " + "b.SCourseCode = c.SCourseCode inner join File_Student d on d.SStudentId = a.SStudentId " + "left join File_SalesPerson e on e.SRepCode = a.SRepCode where a.DDate>='" + txtDateFrom.Value.ToShortDateString() + "' " + " and a.DDate<='" + txtDateTo.Value.ToShortDateString() + "' " + filterStudent + " " + filterCourse + " " + filterSalesPerson; DataSet Invoice_ListingDataSet = dbCon.Get_ReportData(cQuery, "DT_InvoiceListing"); if (Invoice_ListingDataSet.Tables[0].Rows.Count > 0) { Report_View newReport = new Report_View(GlobalVariables.ReportPath + "Rpt_Invoice_Listing.rpt", Invoice_ListingDataSet, "Invoice Listing"); newReport.ShowInTaskbar = false; newReport.ShowDialog(); } else { MessageBox.Show("No Data To Print"); } }
private void btnPrint_Click(object sender, EventArgs e) { HelpFilter hp = new HelpFilter(); string filterStudent = ""; string filterCourse = ""; if (!this.txtStudent.Text.Trim().Equals("")) { filterStudent = "a.SStudentId = '" + this.txtStudent.Text.Trim() + "'"; } else { filterStudent = hp.Get_Filter("a.SStudentId", DS_StudentRight); } if (!this.txtCourse.Text.Trim().Equals("")) { filterCourse = "c.SCourseCode = '" + this.txtCourse.Text.Trim() + "'"; } else { filterCourse = hp.Get_Filter("c.SCourseCode", DS_CourseRight); } //validate if (!filterStudent.Trim().Equals("")) { filterStudent = " and " + filterStudent; } if (!filterCourse.Trim().Equals("")) { filterCourse = " and " + filterCourse; } string filterDate = " and a.DDate>='" + txtDateFrom.Value.ToShortDateString() + "' and a.DDate <= '" + txtDateTo.Value.ToShortDateString() + "'"; DatabaseConnection dbCon = new DatabaseConnection(); string cQuery; if (this.radioButton1.Checked) { cQuery = "Select c.SCourseCode,SCourseName,a.SStudentId,SName,STelNo,SMobileNo,SEmail " + " from File_InvoiceH a,File_InvoiceD e, File_Student b,File_Course c where " + " a.SStudentId = b.SStudentId and c.SCourseCode = e.SCourseCode and a.SRefNo = e.SRefNo " + " and a.NBalanceAmount > 0 " + filterDate + " " + filterStudent + " " + filterCourse; } else { cQuery = "Select c.SCourseCode,SCourseName,a.SStudentId,SName,STelNo,SMobileNo,SEmail " + " from File_InvoiceH a,File_InvoiceD e, File_Student b,File_Course c where " + " a.SStudentId = b.SStudentId and c.SCourseCode = e.SCourseCode and a.SRefNo = e.SRefNo " + filterDate + " " + filterStudent + " " + filterCourse; } DataSet Student_CourseDataSet = dbCon.Get_ReportData(cQuery, "DT_StudentCourse"); Report_View newReport = new Report_View(GlobalVariables.ReportPath + "Rpt_Student_Course.rpt", Student_CourseDataSet, "Invoice Listing"); if (Student_CourseDataSet.Tables[0].Rows.Count > 0) { newReport.ShowInTaskbar = false; newReport.ShowDialog(); } else { MessageBox.Show("No Valid Data To Print"); } }
public Stream UrlToStream(String sURL, Boolean okToRender) { if (MsxhelpProtocol.Catalog == null || !MsxhelpProtocol.Catalog.IsOpen) { return(null); } HelpQuery helpQuery; URLType urltype = UrlInfo(sURL, out helpQuery); String url = sURL.Replace("&", "&"); Stream stream = null; String assetPath = ""; CatalogRead _catalogRead = new CatalogRead(); // Indexed Topic -- ms-xhelp:///?method=page&id=SouthPark.Index&vendor=ACME Company&topicVersion=-1&topicLocale=EN-US // or an unrendered url: ms-xhelp:///?Id=SouthPark.EricCartman if (urltype == URLType.Topic) { _helpQuery = new HelpQuery(helpQuery.ToString()); HelpFilter filter = new HelpFilter(); if (!String.IsNullOrEmpty(_helpQuery.Vendor)) { filter.Add("vendor", _helpQuery.Vendor); } if (!String.IsNullOrEmpty(_helpQuery.TopicLocale)) { filter.Add("topiclocale", _helpQuery.TopicLocale); } if (!String.IsNullOrEmpty(_helpQuery.TopicVersion)) { filter.Add("topicversion", _helpQuery.TopicVersion); } //Get topic obj frome store String [] root = _helpQuery.AssetId.Split(new String[] { "%7c" }, StringSplitOptions.None); if (root.Length == 1) { _topic = (Topic)_catalogRead.GetIndexedTopicDetails(MsxhelpProtocol.Catalog, _helpQuery.AssetId, filter); } else if (root.Length == 3 && root[0] == "VS") { String[] path = root[2].Split(new string[] { "%5c" }, StringSplitOptions.None); if (root[1] == "winui") { // Create keyword list String name = path[path.Length - 1]; if (name.IndexOf(".") != -1) { name = name.Substring(0, name.IndexOf(".")); } String[] prioritizedF1Keywords = new String[1]; prioritizedF1Keywords[0] = "winuser/" + name; //Get topic obj frome store _topic = (Topic)_catalogRead.GetTopicDetailsForF1Keyword(MsxhelpProtocol.Catalog, prioritizedF1Keywords, filter); } } if (_topic != null) { // _topic.Package == _topic.Url = package.mshc;\\path (so we need to split to get the package) String[] url2 = _topic.Url.Split(new char[] { ';' }); if (url2.Length > 0) { helpQuery.Package = url2[0]; // "package.mshc" } _helpQuery.Package = helpQuery.Package; if (!String.IsNullOrEmpty(_topic.Locale)) { _helpQuery.Locale = _topic.Locale; } if (String.IsNullOrEmpty(_helpQuery.Locale)) { _helpQuery.Locale = MSLocales.ThreadLocale; } if (!String.IsNullOrEmpty(_topic.TopicLocale)) { _helpQuery.TopicLocale = _topic.TopicLocale; } if (!String.IsNullOrEmpty(_topic.TopicVersion)) { _helpQuery.TopicVersion = _topic.TopicVersion; } if (!String.IsNullOrEmpty(_topic.Vendor)) { _helpQuery.Vendor = _topic.Vendor; } //Special Case: Force modified text if (!String.IsNullOrEmpty(MsxhelpProtocol.UserTopicText)) { stream = MsxhelpProtocol.GetUserTopicAsStream(); } else { try { stream = (Stream)_topic.FetchContent(); //Normal fetch topic from store //this would also return the stream //stream = (Stream)_catalogRead.GetIndexedTopic(MsxhelpProtocol.Catalog, _topic.Id, null); } catch { stream = null; } } if (stream != null && okToRender) { new TopicStreamExpand(stream, helpQuery); // expand all links etc in the stream } } } // F1Keyword query "ms-xhelp:///?method=f1&query=SouthPark.Text" else if (urltype == URLType.F1Keyword) { _helpQuery = new HelpQuery(helpQuery.ToString()); MessageBox.Show(_helpQuery.QueryValue, "hi", MessageBoxButtons.OK); HelpFilter filter = new HelpFilter(); if (!String.IsNullOrEmpty(_helpQuery.Vendor)) { filter.Add("vendor", _helpQuery.Vendor); } if (!String.IsNullOrEmpty(_helpQuery.TopicLocale)) { filter.Add("topiclocale", _helpQuery.TopicLocale); } if (!String.IsNullOrEmpty(_helpQuery.TopicVersion)) { filter.Add("topicversion", _helpQuery.TopicVersion); } // Create keyword list String[] prioritizedF1Keywords = new String[1]; prioritizedF1Keywords[0] = _helpQuery.QueryValue; //Get topic obj frome store _topic = (Topic)_catalogRead.GetTopicDetailsForF1Keyword(MsxhelpProtocol.Catalog, prioritizedF1Keywords, filter); if (_topic != null) { // _topic.Package == _topic.Url = package.mshc;\\path (so we need to split to get the package) String[] url2 = _topic.Url.Split(new char[] { ';' }); if (url2.Length > 0) { helpQuery.Package = url2[0]; // "package.mshc" } _helpQuery.Package = helpQuery.Package; if (!String.IsNullOrEmpty(_topic.Locale)) { _helpQuery.Locale = _topic.Locale; } if (String.IsNullOrEmpty(_helpQuery.Locale)) { _helpQuery.Locale = MSLocales.ThreadLocale; } if (!String.IsNullOrEmpty(_topic.TopicLocale)) { _helpQuery.TopicLocale = _topic.TopicLocale; } if (!String.IsNullOrEmpty(_topic.TopicVersion)) { _helpQuery.TopicVersion = _topic.TopicVersion; } if (!String.IsNullOrEmpty(_topic.Vendor)) { _helpQuery.Vendor = _topic.Vendor; } //Special Case: Force modified text if (!String.IsNullOrEmpty(MsxhelpProtocol.UserTopicText)) { stream = MsxhelpProtocol.GetUserTopicAsStream(); } else { try { stream = (Stream)_topic.FetchContent(); //Normal fetch topic from store //this would also return the stream //stream = (Stream)_catalogRead.GetIndexedTopic(MsxhelpProtocol.Catalog, _topic.Id, null); } catch { stream = null; } } if (stream != null && okToRender) { new TopicStreamExpand(stream, helpQuery); // expand all links etc in the stream } } } // Branding package path "ms-xhelp:///?76555C51-8CF1-4FEB-81C4-BED857D94EBB_EN-US_Microsoft;/branding.js" else if (urltype == URLType.Branding) { if (url.StartsWith("76555C51-8CF1-4FEB-81C4-BED857D94EBB_", StringComparison.OrdinalIgnoreCase)) // xxxxx.css { assetPath = url.Replace("/", @"\"); } else { assetPath = url.Substring("ms-xhelp:///?".Length).Replace("/", @"\"); } String[] parts = assetPath.Split(new char[] { '_' }); String brandingLocale = parts[1]; assetPath = url.Split(new char[] { ';' })[1]; assetPath = assetPath.TrimStart(new char[] { '/' }); // For now we have branding files in a folder ".\Branding" Assembly thisAssembly = System.Reflection.Assembly.GetExecutingAssembly(); String BrandingDir = Path.Combine(Path.GetDirectoryName(thisAssembly.Location), "Branding"); String filePath = Path.Combine(BrandingDir, assetPath); if (!Directory.Exists(BrandingDir)) { MessageBox.Show("Branding folder not found: " + BrandingDir); stream = null; } else if (!File.Exists(filePath)) { MessageBox.Show("Branding file not found: " + filePath); stream = null; } else { FileStream fs = File.OpenRead(filePath); byte[] b = new byte[fs.Length]; fs.Read(b, 0, b.Length); fs.Close(); stream = new MemoryStream(b); } } // Asset -- "ms-xhelp:///?method=asset&id=XyzStyles.css&package=SOURCE HELP.mshc&topiclocale=EN-US" // Or some unrendered asset link ms-xhelp:///?xxxxx.css else if (urltype == URLType.Asset) { if (!String.IsNullOrEmpty(helpQuery.AssetId)) { assetPath = helpQuery.AssetId.Replace("/", @"\"); } else { assetPath = url.Substring("ms-xhelp:///".Length).Replace("/", @"\"); } if (String.IsNullOrEmpty(_helpQuery.Package) && !String.IsNullOrEmpty(helpQuery.Package)) { _helpQuery.Package = helpQuery.Package; } if (!String.IsNullOrEmpty(_helpQuery.Package) && !String.IsNullOrEmpty(assetPath)) { stream = (Stream)_catalogRead.GetLinkedAsset(MsxhelpProtocol.Catalog, _helpQuery.Package, assetPath, _helpQuery.Locale); } } return(stream); }
private void btnPrint_Click(object sender, EventArgs e) { HelpFilter hp = new HelpFilter(); string filterStudent = ""; string filterCourse = ""; if (!this.txtStudent.Text.Trim().Equals("")) { filterStudent = "a.SStudentId = '" + this.txtStudent.Text.Trim() + "'"; } else { filterStudent = hp.Get_Filter("a.SStudentId", DS_StudentRight); } if (!this.txtCourse.Text.Trim().Equals("")) { filterCourse = "c.SCourseCode = '" + this.txtCourse.Text.Trim() + "'"; } else { filterCourse = hp.Get_Filter("c.SCourseCode", DS_CourseRight); } //validate if (!filterStudent.Trim().Equals("")) { filterStudent = " and " + filterStudent; } if (!filterCourse.Trim().Equals("")) { filterCourse = " and " + filterCourse; } string filterDate = " and a.DDate='" + txtDateFrom.Value.ToShortDateString() + "' "; DatabaseConnection dbCon = new DatabaseConnection(); string cQuery = "Select SRefNo,DDate,SName,SMobileNo from File_PaymentH a,File_Student b " + " where a.SStudentId = b.SStudentId " + filterDate + filterStudent + filterCourse; DataSet Student_PaymentDataSet = dbCon.Get_ReportData(cQuery, "DT_StudentPayment"); Report_View newReport = new Report_View(GlobalVariables.ReportPath + "Rpt_Student_Payment.rpt", Student_PaymentDataSet, "Student Payment Listing"); if (Student_PaymentDataSet.Tables[0].Rows.Count > 0) { newReport.ShowInTaskbar = false; newReport.ShowDialog(); //Email DialogResult dRes = MessageBox.Show("Do You Want To Email This Report?", "Confirm", MessageBoxButtons.YesNo); if (dRes == DialogResult.Yes) { string studentId = this.txtStudent.Text.Trim(); SendEmail newMail = new SendEmail("Rpt_Student_Payment.pdf", newReport, studentId); newMail.ShowInTaskbar = false; newMail.ShowDialog(); } } else { MessageBox.Show("No Valid Data To Print"); } }