コード例 #1
0
        private void SetUI(CnnString cnn)
        {
            WindowsAutentificaction.Checked = cnn.WindowsAutentification;


            cmbDataBases.Text = cnn.InitialCatalog;
            cmbServer.Text    = cnn.DataSource;

            if (cnn.WindowsAutentification)
            {
                txtUserName.Text      = string.Empty;
                txtPassword.Text      = string.Empty;
                txtUserName.Enabled   = false;
                txtPassword.Enabled   = false;
                lblUserName.ForeColor = System.Drawing.Color.Black;
                lblPassword.ForeColor = System.Drawing.Color.Black;
            }
            else
            {
                txtUserName.Text      = cnn.User;
                txtPassword.Text      = cnn.Password;
                txtUserName.Enabled   = true;
                txtPassword.Enabled   = true;
                lblUserName.ForeColor = System.Drawing.Color.DimGray;
                lblPassword.ForeColor = System.Drawing.Color.DimGray;
            }

            if (string.IsNullOrEmpty(cnn.DataSource) || string.IsNullOrEmpty(cnn.InitialCatalog))
            {
                return;
            }

            txtCnnString.Text = cnn.ToString();
        }
コード例 #2
0
ファイル: wizDBSelect.cs プロジェクト: Kmiiloberrio2/fwk_12
        /// <summary>
        /// Carga las bses de datos del server
        /// </summary>
        /// <param name="pCnnString"></param>
        void FillDatabaseCombo(CnnString pCnnString)
        {
            if (onInitServerCollection)
            {
                return;
            }


            SqlConnection sqlConnection = new SqlConnection(pCnnString.ToString());

            ServerConnection serverConnection = new ServerConnection(sqlConnection);

            try
            {
                _Server = new Server(serverConnection);
                cmbDataBases.Items.Clear();
                foreach (Database db in _Server.Databases)
                {
                    cmbDataBases.Items.Add(db.Name);
                }
                cmbDataBases.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                MessageBox.Show(Fwk.CodeGenerator.HelperFunctions.GetAllMessageException(ex), Fwk.GuidPk.Properties.Resources.ProductTitle);
            }
        }
コード例 #3
0
        public bool Test()
        {
            _cnn = GetAuxiliarCnnString();

            if (string.IsNullOrEmpty(_cnn.DataSource))
            {
                MessageBox.Show("Ingrese servidor de SQL.-", Fwk.GuidPk.Properties.Resources.ProductTitle);
                cmbServer.Focus();
                return(false);
            }

            if (string.IsNullOrEmpty(_cnn.InitialCatalog))
            {
                MessageBox.Show("Seleccione o ingrese una base de datos.-", Fwk.GuidPk.Properties.Resources.ProductTitle);
                cmbDataBases.Focus();
                return(false);
            }



            if (!_cnn.WindowsAutentification)
            {
                if (string.IsNullOrEmpty(_cnn.User))
                {
                    MessageBox.Show("Ingrese usuario.-", Fwk.GuidPk.Properties.Resources.ProductTitle);
                    txtUserName.Focus();
                    return(false);
                }
            }
            SqlConnection sqlConnection = new SqlConnection(_cnn.ToString());

            Microsoft.SqlServer.Management.Common.ServerConnection serverConnection =
                new Microsoft.SqlServer.Management.Common.ServerConnection(sqlConnection);

            try
            {
                _Server = new Server(serverConnection);

                //_Server.Databases[_cnn.InitialCatalog].Tables.Refresh();

                ////iterate over all Databases
                //foreach (Database db in _Server.Databases)

                //{
                MessageBox.Show("Coneccion exitosa.- a " + _Server.Information.Product.ToString(), Fwk.GuidPk.Properties.Resources.ProductTitle);


                //}
            }
            catch (Exception ex)
            {
                MessageBox.Show(Fwk.CodeGenerator.HelperFunctions.GetAllMessageException(ex), Fwk.GuidPk.Properties.Resources.ProductTitle);
                return(false);
            }
            return(true);
        }
