private static void fetchTheSystemParameters() { try { SqlConnection cnSQL = new SqlConnection(MyModules.strConnect); SqlCommand cmSQL = new SqlCommand("FetchAllSystemParameters", cnSQL); SqlDataReader drSQL; cnSQL.Open(); cmSQL.CommandText = "FetchAllSystemParameters"; cmSQL.CommandType = System.Data.CommandType.StoredProcedure; drSQL = cmSQL.ExecuteReader(); if (drSQL.HasRows == false) { MessageBox.Show("Invalid System parameter", MyModules.strApptitle, MessageBoxButtons.OK, MessageBoxIcon.Information); System.Environment.Exit(1); } else { if (drSQL.Read()) { eDocFilePath = drSQL["eDocPath"].ToString(); BackupPath = drSQL["BackupPath"].ToString(); Signatory1 = MyModules.ChkNull(drSQL["Signatory1"]); Signatory2 = MyModules.ChkNull(drSQL["Signatory2"]); if (Convert.IsDBNull(drSQL["Logo"]) == false) { UserLogo = (byte[])drSQL["Logo"]; } } } //cmSQL.Connection.Close() cmSQL.Dispose(); drSQL.Close(); cnSQL.Close(); //cnSQL.Dispose() } catch (Exception ex) { MessageBox.Show("Ooops! ERROR :" + char.ConvertFromUtf32(13) + ex, MyModules.strApptitle, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
//private void Navigate(string address) //{ // if (string.IsNullOrEmpty(address)) // { // return; // } // if (address.Equals("about:blank")) // { // return; // } // if (!address.StartsWith("http://")) // { // address = address; //'"http://" & // } // try // { // WebBrowser.Navigate(new Uri(address)); // } // catch (System.UriFormatException ex) // { // WebBrowser.Visible = false; // MessageBox.Show("Cannot open Readme file", strApptitle, MessageBoxButtons.OK, MessageBoxIcon.Information); // return; // } //} private void oLoadSchName() { try { SqlConnection cnSQL = new SqlConnection(MyModules.strConnect); SqlCommand cmSQL = new SqlCommand(); cmSQL.Connection = cnSQL; SqlDataReader drSQL = null; cmSQL.CommandText = "SELECT DISTINCT SchoolID,SchName FROM Payment WHERE Source='STUDENT' ORDER BY [SchName]"; cmSQL.CommandType = CommandType.Text; cnSQL.Open(); cGrp.Items.Add("ALL"); drSQL = cmSQL.ExecuteReader(); while (drSQL.Read()) { cGrp.Items.Add(drSQL["SchoolID"] + " - " + MyModules.ChkNull(drSQL["SchName"])); } cmSQL.Connection.Close(); cmSQL.Dispose(); drSQL.Close(); cnSQL.Close(); cnSQL.Dispose(); cGrp.Text = "ALL"; //cGrp.SelectedIndex = 0; return; } catch (Exception ex) { MessageBox.Show(ex.Message, MyModules.strApptitle, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
private void CreateHTML(string ClientCode, string theName) { try { //If Trim(strAccountNo) = "" Then Exit Sub // Create an instance of StreamWriter to write text to a file. string GetHTMFileName = Microsoft.VisualBasic.FileIO.FileSystem.GetTempFileName(); GetHTMFileName = GetHTMFileName.Substring(0, GetHTMFileName.Length - 3) + "apx"; using (StreamWriter sw = new StreamWriter(GetHTMFileName)) { sw.WriteLine("<html>"); sw.WriteLine("<head>"); sw.WriteLine("<meta http-equiv='Content-Type' content='text/html; charset=windows-1252'>"); sw.WriteLine("<title>PrimeScholar</title>"); sw.WriteLine("<style>"); sw.WriteLine("<!--"); sw.WriteLine("BODY { background: url('top-vb.gif') repeat-x; font-family: Verdana; font-size: 67% ; background-color:white } "); sw.WriteLine(".maindiv { background: url('side-vb.gif') repeat-y; padding-left: 30px; padding-top: 5px; position: relative; "); sw.WriteLine("height: 50px }"); sw.WriteLine("P { margin-top: 0; margin-bottom: 6px; line-height:130% }"); sw.WriteLine("H1 { margin-top: 20px; margin-bottom: 12px; font-size:190% }"); sw.WriteLine("H2 { color: #585F56; left: -55px; position: relative; margin-top: 21px; margin-bottom: 9px; font-size:170% "); sw.WriteLine("}"); sw.WriteLine("H3 { margin-top: 21px; margin-bottom: 9px; font-size: 140%; font-weight: bold}"); sw.WriteLine("H4 { margin-top: 18px; margin-bottom: 9px; font-size: 140%; font-weight: bold}"); sw.WriteLine("OL { margin-top: 0; margin-bottom: 9px; line-height:130%}"); sw.WriteLine("UL { margin-top: 0; margin-bottom: 9px; line-height:130%}"); sw.WriteLine("LI { margin-top: 0; margin-bottom: 6px }"); sw.WriteLine("BLOCKQUOTE { margin-left: 10px }"); sw.WriteLine("TABLE { padding: 4px; BACKGROUND: white; BORDER: #DDDCD6 1px solid; BORDER-COLLAPSE: collapse; margin-"); sw.WriteLine("bottom: 9px; }"); sw.WriteLine("TR { vertical-align: top} "); sw.WriteLine("TD { padding: 4px; font-family: Verdana; font-size: 67%; line-height: 130%} "); sw.WriteLine(".contents { line-height: 150% }"); sw.WriteLine("DIV.CodeBlock { font-family: 'Courier New'; font-size: 100%; margin-bottom: 6px; BACKGROUND: #f8f7ef; BORDER: "); sw.WriteLine("#eeede6 1px solid; padding: 5px; }"); sw.WriteLine(".CodeInline { font-family: 'Courier New' }"); sw.WriteLine(".ProcedureLabel {margin-top: 5px; font-style: italic; font-weight: bold; color: #0D4CC3 } "); sw.WriteLine(".FileNameCol { padding: 5px; BACKGROUND: seashell; width=200px; font-size: 60%; font-weight: bold}"); sw.WriteLine(".Col {padding: 5px; width=600px}"); sw.WriteLine("-->"); sw.WriteLine("</style>"); sw.WriteLine("</head>"); sw.WriteLine("<body topmargin='0' leftmargin='0' rightmargin='0'>"); sw.WriteLine("<div class='maindiv'>"); sw.WriteLine("<a name='top'>"); sw.WriteLine("<!-- MAIN CONTENT BEGINS -->"); SqlConnection cnSQL = new SqlConnection(MyModules.strConnect); SqlCommand cmSQL = new SqlCommand(); cmSQL.Connection = cnSQL; SqlDataReader drSQL = null; //if (RadSchool.Checked) //{ cmSQL.CommandText = "SELECT * FROM RegisterSchool WHERE Sn=" + ClientCode; //} //if (RadStudent.Checked) //{ // cmSQL.CommandText = "SELECT * FROM RegisterStudent WHERE Sn=" + ClientCode; //} //if (RadVendor.Checked) //{ // cmSQL.CommandText = "SELECT * FROM RegisterVendor WHERE Sn=" + ClientCode; //} //if (radStaff.Checked) //{ // cmSQL.CommandText = "SELECT * FROM RegisterVendor WHERE Sn=" + ClientCode; //} cmSQL.CommandType = CommandType.Text; cnSQL.Open(); drSQL = cmSQL.ExecuteReader(); int i = 0; if (drSQL.HasRows == false) { goto SkipIt; } if (drSQL.Read()) { sw.WriteLine("<h1>"); sw.WriteLine("<span style='font-size: 11pt'>BENEFICIARY INFORMATION</span><a name='top'>"); sw.WriteLine("</h1>"); sw.WriteLine("</a>"); sw.WriteLine("<table border='1' bordercolor= #DDDCD6 width='100%' style='border-collapse: collapse'>"); sw.WriteLine("<tr>"); for (i = 0; i < drSQL.FieldCount; i++) { sw.WriteLine("<tr>"); sw.WriteLine("<td class='FileNameCol'>" + drSQL.GetName(i) + "</td>"); if (drSQL[i].GetType().ToString() == "System.DateTime") { sw.WriteLine("<td class='Col'>" + MyModules.FormatDate(drSQL[i]) + "</td>"); } else if (drSQL[i].GetType().ToString() == "System.Decimal") { sw.WriteLine("<td class='Col'>" + MyModules.FormatDouble(drSQL[i]) + "</td>"); } else { sw.WriteLine("<td class='Col'>" + MyModules.ChkNull(drSQL[i]) + "</td>"); } sw.WriteLine("</tr>"); } } else { sw.WriteLine("<h1>"); sw.WriteLine("<span style='font-size: 11pt;color: #990000'>" + MyModules.sysOwner + "</span><a name='top'>"); sw.WriteLine("</h1>"); sw.WriteLine("<h1>"); sw.WriteLine("<span style='font-size: 11pt;color: #990000'>Details:</span><a name='top'>"); sw.WriteLine("</h1>"); sw.WriteLine("</a>"); sw.WriteLine("<table border='1' bordercolor= #DDDCD6 width='70%' style='border-collapse: collapse'>"); sw.WriteLine("<tr>"); } SkipIt: cmSQL.Connection.Close(); cmSQL.Dispose(); drSQL.Close(); cnSQL.Close(); cnSQL.Dispose(); sw.WriteLine("</table>"); sw.WriteLine("</p>"); sw.WriteLine("<h3>"); sw.WriteLine("<span style='font-size: 60%'>"); sw.WriteLine("<p> </p>"); sw.WriteLine("</div>"); sw.WriteLine("</body>"); sw.WriteLine("</html>"); sw.Close(); WebBrowser.Navigate(new Uri(GetHTMFileName)); } return; } catch (Exception ex) { MessageBox.Show(ex.Message, MyModules.strApptitle, MessageBoxButtons.OK, MessageBoxIcon.Information); } }