1233 lines
55 KiB
C#
1233 lines
55 KiB
C#
using System;
|
|
using System.Drawing;
|
|
using System.Collections;
|
|
using System.ComponentModel;
|
|
using System.Windows.Forms;
|
|
using System.Data;
|
|
using System.IO;
|
|
using Payroll.BO;
|
|
|
|
|
|
|
|
namespace Payroll.UI
|
|
{
|
|
/// <summary>
|
|
/// Summary description for frmQueryAnalyzer.
|
|
/// </summary>
|
|
public class frmQueryAnalyzer : System.Windows.Forms.Form
|
|
{
|
|
private System.Windows.Forms.Button btnRun;
|
|
private System.Windows.Forms.Button btnClose;
|
|
private System.Windows.Forms.CheckBox ckExecute;
|
|
private System.Windows.Forms.CheckBox ckSelect;
|
|
private System.Windows.Forms.GroupBox groupBox1;
|
|
private System.Windows.Forms.TextBox txtSource;
|
|
private System.Windows.Forms.Label label2;
|
|
private System.Windows.Forms.Label label3;
|
|
private System.Windows.Forms.TextBox txtDB;
|
|
private System.Windows.Forms.ComboBox cbProvider;
|
|
private System.Windows.Forms.Label label1;
|
|
private System.Windows.Forms.DataGrid dgRes;
|
|
private System.Windows.Forms.Label label4;
|
|
private System.Windows.Forms.Label label5;
|
|
private System.Windows.Forms.TextBox txtUser;
|
|
private System.Windows.Forms.TextBox txtPassword;
|
|
private System.Windows.Forms.StatusBar stbMain;
|
|
private System.Windows.Forms.StatusBarPanel status;
|
|
private System.Windows.Forms.StatusBarPanel pnlVersion;
|
|
private System.Windows.Forms.MainMenu mainMenu1;
|
|
private System.Windows.Forms.MenuItem menuItem1;
|
|
private System.Windows.Forms.MenuItem menuItem2;
|
|
private System.Windows.Forms.MenuItem menuBackup;
|
|
private System.Windows.Forms.MenuItem menuRestore;
|
|
private System.Windows.Forms.RichTextBox txtQuery;
|
|
private System.Windows.Forms.MenuItem menuXMLTableViewer;
|
|
private System.Windows.Forms.Button btnToCSV;
|
|
private System.Windows.Forms.Panel pnlResult;
|
|
private System.Windows.Forms.ComboBox cboTables;
|
|
private System.Windows.Forms.Label label6;
|
|
private System.Windows.Forms.Label lblTables;
|
|
private System.Windows.Forms.SaveFileDialog saveFileDialog1;
|
|
private System.Windows.Forms.Button btnToXML;
|
|
private System.Windows.Forms.Button btnBrowse;
|
|
private System.Windows.Forms.TextBox txtQryFile;
|
|
private System.Windows.Forms.Label label7;
|
|
private System.Windows.Forms.OpenFileDialog openFileDialog1;
|
|
private System.Windows.Forms.MenuItem menuItem3;
|
|
private System.Windows.Forms.MenuItem menuSendMail;
|
|
private System.Windows.Forms.MenuItem menuItem4;
|
|
private System.Windows.Forms.MenuItem menuItem5;
|
|
private System.Windows.Forms.MenuItem menuUnzip;
|
|
private System.Windows.Forms.MenuItem menuItem6;
|
|
private CheckBox chkSafeExecution;
|
|
private Panel panel2;
|
|
private Label label9;
|
|
private Label label8;
|
|
private Button btnValidate;
|
|
private ComboBox cboConnections;
|
|
private Label label10;
|
|
private Button btnConnectionCheck;
|
|
private MenuItem menuItem7;
|
|
private MenuItem menuItem8;
|
|
private RichTextBox lblRes;
|
|
private MenuItem menuItem9;
|
|
private Button button1;
|
|
private IContainer components;
|
|
|
|
public frmQueryAnalyzer()
|
|
{
|
|
//
|
|
// Required for Windows Form Designer support
|
|
//
|
|
|
|
|
|
InitializeComponent();
|
|
|
|
//
|
|
// TODO: Add any constructor code after InitializeComponent call
|
|
//
|
|
}
|
|
|
|
/// <summary>
|
|
/// Clean up any resources being used.
|
|
/// </summary>
|
|
protected override void Dispose(bool disposing)
|
|
{
|
|
if (disposing)
|
|
{
|
|
if (components != null)
|
|
{
|
|
components.Dispose();
|
|
}
|
|
}
|
|
base.Dispose(disposing);
|
|
}
|
|
|
|
//[STAThread]
|
|
//static void Main()
|
|
//{
|
|
// Application.EnableVisualStyles();
|
|
// Application.SetCompatibleTextRenderingDefault(false);
|
|
// Application.Run(new frmQueryAnalyzer());
|
|
//}
|
|
|
|
#region Windows Form Designer generated code
|
|
/// <summary>
|
|
/// Required method for Designer support - do not modify
|
|
/// the contents of this method with the code editor.
|
|
/// </summary>
|
|
private void InitializeComponent()
|
|
{
|
|
this.components = new System.ComponentModel.Container();
|
|
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmQueryAnalyzer));
|
|
this.dgRes = new System.Windows.Forms.DataGrid();
|
|
this.ckExecute = new System.Windows.Forms.CheckBox();
|
|
this.ckSelect = new System.Windows.Forms.CheckBox();
|
|
this.groupBox1 = new System.Windows.Forms.GroupBox();
|
|
this.button1 = new System.Windows.Forms.Button();
|
|
this.btnConnectionCheck = new System.Windows.Forms.Button();
|
|
this.cboConnections = new System.Windows.Forms.ComboBox();
|
|
this.cbProvider = new System.Windows.Forms.ComboBox();
|
|
this.label1 = new System.Windows.Forms.Label();
|
|
this.txtSource = new System.Windows.Forms.TextBox();
|
|
this.label10 = new System.Windows.Forms.Label();
|
|
this.label2 = new System.Windows.Forms.Label();
|
|
this.txtDB = new System.Windows.Forms.TextBox();
|
|
this.txtUser = new System.Windows.Forms.TextBox();
|
|
this.label4 = new System.Windows.Forms.Label();
|
|
this.txtPassword = new System.Windows.Forms.TextBox();
|
|
this.label5 = new System.Windows.Forms.Label();
|
|
this.label3 = new System.Windows.Forms.Label();
|
|
this.stbMain = new System.Windows.Forms.StatusBar();
|
|
this.status = new System.Windows.Forms.StatusBarPanel();
|
|
this.pnlVersion = new System.Windows.Forms.StatusBarPanel();
|
|
this.mainMenu1 = new System.Windows.Forms.MainMenu(this.components);
|
|
this.menuItem1 = new System.Windows.Forms.MenuItem();
|
|
this.menuItem2 = new System.Windows.Forms.MenuItem();
|
|
this.menuBackup = new System.Windows.Forms.MenuItem();
|
|
this.menuRestore = new System.Windows.Forms.MenuItem();
|
|
this.menuXMLTableViewer = new System.Windows.Forms.MenuItem();
|
|
this.menuItem3 = new System.Windows.Forms.MenuItem();
|
|
this.menuSendMail = new System.Windows.Forms.MenuItem();
|
|
this.menuItem4 = new System.Windows.Forms.MenuItem();
|
|
this.menuItem5 = new System.Windows.Forms.MenuItem();
|
|
this.menuUnzip = new System.Windows.Forms.MenuItem();
|
|
this.menuItem6 = new System.Windows.Forms.MenuItem();
|
|
this.menuItem7 = new System.Windows.Forms.MenuItem();
|
|
this.menuItem8 = new System.Windows.Forms.MenuItem();
|
|
this.menuItem9 = new System.Windows.Forms.MenuItem();
|
|
this.txtQuery = new System.Windows.Forms.RichTextBox();
|
|
this.pnlResult = new System.Windows.Forms.Panel();
|
|
this.cboTables = new System.Windows.Forms.ComboBox();
|
|
this.label6 = new System.Windows.Forms.Label();
|
|
this.lblTables = new System.Windows.Forms.Label();
|
|
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
|
|
this.btnBrowse = new System.Windows.Forms.Button();
|
|
this.txtQryFile = new System.Windows.Forms.TextBox();
|
|
this.label7 = new System.Windows.Forms.Label();
|
|
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
|
|
this.chkSafeExecution = new System.Windows.Forms.CheckBox();
|
|
this.panel2 = new System.Windows.Forms.Panel();
|
|
this.label9 = new System.Windows.Forms.Label();
|
|
this.label8 = new System.Windows.Forms.Label();
|
|
this.lblRes = new System.Windows.Forms.RichTextBox();
|
|
this.btnClose = new System.Windows.Forms.Button();
|
|
this.btnValidate = new System.Windows.Forms.Button();
|
|
this.btnToCSV = new System.Windows.Forms.Button();
|
|
this.btnRun = new System.Windows.Forms.Button();
|
|
this.btnToXML = new System.Windows.Forms.Button();
|
|
((System.ComponentModel.ISupportInitialize)(this.dgRes)).BeginInit();
|
|
this.groupBox1.SuspendLayout();
|
|
((System.ComponentModel.ISupportInitialize)(this.status)).BeginInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.pnlVersion)).BeginInit();
|
|
this.pnlResult.SuspendLayout();
|
|
this.panel2.SuspendLayout();
|
|
this.SuspendLayout();
|
|
//
|
|
// dgRes
|
|
//
|
|
this.dgRes.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
|
| System.Windows.Forms.AnchorStyles.Right)));
|
|
this.dgRes.DataMember = "";
|
|
this.dgRes.HeaderForeColor = System.Drawing.SystemColors.ControlText;
|
|
this.dgRes.Location = new System.Drawing.Point(24, 355);
|
|
this.dgRes.Name = "dgRes";
|
|
this.dgRes.ReadOnly = true;
|
|
this.dgRes.Size = new System.Drawing.Size(910, 176);
|
|
this.dgRes.TabIndex = 7;
|
|
this.dgRes.Visible = false;
|
|
//
|
|
// ckExecute
|
|
//
|
|
this.ckExecute.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
|
this.ckExecute.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
this.ckExecute.Location = new System.Drawing.Point(123, 544);
|
|
this.ckExecute.Name = "ckExecute";
|
|
this.ckExecute.Size = new System.Drawing.Size(116, 25);
|
|
this.ckExecute.TabIndex = 10;
|
|
this.ckExecute.Text = "Execute Query";
|
|
this.ckExecute.CheckedChanged += new System.EventHandler(this.ckExecute_CheckedChanged);
|
|
//
|
|
// ckSelect
|
|
//
|
|
this.ckSelect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
|
this.ckSelect.Checked = true;
|
|
this.ckSelect.CheckState = System.Windows.Forms.CheckState.Checked;
|
|
this.ckSelect.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
this.ckSelect.Location = new System.Drawing.Point(24, 545);
|
|
this.ckSelect.Name = "ckSelect";
|
|
this.ckSelect.Size = new System.Drawing.Size(104, 23);
|
|
this.ckSelect.TabIndex = 9;
|
|
this.ckSelect.Text = "Select Query";
|
|
this.ckSelect.CheckedChanged += new System.EventHandler(this.ckSelect_CheckedChanged);
|
|
//
|
|
// groupBox1
|
|
//
|
|
this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
|
| System.Windows.Forms.AnchorStyles.Right)));
|
|
this.groupBox1.Controls.Add(this.button1);
|
|
this.groupBox1.Controls.Add(this.btnConnectionCheck);
|
|
this.groupBox1.Controls.Add(this.cboConnections);
|
|
this.groupBox1.Controls.Add(this.cbProvider);
|
|
this.groupBox1.Controls.Add(this.label1);
|
|
this.groupBox1.Controls.Add(this.txtSource);
|
|
this.groupBox1.Controls.Add(this.label10);
|
|
this.groupBox1.Controls.Add(this.label2);
|
|
this.groupBox1.Controls.Add(this.txtDB);
|
|
this.groupBox1.Controls.Add(this.txtUser);
|
|
this.groupBox1.Controls.Add(this.label4);
|
|
this.groupBox1.Controls.Add(this.txtPassword);
|
|
this.groupBox1.Controls.Add(this.label5);
|
|
this.groupBox1.Controls.Add(this.label3);
|
|
this.groupBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
this.groupBox1.Location = new System.Drawing.Point(24, 0);
|
|
this.groupBox1.Name = "groupBox1";
|
|
this.groupBox1.Size = new System.Drawing.Size(910, 72);
|
|
this.groupBox1.TabIndex = 0;
|
|
this.groupBox1.TabStop = false;
|
|
this.groupBox1.Text = "Connection Config";
|
|
//
|
|
// button1
|
|
//
|
|
this.button1.Location = new System.Drawing.Point(820, 25);
|
|
this.button1.Name = "button1";
|
|
this.button1.Size = new System.Drawing.Size(75, 23);
|
|
this.button1.TabIndex = 12;
|
|
this.button1.Text = "Get";
|
|
this.button1.UseVisualStyleBackColor = true;
|
|
this.button1.Click += new System.EventHandler(this.button1_Click);
|
|
//
|
|
// btnConnectionCheck
|
|
//
|
|
this.btnConnectionCheck.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
|
this.btnConnectionCheck.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
this.btnConnectionCheck.Location = new System.Drawing.Point(737, 15);
|
|
this.btnConnectionCheck.Name = "btnConnectionCheck";
|
|
this.btnConnectionCheck.Size = new System.Drawing.Size(50, 49);
|
|
this.btnConnectionCheck.TabIndex = 11;
|
|
this.btnConnectionCheck.Text = "Save";
|
|
this.btnConnectionCheck.TextImageRelation = System.Windows.Forms.TextImageRelation.TextAboveImage;
|
|
this.btnConnectionCheck.UseVisualStyleBackColor = true;
|
|
this.btnConnectionCheck.Click += new System.EventHandler(this.btnConnectionCheck_Click);
|
|
//
|
|
// cboConnections
|
|
//
|
|
this.cboConnections.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
|
this.cboConnections.FormattingEnabled = true;
|
|
this.cboConnections.Location = new System.Drawing.Point(94, 17);
|
|
this.cboConnections.Name = "cboConnections";
|
|
this.cboConnections.Size = new System.Drawing.Size(202, 20);
|
|
this.cboConnections.TabIndex = 10;
|
|
this.cboConnections.SelectedIndexChanged += new System.EventHandler(this.cboConnections_SelectedIndexChanged);
|
|
//
|
|
// cbProvider
|
|
//
|
|
this.cbProvider.BackColor = System.Drawing.Color.White;
|
|
this.cbProvider.Enabled = false;
|
|
this.cbProvider.Items.AddRange(new object[] {
|
|
"SQLOLEDB",
|
|
"MSDAORA",
|
|
"OLEDB"});
|
|
this.cbProvider.Location = new System.Drawing.Point(587, 17);
|
|
this.cbProvider.Name = "cbProvider";
|
|
this.cbProvider.Size = new System.Drawing.Size(144, 20);
|
|
this.cbProvider.TabIndex = 3;
|
|
//
|
|
// label1
|
|
//
|
|
this.label1.Location = new System.Drawing.Point(524, 20);
|
|
this.label1.Name = "label1";
|
|
this.label1.Size = new System.Drawing.Size(66, 19);
|
|
this.label1.TabIndex = 2;
|
|
this.label1.Text = "Provider";
|
|
//
|
|
// txtSource
|
|
//
|
|
this.txtSource.BackColor = System.Drawing.Color.White;
|
|
this.txtSource.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
this.txtSource.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
this.txtSource.Location = new System.Drawing.Point(378, 17);
|
|
this.txtSource.Name = "txtSource";
|
|
this.txtSource.Size = new System.Drawing.Size(144, 18);
|
|
this.txtSource.TabIndex = 1;
|
|
this.txtSource.Text = ".";
|
|
//
|
|
// label10
|
|
//
|
|
this.label10.Location = new System.Drawing.Point(13, 19);
|
|
this.label10.Name = "label10";
|
|
this.label10.Size = new System.Drawing.Size(87, 20);
|
|
this.label10.TabIndex = 0;
|
|
this.label10.Text = "Connections";
|
|
//
|
|
// label2
|
|
//
|
|
this.label2.Location = new System.Drawing.Point(299, 19);
|
|
this.label2.Name = "label2";
|
|
this.label2.Size = new System.Drawing.Size(88, 17);
|
|
this.label2.TabIndex = 0;
|
|
this.label2.Text = "Data Source";
|
|
//
|
|
// txtDB
|
|
//
|
|
this.txtDB.BackColor = System.Drawing.Color.White;
|
|
this.txtDB.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
this.txtDB.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
this.txtDB.Location = new System.Drawing.Point(94, 44);
|
|
this.txtDB.Name = "txtDB";
|
|
this.txtDB.Size = new System.Drawing.Size(202, 18);
|
|
this.txtDB.TabIndex = 5;
|
|
//
|
|
// txtUser
|
|
//
|
|
this.txtUser.BackColor = System.Drawing.Color.White;
|
|
this.txtUser.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
this.txtUser.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
this.txtUser.Location = new System.Drawing.Point(379, 44);
|
|
this.txtUser.Name = "txtUser";
|
|
this.txtUser.Size = new System.Drawing.Size(144, 18);
|
|
this.txtUser.TabIndex = 7;
|
|
this.txtUser.Text = "sa";
|
|
//
|
|
// label4
|
|
//
|
|
this.label4.Location = new System.Drawing.Point(299, 48);
|
|
this.label4.Name = "label4";
|
|
this.label4.Size = new System.Drawing.Size(72, 16);
|
|
this.label4.TabIndex = 6;
|
|
this.label4.Text = "User ID";
|
|
//
|
|
// txtPassword
|
|
//
|
|
this.txtPassword.BackColor = System.Drawing.Color.White;
|
|
this.txtPassword.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
this.txtPassword.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
this.txtPassword.Location = new System.Drawing.Point(588, 44);
|
|
this.txtPassword.Name = "txtPassword";
|
|
this.txtPassword.PasswordChar = '*';
|
|
this.txtPassword.Size = new System.Drawing.Size(144, 18);
|
|
this.txtPassword.TabIndex = 9;
|
|
//
|
|
// label5
|
|
//
|
|
this.label5.Location = new System.Drawing.Point(524, 48);
|
|
this.label5.Name = "label5";
|
|
this.label5.Size = new System.Drawing.Size(72, 16);
|
|
this.label5.TabIndex = 8;
|
|
this.label5.Text = "Password";
|
|
//
|
|
// label3
|
|
//
|
|
this.label3.Location = new System.Drawing.Point(13, 48);
|
|
this.label3.Name = "label3";
|
|
this.label3.Size = new System.Drawing.Size(63, 17);
|
|
this.label3.TabIndex = 4;
|
|
this.label3.Text = "Database";
|
|
//
|
|
// stbMain
|
|
//
|
|
this.stbMain.Location = new System.Drawing.Point(0, 574);
|
|
this.stbMain.Name = "stbMain";
|
|
this.stbMain.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
|
|
this.status,
|
|
this.pnlVersion});
|
|
this.stbMain.ShowPanels = true;
|
|
this.stbMain.Size = new System.Drawing.Size(958, 24);
|
|
this.stbMain.TabIndex = 16;
|
|
//
|
|
// status
|
|
//
|
|
this.status.AutoSize = System.Windows.Forms.StatusBarPanelAutoSize.Spring;
|
|
this.status.Name = "status";
|
|
this.status.Text = "Ready";
|
|
this.status.Width = 841;
|
|
//
|
|
// pnlVersion
|
|
//
|
|
this.pnlVersion.Name = "pnlVersion";
|
|
this.pnlVersion.Text = "Version";
|
|
//
|
|
// mainMenu1
|
|
//
|
|
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
|
|
this.menuItem1,
|
|
this.menuItem2,
|
|
this.menuItem9});
|
|
//
|
|
// menuItem1
|
|
//
|
|
this.menuItem1.Index = 0;
|
|
this.menuItem1.Text = "File";
|
|
//
|
|
// menuItem2
|
|
//
|
|
this.menuItem2.Index = 1;
|
|
this.menuItem2.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
|
|
this.menuBackup,
|
|
this.menuRestore,
|
|
this.menuXMLTableViewer,
|
|
this.menuItem3,
|
|
this.menuSendMail,
|
|
this.menuItem4,
|
|
this.menuItem5,
|
|
this.menuUnzip,
|
|
this.menuItem6,
|
|
this.menuItem7,
|
|
this.menuItem8});
|
|
this.menuItem2.Text = "Tools";
|
|
//
|
|
// menuBackup
|
|
//
|
|
this.menuBackup.Index = 0;
|
|
this.menuBackup.Text = "Backup Database";
|
|
this.menuBackup.Click += new System.EventHandler(this.menuBackup_Click);
|
|
//
|
|
// menuRestore
|
|
//
|
|
this.menuRestore.Index = 1;
|
|
this.menuRestore.Text = "Restore Database";
|
|
this.menuRestore.Click += new System.EventHandler(this.menuRestore_Click);
|
|
//
|
|
// menuXMLTableViewer
|
|
//
|
|
this.menuXMLTableViewer.Index = 2;
|
|
this.menuXMLTableViewer.Text = "XML Table Viewer";
|
|
this.menuXMLTableViewer.Click += new System.EventHandler(this.menuXMLTableViewer_Click);
|
|
//
|
|
// menuItem3
|
|
//
|
|
this.menuItem3.Index = 3;
|
|
this.menuItem3.Text = "-";
|
|
//
|
|
// menuSendMail
|
|
//
|
|
this.menuSendMail.Index = 4;
|
|
this.menuSendMail.Text = "Send Mail";
|
|
this.menuSendMail.Click += new System.EventHandler(this.menuSendMail_Click);
|
|
//
|
|
// menuItem4
|
|
//
|
|
this.menuItem4.Index = 5;
|
|
this.menuItem4.Text = "-";
|
|
//
|
|
// menuItem5
|
|
//
|
|
this.menuItem5.Index = 6;
|
|
this.menuItem5.Text = "Zip";
|
|
this.menuItem5.Click += new System.EventHandler(this.menuItem5_Click);
|
|
//
|
|
// menuUnzip
|
|
//
|
|
this.menuUnzip.Index = 7;
|
|
this.menuUnzip.Text = "Unzip";
|
|
this.menuUnzip.Click += new System.EventHandler(this.menuUnzip_Click);
|
|
//
|
|
// menuItem6
|
|
//
|
|
this.menuItem6.Index = 8;
|
|
this.menuItem6.Text = "Scan";
|
|
this.menuItem6.Click += new System.EventHandler(this.menuItem6_Click);
|
|
//
|
|
// menuItem7
|
|
//
|
|
this.menuItem7.Index = 9;
|
|
this.menuItem7.Text = "-";
|
|
//
|
|
// menuItem8
|
|
//
|
|
this.menuItem8.Index = 10;
|
|
this.menuItem8.Text = "Clear All Saved Connections";
|
|
this.menuItem8.Click += new System.EventHandler(this.menuItem8_Click);
|
|
//
|
|
// menuItem9
|
|
//
|
|
this.menuItem9.Index = 2;
|
|
this.menuItem9.Text = "Help";
|
|
//
|
|
// txtQuery
|
|
//
|
|
this.txtQuery.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
|
| System.Windows.Forms.AnchorStyles.Left)
|
|
| System.Windows.Forms.AnchorStyles.Right)));
|
|
this.txtQuery.BackColor = System.Drawing.SystemColors.Window;
|
|
this.txtQuery.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
this.txtQuery.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
this.txtQuery.Location = new System.Drawing.Point(24, 112);
|
|
this.txtQuery.Name = "txtQuery";
|
|
this.txtQuery.ShowSelectionMargin = true;
|
|
this.txtQuery.Size = new System.Drawing.Size(910, 211);
|
|
this.txtQuery.TabIndex = 4;
|
|
this.txtQuery.Text = "";
|
|
this.txtQuery.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtQuery_KeyDown);
|
|
//
|
|
// pnlResult
|
|
//
|
|
this.pnlResult.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
|
this.pnlResult.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
this.pnlResult.Controls.Add(this.cboTables);
|
|
this.pnlResult.Controls.Add(this.label6);
|
|
this.pnlResult.Controls.Add(this.lblTables);
|
|
this.pnlResult.Location = new System.Drawing.Point(24, 323);
|
|
this.pnlResult.Name = "pnlResult";
|
|
this.pnlResult.Size = new System.Drawing.Size(437, 32);
|
|
this.pnlResult.TabIndex = 5;
|
|
this.pnlResult.Visible = false;
|
|
//
|
|
// cboTables
|
|
//
|
|
this.cboTables.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
|
this.cboTables.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
|
this.cboTables.Location = new System.Drawing.Point(103, 3);
|
|
this.cboTables.Name = "cboTables";
|
|
this.cboTables.Size = new System.Drawing.Size(328, 21);
|
|
this.cboTables.TabIndex = 1;
|
|
this.cboTables.SelectedIndexChanged += new System.EventHandler(this.cboTables_SelectedIndexChanged);
|
|
//
|
|
// label6
|
|
//
|
|
this.label6.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
|
this.label6.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
this.label6.Location = new System.Drawing.Point(-1, 6);
|
|
this.label6.Name = "label6";
|
|
this.label6.Size = new System.Drawing.Size(100, 16);
|
|
this.label6.TabIndex = 0;
|
|
this.label6.Text = "Result Table";
|
|
//
|
|
// lblTables
|
|
//
|
|
this.lblTables.Anchor = System.Windows.Forms.AnchorStyles.Left;
|
|
this.lblTables.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
this.lblTables.Location = new System.Drawing.Point(488, 8);
|
|
this.lblTables.Name = "lblTables";
|
|
this.lblTables.Size = new System.Drawing.Size(256, 16);
|
|
this.lblTables.TabIndex = 2;
|
|
//
|
|
// saveFileDialog1
|
|
//
|
|
this.saveFileDialog1.DefaultExt = "CSV (*.csv)";
|
|
//
|
|
// btnBrowse
|
|
//
|
|
this.btnBrowse.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
|
|
this.btnBrowse.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
this.btnBrowse.Location = new System.Drawing.Point(728, 79);
|
|
this.btnBrowse.Name = "btnBrowse";
|
|
this.btnBrowse.Size = new System.Drawing.Size(88, 23);
|
|
this.btnBrowse.TabIndex = 3;
|
|
this.btnBrowse.Text = "Browse";
|
|
this.btnBrowse.Click += new System.EventHandler(this.btnBrowse_Click);
|
|
//
|
|
// txtQryFile
|
|
//
|
|
this.txtQryFile.BackColor = System.Drawing.Color.Gainsboro;
|
|
this.txtQryFile.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
this.txtQryFile.Location = new System.Drawing.Point(104, 80);
|
|
this.txtQryFile.Name = "txtQryFile";
|
|
this.txtQryFile.Size = new System.Drawing.Size(616, 20);
|
|
this.txtQryFile.TabIndex = 2;
|
|
//
|
|
// label7
|
|
//
|
|
this.label7.Location = new System.Drawing.Point(24, 80);
|
|
this.label7.Name = "label7";
|
|
this.label7.Size = new System.Drawing.Size(72, 16);
|
|
this.label7.TabIndex = 1;
|
|
this.label7.Text = "Query File";
|
|
this.label7.Click += new System.EventHandler(this.label7_Click);
|
|
//
|
|
// openFileDialog1
|
|
//
|
|
this.openFileDialog1.Filter = "Ease Query File (*.EQF)|*.EQF";
|
|
this.openFileDialog1.Title = "Ease Query File";
|
|
//
|
|
// chkSafeExecution
|
|
//
|
|
this.chkSafeExecution.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
|
this.chkSafeExecution.AutoSize = true;
|
|
this.chkSafeExecution.Checked = true;
|
|
this.chkSafeExecution.CheckState = System.Windows.Forms.CheckState.Checked;
|
|
this.chkSafeExecution.Font = new System.Drawing.Font("Microsoft Sans Serif", 7F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
this.chkSafeExecution.Location = new System.Drawing.Point(234, 548);
|
|
this.chkSafeExecution.Name = "chkSafeExecution";
|
|
this.chkSafeExecution.Size = new System.Drawing.Size(111, 17);
|
|
this.chkSafeExecution.TabIndex = 11;
|
|
this.chkSafeExecution.Text = "Safe Execution";
|
|
this.chkSafeExecution.UseVisualStyleBackColor = true;
|
|
//
|
|
// panel2
|
|
//
|
|
this.panel2.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
|
| System.Windows.Forms.AnchorStyles.Right)));
|
|
this.panel2.Controls.Add(this.label9);
|
|
this.panel2.Controls.Add(this.label8);
|
|
this.panel2.Location = new System.Drawing.Point(467, 323);
|
|
this.panel2.Name = "panel2";
|
|
this.panel2.Size = new System.Drawing.Size(467, 32);
|
|
this.panel2.TabIndex = 6;
|
|
//
|
|
// label9
|
|
//
|
|
this.label9.AutoSize = true;
|
|
this.label9.ForeColor = System.Drawing.Color.MidnightBlue;
|
|
this.label9.Location = new System.Drawing.Point(3, 17);
|
|
this.label9.Name = "label9";
|
|
this.label9.Size = new System.Drawing.Size(355, 13);
|
|
this.label9.TabIndex = 1;
|
|
this.label9.Text = "To specify output TableName, write sql like yourSQL@OutputTableName";
|
|
//
|
|
// label8
|
|
//
|
|
this.label8.AutoSize = true;
|
|
this.label8.ForeColor = System.Drawing.Color.MidnightBlue;
|
|
this.label8.Location = new System.Drawing.Point(3, 1);
|
|
this.label8.Name = "label8";
|
|
this.label8.Size = new System.Drawing.Size(279, 13);
|
|
this.label8.TabIndex = 0;
|
|
this.label8.Text = "To run multiple sql, seperate them using Pipe ( | ) operator.";
|
|
//
|
|
// lblRes
|
|
//
|
|
this.lblRes.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
|
| System.Windows.Forms.AnchorStyles.Right)));
|
|
this.lblRes.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
|
|
this.lblRes.Location = new System.Drawing.Point(24, 355);
|
|
this.lblRes.Name = "lblRes";
|
|
this.lblRes.ReadOnly = true;
|
|
this.lblRes.Size = new System.Drawing.Size(910, 176);
|
|
this.lblRes.TabIndex = 18;
|
|
this.lblRes.Text = "";
|
|
//
|
|
// btnClose
|
|
//
|
|
this.btnClose.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
|
|
this.btnClose.BackColor = System.Drawing.Color.WhiteSmoke;
|
|
this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
|
this.btnClose.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
|
this.btnClose.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
this.btnClose.Location = new System.Drawing.Point(847, 538);
|
|
this.btnClose.Name = "btnClose";
|
|
this.btnClose.Size = new System.Drawing.Size(88, 33);
|
|
this.btnClose.TabIndex = 15;
|
|
this.btnClose.Text = "Close";
|
|
this.btnClose.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
|
|
this.btnClose.UseVisualStyleBackColor = false;
|
|
this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
|
|
//
|
|
// btnValidate
|
|
//
|
|
this.btnValidate.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
|
|
this.btnValidate.BackColor = System.Drawing.Color.WhiteSmoke;
|
|
this.btnValidate.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
|
this.btnValidate.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
this.btnValidate.Location = new System.Drawing.Point(480, 538);
|
|
this.btnValidate.Name = "btnValidate";
|
|
this.btnValidate.Size = new System.Drawing.Size(83, 33);
|
|
this.btnValidate.TabIndex = 17;
|
|
this.btnValidate.Text = "Validate";
|
|
this.btnValidate.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
|
|
this.btnValidate.UseVisualStyleBackColor = false;
|
|
this.btnValidate.Click += new System.EventHandler(this.btnValidate_Click);
|
|
//
|
|
// btnToCSV
|
|
//
|
|
this.btnToCSV.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
|
|
this.btnToCSV.BackColor = System.Drawing.Color.WhiteSmoke;
|
|
this.btnToCSV.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
|
this.btnToCSV.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
this.btnToCSV.Location = new System.Drawing.Point(663, 538);
|
|
this.btnToCSV.Name = "btnToCSV";
|
|
this.btnToCSV.Size = new System.Drawing.Size(83, 33);
|
|
this.btnToCSV.TabIndex = 13;
|
|
this.btnToCSV.Text = "To CSV";
|
|
this.btnToCSV.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
|
|
this.btnToCSV.UseVisualStyleBackColor = false;
|
|
this.btnToCSV.Click += new System.EventHandler(this.btnToCSV_Click);
|
|
//
|
|
// btnRun
|
|
//
|
|
this.btnRun.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
|
|
this.btnRun.BackColor = System.Drawing.Color.WhiteSmoke;
|
|
this.btnRun.FlatAppearance.MouseDownBackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224)))));
|
|
this.btnRun.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
|
this.btnRun.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
this.btnRun.Location = new System.Drawing.Point(571, 538);
|
|
this.btnRun.Name = "btnRun";
|
|
this.btnRun.Size = new System.Drawing.Size(83, 33);
|
|
this.btnRun.TabIndex = 12;
|
|
this.btnRun.Text = "Run";
|
|
this.btnRun.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
|
|
this.btnRun.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
|
|
this.btnRun.UseVisualStyleBackColor = false;
|
|
this.btnRun.Click += new System.EventHandler(this.btnRun_Click);
|
|
//
|
|
// btnToXML
|
|
//
|
|
this.btnToXML.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
|
|
this.btnToXML.BackColor = System.Drawing.Color.WhiteSmoke;
|
|
this.btnToXML.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
|
this.btnToXML.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
|
this.btnToXML.Location = new System.Drawing.Point(755, 538);
|
|
this.btnToXML.Name = "btnToXML";
|
|
this.btnToXML.Size = new System.Drawing.Size(83, 33);
|
|
this.btnToXML.TabIndex = 14;
|
|
this.btnToXML.Text = "To XML";
|
|
this.btnToXML.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
|
|
this.btnToXML.UseVisualStyleBackColor = false;
|
|
this.btnToXML.Click += new System.EventHandler(this.btnToXML_Click);
|
|
//
|
|
// frmQueryAnalyzer
|
|
//
|
|
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
|
|
this.BackColor = System.Drawing.Color.Gainsboro;
|
|
this.CancelButton = this.btnClose;
|
|
this.ClientSize = new System.Drawing.Size(958, 598);
|
|
this.Controls.Add(this.lblRes);
|
|
this.Controls.Add(this.btnValidate);
|
|
this.Controls.Add(this.panel2);
|
|
this.Controls.Add(this.chkSafeExecution);
|
|
this.Controls.Add(this.btnBrowse);
|
|
this.Controls.Add(this.txtQryFile);
|
|
this.Controls.Add(this.label7);
|
|
this.Controls.Add(this.pnlResult);
|
|
this.Controls.Add(this.btnToCSV);
|
|
this.Controls.Add(this.txtQuery);
|
|
this.Controls.Add(this.stbMain);
|
|
this.Controls.Add(this.groupBox1);
|
|
this.Controls.Add(this.ckExecute);
|
|
this.Controls.Add(this.btnRun);
|
|
this.Controls.Add(this.dgRes);
|
|
this.Controls.Add(this.btnClose);
|
|
this.Controls.Add(this.ckSelect);
|
|
this.Controls.Add(this.btnToXML);
|
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
|
|
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
|
this.Menu = this.mainMenu1;
|
|
this.Name = "frmQueryAnalyzer";
|
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
|
this.Text = "Ease Query Analyzer";
|
|
this.Load += new System.EventHandler(this.frmQueryAnalyzer_Load);
|
|
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.frmQueryAnalyzer_KeyDown);
|
|
((System.ComponentModel.ISupportInitialize)(this.dgRes)).EndInit();
|
|
this.groupBox1.ResumeLayout(false);
|
|
this.groupBox1.PerformLayout();
|
|
((System.ComponentModel.ISupportInitialize)(this.status)).EndInit();
|
|
((System.ComponentModel.ISupportInitialize)(this.pnlVersion)).EndInit();
|
|
this.pnlResult.ResumeLayout(false);
|
|
this.panel2.ResumeLayout(false);
|
|
this.panel2.PerformLayout();
|
|
this.ResumeLayout(false);
|
|
this.PerformLayout();
|
|
|
|
}
|
|
#endregion
|
|
|
|
private DataSet _oDataSet = new DataSet();
|
|
private DataTable _oCurrentTable = null;
|
|
private bool _IsCheck = false;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private void btnRun_Click(object sender, System.EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (txtSource.Text == string.Empty) throw new Exception("Enter the Data Source or Server name");
|
|
if (txtUser.Text == string.Empty) throw new Exception("Enter the Database User");
|
|
if (cbProvider.SelectedItem.ToString() == "SQLOLEDB" && txtDB.Text == string.Empty) throw new Exception("Enter the Database name");
|
|
lblRes.Text = "";
|
|
if (txtQuery.Text == "") return;
|
|
|
|
if (cboConnections.SelectedItem == null) UseTempConnection();
|
|
|
|
BORunSQL oBOSql = new BORunSQL();
|
|
|
|
_oDataSet = new DataSet();
|
|
_oCurrentTable = null;
|
|
dgRes.DataSource = null;
|
|
cboTables.Items.Clear();
|
|
lblTables.Text = "";
|
|
pnlResult.Visible = false;
|
|
|
|
if (ckSelect.Checked)
|
|
{
|
|
lblRes.Visible = false;
|
|
dgRes.Visible = true;
|
|
|
|
if (txtQuery.SelectedText == "")
|
|
oBOSql.Select(txtQuery.Text, _oDataSet, chkSafeExecution.Checked);
|
|
else
|
|
oBOSql.Select(txtQuery.SelectedText, txtSource.Text, txtDB.Text, cbProvider.SelectedItem.ToString(), txtUser.Text, txtPassword.Text, _oDataSet, chkSafeExecution.Checked);
|
|
|
|
|
|
if (_oDataSet != null && _oDataSet.Tables.Count > 1)
|
|
{
|
|
pnlResult.Visible = true;
|
|
foreach (DataTable oTable in _oDataSet.Tables)
|
|
{
|
|
cboTables.Items.Add(oTable.TableName);
|
|
}
|
|
lblTables.Text = "Total Tables : " + _oDataSet.Tables.Count;
|
|
}
|
|
else if (_oDataSet != null && _oDataSet.Tables.Count > 0)
|
|
{
|
|
_oCurrentTable = _oDataSet.Tables[0];
|
|
dgRes.DataSource = _oCurrentTable;
|
|
EGlobal.SetStatusBusy("Rows returned " + _oCurrentTable.Rows.Count.ToString());
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
lblRes.Visible = true;
|
|
dgRes.Visible = false;
|
|
if (!_IsCheck)
|
|
lblRes.Text = oBOSql.ExecuteQuery(txtQuery.Text, txtSource.Text, txtDB.Text, cbProvider.SelectedItem.ToString(), txtUser.Text, txtPassword.Text, chkSafeExecution.Checked, _IsCheck);
|
|
else
|
|
{
|
|
string msg = oBOSql.ExecuteQuery(txtQuery.Text, txtSource.Text, txtDB.Text, cbProvider.SelectedItem.ToString(), txtUser.Text, txtPassword.Text, chkSafeExecution.Checked, _IsCheck);
|
|
lblRes.Text = "Validated.\n\nAfter execution following changes will occures :\n" + msg;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(ex.Message, "Ease Query Analyzer", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
}
|
|
}
|
|
|
|
private void ckSelect_CheckedChanged(object sender, System.EventArgs e)
|
|
{
|
|
ckExecute.Checked = !ckSelect.Checked;
|
|
chkSafeExecution.Checked = true;
|
|
chkSafeExecution.Enabled = !ckSelect.Checked;
|
|
}
|
|
|
|
private void ckExecute_CheckedChanged(object sender, System.EventArgs e)
|
|
{
|
|
ckSelect.Checked = !ckExecute.Checked;
|
|
chkSafeExecution.Checked = true;
|
|
chkSafeExecution.Enabled = true;
|
|
}
|
|
|
|
private void btnClose_Click(object sender, System.EventArgs e)
|
|
{
|
|
this.Close();
|
|
}
|
|
|
|
private void frmQueryAnalyzer_Load(object sender, System.EventArgs e)
|
|
{
|
|
cbProvider.SelectedIndex = 0;
|
|
EGlobal.RegisterControl(stbMain);
|
|
GetConncections();
|
|
|
|
string[] ver = Application.ProductVersion.Split('.');
|
|
this.Text = "Ease Query Analyzer " + ver[0] + "." + ver[1];
|
|
pnlVersion.Text = "Ver : " + Application.ProductVersion;
|
|
EGlobal.SetStatusBusy("Ready to perform tasks");
|
|
|
|
Payroll.BO.SystemInformation sysInfo = new Payroll.BO.SystemInformation();
|
|
string sConString= sysInfo.GetConnectionString();
|
|
string sTempString = "";
|
|
string sServer = "";
|
|
string sDB = "";
|
|
string sUserID = "";
|
|
string sPass = "";
|
|
int count = 0;
|
|
string[] vars = sConString.Split('=',';');
|
|
foreach (string v in vars)
|
|
{
|
|
if (count == 1)
|
|
txtSource.Text = v;
|
|
else if (count == 3)
|
|
txtDB.Text = v;
|
|
else if (count == 5)
|
|
{
|
|
if (v.ToLower() == "yes")
|
|
txtUser.Text = "Windows Authentication";
|
|
else
|
|
txtUser.Text = v;
|
|
}
|
|
else if (count == 7)
|
|
txtPassword.Text = v;
|
|
|
|
count++;
|
|
}
|
|
|
|
}
|
|
|
|
private void menuRestore_Click(object sender, System.EventArgs e)
|
|
{
|
|
frmRestore frm = new frmRestore();
|
|
frm.ShowDialog();
|
|
}
|
|
|
|
private void menuBackup_Click(object sender, System.EventArgs e)
|
|
{
|
|
frmBackup frm = new frmBackup();
|
|
frm.ShowDialog();
|
|
}
|
|
|
|
private void menuXMLTableViewer_Click(object sender, System.EventArgs e)
|
|
{
|
|
frmXMLViewer ofrm = new frmXMLViewer();
|
|
ofrm.Show();
|
|
}
|
|
|
|
private void btnToCSV_Click(object sender, System.EventArgs e)
|
|
{
|
|
if (_oCurrentTable != null)
|
|
{
|
|
try
|
|
{
|
|
string sSaveFilename = "";
|
|
saveFileDialog1.FileName = _oCurrentTable.TableName;
|
|
saveFileDialog1.DefaultExt = "csv";
|
|
saveFileDialog1.Filter = "CSV (*.csv)|*.csv";
|
|
if (saveFileDialog1.ShowDialog() != DialogResult.Cancel)
|
|
{
|
|
sSaveFilename = saveFileDialog1.FileName;
|
|
if (sSaveFilename == "")
|
|
{
|
|
MessageBox.Show("Enter file name to save");
|
|
return;
|
|
}
|
|
StreamWriter oWriter = new StreamWriter(sSaveFilename);
|
|
string sText = "";
|
|
foreach (DataColumn oCol in _oCurrentTable.Columns)
|
|
{
|
|
if (sText != "")
|
|
sText += "," + oCol.ColumnName;
|
|
else
|
|
sText = oCol.ColumnName;
|
|
}
|
|
oWriter.WriteLine(sText);
|
|
oWriter.Flush();
|
|
|
|
|
|
foreach (DataRow oRow in _oCurrentTable.Rows)
|
|
{
|
|
sText = "";
|
|
for (int i = 0; i < oRow.ItemArray.Length; i++)
|
|
{
|
|
if (sText != "")
|
|
sText += "," + oRow.ItemArray[i].ToString();
|
|
else
|
|
sText = oRow.ItemArray[i].ToString();
|
|
}
|
|
oWriter.WriteLine(sText);
|
|
oWriter.Flush();
|
|
|
|
}
|
|
oWriter.Close();
|
|
MessageBox.Show("Successfully Created the in " + sSaveFilename, "Ease Query Analyzer", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(ex.Message, "Ease Query Analyzer", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("No table is selected", "Ease Query Analyzer", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
}
|
|
|
|
}
|
|
|
|
private void cboTables_SelectedIndexChanged(object sender, System.EventArgs e)
|
|
{
|
|
if (cboTables.SelectedItem != null)
|
|
{
|
|
_oCurrentTable = _oDataSet.Tables[cboTables.SelectedIndex];
|
|
dgRes.DataSource = _oCurrentTable;
|
|
|
|
EGlobal.SetStatusBusy("Total Rows : " + _oCurrentTable.Rows.Count.ToString());
|
|
}
|
|
}
|
|
|
|
private void btnToXML_Click(object sender, System.EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
string sSaveFilename = "";
|
|
saveFileDialog1.FileName = _oCurrentTable.TableName;
|
|
saveFileDialog1.DefaultExt = "xml";
|
|
saveFileDialog1.Filter = "XML (*.xml)|*.xml";
|
|
if (saveFileDialog1.ShowDialog() != DialogResult.Cancel)
|
|
{
|
|
sSaveFilename = saveFileDialog1.FileName;
|
|
if (sSaveFilename == "")
|
|
{
|
|
MessageBox.Show("Enter file name to save", "Ease Query Analyzer", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
return;
|
|
}
|
|
if (_oDataSet != null)
|
|
{
|
|
_oDataSet.WriteXml(sSaveFilename);
|
|
}
|
|
else
|
|
{
|
|
MessageBox.Show("There is no data to save", "Ease Query Analyzer", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
return;
|
|
}
|
|
MessageBox.Show("Successfully Created the in " + sSaveFilename, "Ease Query Analyzer", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(ex.Message, "Ease Query Analyzer", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
|
}
|
|
}
|
|
|
|
private void label7_Click(object sender, System.EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void btnBrowse_Click(object sender, System.EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
txtQuery.Text = "";
|
|
lblRes.Text = "";
|
|
openFileDialog1.ShowDialog();
|
|
string sFile = openFileDialog1.FileName;
|
|
if (sFile != "")
|
|
{
|
|
if (!File.Exists(sFile))
|
|
{
|
|
throw new Exception("File is not Exist");
|
|
}
|
|
txtQryFile.Text = sFile;
|
|
StreamReader oSReader = new StreamReader(sFile);
|
|
txtQuery.Text = oSReader.ReadToEnd();
|
|
oSReader.Close();
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(ex.Message);
|
|
}
|
|
}
|
|
|
|
private void menuSendMail_Click(object sender, System.EventArgs e)
|
|
{
|
|
//frmMail ofrm=new frmMail();
|
|
//ofrm.Show();
|
|
}
|
|
|
|
private void menuUnzip_Click(object sender, System.EventArgs e)
|
|
{
|
|
//frmUnzip ofrm=new frmUnzip();
|
|
//ofrm.ShowDialog();
|
|
}
|
|
|
|
private void menuItem6_Click(object sender, System.EventArgs e)
|
|
{
|
|
//frmtblScan ofrm= new frmtblScan();
|
|
//ofrm.ShowDialog();
|
|
}
|
|
|
|
|
|
private void txtQuery_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.F5)
|
|
{
|
|
btnRun_Click(null, null);
|
|
}
|
|
else if (e.KeyCode == Keys.F6)
|
|
{
|
|
btnValidate_Click(null, null);
|
|
}
|
|
}
|
|
|
|
private void frmQueryAnalyzer_KeyDown(object sender, KeyEventArgs e)
|
|
{
|
|
if (e.KeyCode == Keys.F5)
|
|
{
|
|
btnRun_Click(null, null);
|
|
}
|
|
else if (e.KeyCode == Keys.F6)
|
|
{
|
|
btnValidate_Click(null, null);
|
|
}
|
|
}
|
|
|
|
private void btnValidate_Click(object sender, EventArgs e)
|
|
{
|
|
_IsCheck = true;
|
|
btnRun_Click(null, null);
|
|
_IsCheck = false;
|
|
}
|
|
|
|
private void btnConnectionCheck_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (cbProvider.Text.ToUpper() != "MSDAORA" && string.IsNullOrEmpty(txtDB.Text.Trim())) throw new Exception("Database Name is not specified.");
|
|
if (string.IsNullOrEmpty(txtSource.Text.Trim())) throw new Exception("Data Source is not specified.");
|
|
if (string.IsNullOrEmpty(txtUser.Text.Trim())) throw new Exception("User ID is not specified.");
|
|
|
|
Connection con = new Connection();
|
|
con.DataBase = txtDB.Text;
|
|
con.DataSource = txtSource.Text;
|
|
con.UserID = txtUser.Text;
|
|
con.Password = txtPassword.Text;
|
|
con.Provider = cbProvider.Text;
|
|
con.Key = con.DataSource + "-" + con.DataBase + "-" + con.UserID;
|
|
con.Save();
|
|
GetConncections();
|
|
cboConnections.SelectedValue = con.Key;
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageBox.Show(ex.Message);
|
|
}
|
|
}
|
|
|
|
private void GetConncections()
|
|
{
|
|
Connections cons = new Connections();
|
|
cons = cons.GetConnections();
|
|
if (cons != null)
|
|
{
|
|
cboConnections.DataSource = cons;
|
|
cboConnections.DisplayMember = "Key";
|
|
cboConnections.ValueMember = "Key";
|
|
if (cboConnections.Items.Count > 0)
|
|
cboConnections.SelectedIndex = -1;
|
|
}
|
|
|
|
|
|
}
|
|
|
|
private void cboConnections_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
|
|
if (cboConnections.SelectedItem != null)
|
|
{
|
|
Connection con = cboConnections.SelectedItem as Connection;
|
|
txtDB.Text = con.DataBase;
|
|
txtSource.Text = con.DataSource;
|
|
txtUser.Text = con.UserID;
|
|
txtPassword.Text = con.Password;
|
|
cbProvider.SelectedItem = con.Provider;
|
|
ETransactionContext.CurrentConnection = con;
|
|
}
|
|
}
|
|
|
|
private void menuItem8_Click(object sender, EventArgs e)
|
|
{
|
|
Connection.ClearAllConnection();
|
|
GetConncections();
|
|
txtDB.Text = "";
|
|
txtPassword.Text = "";
|
|
txtSource.Text = "";
|
|
txtUser.Text = "";
|
|
cbProvider.SelectedIndex = 0;
|
|
txtSource.Focus();
|
|
MessageBox.Show("Successfully Cleared");
|
|
}
|
|
|
|
private void UseTempConnection()
|
|
{
|
|
if (cboConnections.SelectedItem == null)
|
|
{
|
|
Connection con = new Connection();
|
|
con.DataBase = txtDB.Text;
|
|
con.DataSource = txtSource.Text;
|
|
con.UserID = txtUser.Text;
|
|
con.Password = txtPassword.Text;
|
|
con.Provider = cbProvider.Text;
|
|
ETransactionContext.CurrentConnection = con;
|
|
}
|
|
}
|
|
|
|
private void menuItem5_Click(object sender, EventArgs e)
|
|
{
|
|
frmZip frmzip = new frmZip();
|
|
frmzip.ShowDialog();
|
|
}
|
|
|
|
private void button1_Click(object sender, EventArgs e)
|
|
{
|
|
frmGetDecryptedPassword dp = new frmGetDecryptedPassword();
|
|
dp.ShowDialog();
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
|