コード例 #4
0
ファイル: wizDBSelect.cs プロジェクト: Kmiiloberrio2/fwk_12
        private void btnTestConnection_Click(object sender, EventArgs e)
        {
            _cnn = GetAuxiliarCnnString();

            if (string.IsNullOrEmpty(_cnn.DataSource))
            {
                MessageBox.Show("Ingrese servidor de SQL.-", "Fwk wizard");
                cmbServer.Focus();
                return;
            }

            if (string.IsNullOrEmpty(_cnn.InitialCatalog))
            {
                MessageBox.Show("Seleccione o ingrese una base de datos.-", "Fwk wizard");
                cmbDataBases.Focus();
                return;
            }



            if (!_cnn.WindowsAutentification)
            {
                if (string.IsNullOrEmpty(_cnn.User))
                {
                    MessageBox.Show("Ingrese usuario.-", "Fwk wizard");
                    txtUserName.Focus();
                    return;
                }
            }
            SqlConnection sqlConnection = new SqlConnection(_cnn.ToString());

            Microsoft.SqlServer.Management.Common.ServerConnection serverConnection =
                new Microsoft.SqlServer.Management.Common.ServerConnection(sqlConnection);

            try
            {
                _Server = new Server(serverConnection);


                ////iterate over all Databases
                foreach (Database db in _Server.Databases)
                {
                    MessageBox.Show("Coneccion exitosa.-", "Fwk wizard");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(HelperFunctions.GetAllMessageException(ex), "Fwk wizard");
            }
        }
コード例 #5
0
        public void setIDictionaryService(CnnString cnn)
        {
            IDictionaryService dictionaryService = GetService(typeof(IDictionaryService)) as IDictionaryService;

            if (cnn == null)
            {
                dictionaryService.SetValue("ConnectionString", null);
                dictionaryService.SetValue("DatabaseName", null);
            }
            else
            {
                dictionaryService.SetValue("ConnectionString", cnn.ToString());
                dictionaryService.SetValue("DatabaseName", cnn.InitialCatalog);
            }
        }
コード例 #6
0
        private void LoadTables(CnnString cnn)
        {
            SqlConnection    sqlConnection    = new SqlConnection(cnn.ToString());
            ServerConnection serverConnection = new ServerConnection(sqlConnection);

            try
            {
                Server   wServer = new Server(serverConnection);
                Database db      = new Database(wServer, cnn.InitialCatalog);
                db.Views.Refresh();
                _Views = db.Views;
            }
            catch (Exception ex)
            {
                MessageBox.Show(HelperFunctions.GetAllMessageException(ex));
            }
        }
コード例 #7
0
ファイル: wizDBSelect.cs プロジェクト: gpanayir/sffwk
        /// <summary>
        /// Carga las bses de datos del server
        /// </summary>
        /// <param name="pCnnString"></param>
        void FillDatabaseCombo(CnnString pCnnString)
        {
            if (onInitServerCollection) return;


            SqlConnection sqlConnection = new SqlConnection(pCnnString.ToString());

            ServerConnection serverConnection = new ServerConnection(sqlConnection);

            try
            {
                _Server = new Server(serverConnection);
                cmbDataBases.Items.Clear();
                foreach (Database db in _Server.Databases)
                {
                    cmbDataBases.Items.Add(db.Name);
                }
                cmbDataBases.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                MessageBox.Show(HelperFunctions.GetAllMessageException(ex));
            }
        }
コード例 #8
0
ファイル: ctrlTreeViewViews.cs プロジェクト: gpanayir/sffwk
        private void LoadTables(CnnString cnn)
        {
            SqlConnection sqlConnection = new SqlConnection(cnn.ToString());
            ServerConnection serverConnection = new ServerConnection(sqlConnection);

            try
            {
                Server wServer = new Server(serverConnection);
                Database db = new Database(wServer, cnn.InitialCatalog);
                db.Views.Refresh();
               _Views = db.Views;
            }
            catch (Exception ex)
            {
                MessageBox.Show(HelperFunctions.GetAllMessageException(ex));
            }
        }
コード例 #9
0
ファイル: DataBaseServer.cs プロジェクト: gpanayir/sffwk
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pCnnString"></param>
        /// <returns></returns>
        public static bool TestConnection(CnnString pCnnString)
        {
            using (SqlConnection wCnn = new SqlConnection(pCnnString.ToString()))
            {
                try
                {

                    wCnn.Open();

                    wCnn.Close();
                    return true;
                }
                catch (Exception ex)
                {
                    throw new DataBaseExeption(ex, pCnnString);
                }
            }
        }
コード例 #10
0
ファイル: wizDBSelect.cs プロジェクト: gpanayir/sffwk
        private void btnTestConnection_Click(object sender, EventArgs e)
        {
            _cnn = GetAuxiliarCnnString();

            if (string.IsNullOrEmpty(_cnn.DataSource))
            {
                MessageBox.Show("Ingrese servidor de SQL.-", "Fwk wizard");
                cmbServer.Focus();
                return;
            }

            if (string.IsNullOrEmpty(_cnn.InitialCatalog))
            {
                MessageBox.Show("Seleccione o ingrese una base de datos.-","Fwk wizard");
                cmbDataBases.Focus();
                return;
            }

           

            if (!_cnn.WindowsAutentification)
            {
                if (string.IsNullOrEmpty(_cnn.User))
                {
                    MessageBox.Show("Ingrese usuario.-", "Fwk wizard");
                    txtUserName.Focus();
                    return;
                }
            }
            SqlConnection sqlConnection = new SqlConnection(_cnn.ToString());

            Microsoft.SqlServer.Management.Common.ServerConnection serverConnection =
              new Microsoft.SqlServer.Management.Common.ServerConnection(sqlConnection);

            try
            {
                _Server = new Server(serverConnection);
               
               
                ////iterate over all Databases
                foreach (Database db in _Server.Databases)
                {
                    MessageBox.Show("Coneccion exitosa.-", "Fwk wizard");
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(HelperFunctions.GetAllMessageException(ex), "Fwk wizard");
            }
        }
コード例 #11
0
ファイル: wizDbSelect_2.cs プロジェクト: gpanayir/sffwk
        public void setIDictionaryService(CnnString cnn)
        {
            IDictionaryService dictionaryService = GetService(typeof(IDictionaryService)) as IDictionaryService;

            if (cnn == null)
            {
                dictionaryService.SetValue("ConnectionString", null);
                dictionaryService.SetValue("DatabaseName", null);

            }
            else
            {
                dictionaryService.SetValue("ConnectionString", cnn.ToString());
                dictionaryService.SetValue("DatabaseName", cnn.InitialCatalog);
            }


        }
コード例 #12
0
ファイル: wizDbSelect_2.cs プロジェクト: gpanayir/sffwk
        public bool Test()
        {
            _cnn = GetAuxiliarCnnString();

            if (string.IsNullOrEmpty(_cnn.DataSource))
            {
                MessageBox.Show("Ingrese servidor de SQL.-", Fwk.GuidPk.Properties.Resources.ProductTitle);
                cmbServer.Focus();
                return false;
            }

            if (string.IsNullOrEmpty(_cnn.InitialCatalog))
            {
                MessageBox.Show("Seleccione o ingrese una base de datos.-", Fwk.GuidPk.Properties.Resources.ProductTitle);
                cmbDataBases.Focus();
                return false;
            }



            if (!_cnn.WindowsAutentification)
            {
                if (string.IsNullOrEmpty(_cnn.User))
                {
                    MessageBox.Show("Ingrese usuario.-", Fwk.GuidPk.Properties.Resources.ProductTitle);
                    txtUserName.Focus();
                    return false;
                }
            }
            SqlConnection sqlConnection = new SqlConnection(_cnn.ToString());

            Microsoft.SqlServer.Management.Common.ServerConnection serverConnection =
              new Microsoft.SqlServer.Management.Common.ServerConnection(sqlConnection);

            try
            {

                _Server = new Server(serverConnection);

                //_Server.Databases[_cnn.InitialCatalog].Tables.Refresh();

                ////iterate over all Databases
                //foreach (Database db in _Server.Databases)

                //{
                MessageBox.Show("Coneccion exitosa.- a " + _Server.Information.Product.ToString(), Fwk.GuidPk.Properties.Resources.ProductTitle);


                //}

            }
            catch (Exception ex)
            {
                MessageBox.Show(Fwk.CodeGenerator.HelperFunctions.GetAllMessageException(ex), Fwk.GuidPk.Properties.Resources.ProductTitle);
                return false;
            }
            return true;
        }
コード例 #13
0
ファイル: wizDbSelect_2.cs プロジェクト: gpanayir/sffwk
        private void SetUI(CnnString cnn)
        {

            WindowsAutentificaction.Checked = cnn.WindowsAutentification;


            cmbDataBases.Text = cnn.InitialCatalog;
            cmbServer.Text = cnn.DataSource;

            if (cnn.WindowsAutentification)
            {
                txtUserName.Text = string.Empty;
                txtPassword.Text = string.Empty;
                txtUserName.Enabled = false;
                txtPassword.Enabled = false;
                lblUserName.ForeColor = System.Drawing.Color.Black;
                lblPassword.ForeColor = System.Drawing.Color.Black;
            }
            else
            {
                txtUserName.Text = cnn.User;
                txtPassword.Text = cnn.Password;
                txtUserName.Enabled = true;
                txtPassword.Enabled = true;
                lblUserName.ForeColor = System.Drawing.Color.DimGray;
                lblPassword.ForeColor = System.Drawing.Color.DimGray;
            }

            if (string.IsNullOrEmpty(cnn.DataSource) || string.IsNullOrEmpty(cnn.InitialCatalog))
                return;

            txtCnnString.Text = cnn.ToString();

        }