Beispiel #1
0
 public void ApplyDataObject(DataBaseObjectClass aDataObject)
 {
     if (_aDataObject == null || !_aDataObject.Equals(aDataObject))
     {
         _aDataObject   = aDataObject;
         lblDB.Text     = _aDataObject.DatabaseName;
         lblServer.Text = _aDataObject.ServerOrFile;
         TablesAndViewsUI.DataInitialization(_aDataObject);
         ProceduresAndFunctions.DataInitialization(_aDataObject);
         SQLView.DataInitialization(_aDataObject);
     }
 }
Beispiel #2
0
 public UI()
 {
     InitializeComponent();
     m_deserializeDockContent = new DeserializeDockContent(GetContentFromPersistString);
     tablesView               = TablesAndViewsUI.GetPanel;
     sqlView                  = new SQLView();
     sqlView.StoreFileName   += SetSQLFileName;
     sqlView.actualDataTable += ExportDataTable;
     procFunctionView         = ProceduresAndFunctions.GetPanel;
     procFunctionView.PlaceProcInEditWindow += sqlView.PlaceStoredProcInEditBox;
     me = this;
 }
Beispiel #3
0
 private void button14_Click_1(object sender, EventArgs e)
 {
     try
     {
         Hashtable param = new Hashtable();
         param.Add("GoodsCode", txtInput.Text);
         SQLView dlg = new SQLView(cboDatabase.SelectedItem.ToString(), "GoodsInfo", param);
         dlg.Show();
     } catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
Beispiel #4
0
        private void DataGridView1_CellDoubleClick(Object sender, DataGridViewCellEventArgs e)
        {
            DataGridView gridView = (DataGridView)sender;

            string    Code  = string.Empty;
            Form      dlg   = null;
            Hashtable param = null;

            switch (gridView.Columns[e.ColumnIndex].HeaderText)
            {
            case "TypeOfCancel":
            case "DelyStatus":
            case "KindOfSource":
            case "CardName":
            case "SttlType":
            case "DelyMethod":
            case "Status":
            case "ConfirmStatus":
            case "SalesFixStatus":
            case "WHStatus":
            case "KindOfSettle":
            case "SttlStatus":

                Code = gridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString();
                dlg  = new Coded(this.dbServer, Code, string.Empty);
                dlg.Show();

                break;

            case "GoodsCode":

                param = new Hashtable();
                param.Add("GoodsCode", gridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString());
                dlg = new SQLView(this.dbServer, "GoodsInfo", param);
                dlg.Show();

                break;

            case "VoucherPrefix":

                param = new Hashtable();
                param.Add("VoucherPrefix", gridView.Rows[e.RowIndex].Cells[e.ColumnIndex].Value.ToString());
                dlg = new SQLView(this.dbServer, "VoucherPrefix", param);
                dlg.Show();

                break;
            }
        }
Beispiel #5
0
        private void tsbDbConnect_Click(object sender, EventArgs e)
        {
            DataBaseSelection openDatabase = new DataBaseSelection();

            openDatabase.IntitialFolderPath = Application.StartupPath;

            if (openDatabase.ShowDialog() == DialogResult.OK)
            {
                DataLogin dataLogin = openDatabase.Connection;
                _aDataObject = new DataBaseObjectClass(dataLogin.FromDatabase.DataBaseType);
                _aDataObject.Connection(dataLogin.FromDatabase.ServerFile, dataLogin.FromDatabase.DatabaseName, dataLogin.FromDatabase.UserID, dataLogin.FromDatabase.Password, dataLogin.FromDatabase.Integrated);
                lblDB.Text     = _aDataObject.DatabaseName;
                lblServer.Text = _aDataObject.ServerOrFile;
                TablesAndViewsUI.DataInitialization(_aDataObject);
                ProceduresAndFunctions.DataInitialization(_aDataObject);
                SQLView.DataInitialization(_aDataObject);
            }
        }
Beispiel #6
0
        private void _SQLView(SqlInstances sqlInstances)
        {
            if (0 == databases.Count)
            {
                sD = new SQLDatabase(credentials);
                sD.SetComputerName(sqlInstances.Server);
                sD.SetInstance(sqlInstances.ServerInstance);
                if (nodefaults)
                {
                    sD.EnableNoDefaultsFilter();
                }
                if (hasAccess)
                {
                    sD.EnableHasAccessFilter();
                }
                if (sysadmin)
                {
                    sD.EnableSysAdminFilter();
                }
                sD.Query();
                databases = sD.GetResults();
            }

            SQLView sV = new SQLView(credentials);

            sV.SetComputerName(sqlInstances.Server);
            sV.SetInstance(sqlInstances.ServerInstance);
            if (!string.IsNullOrEmpty(TableNameFilter))
            {
                sV.SetTableNameFilter(TableNameFilter);
            }
            var results = new List <SQLView.View>();

            foreach (var d in databases)
            {
                sV.SetDatabase(d.DatabaseName);
                sV.Query();
                results.AddRange(sV.GetResults());
            }
            _PrintOutput(results);
        }
Beispiel #7
0
        private void btnSQLViewer_Click(object sender, EventArgs e)
        {
            SQLView dlg = new SQLView(cboDatabase.SelectedItem.ToString(), null, null);

            dlg.Show();
        }