Exemple #1
0
        public frmWizEntity_1(CnnString cnn)
        {
            this.Cnn = cnn;
            InitializeComponent();

            this.wizDBSelect1.LoadCnn(cnn);
        }
Exemple #2
0
        /// <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));
            }
        }
        /// <summary>
        /// Metodo que permite cargar las tablas en el arbol.
        /// </summary>
        public void Populate(CnnString pCnn)
        {
            if (_Tables == null)
                LoadTables(pCnn);

          
            
            if (_Tables == null)
            {
                this.tvwChilds.Nodes.Clear();
              
                return;
            }
            if (_Tables.Count == 0)
            {
                this.tvwChilds.Nodes.Clear();
                
                return;
            }

            TreeViewHelper.LoadTreeView(this.tvwChilds, _Tables);

            _SelectedTable = _Tables[0];
      


            lblTreeViewSelected.Text = String.Empty;

         
        }
Exemple #4
0
        public frmWizEntity_1(CnnString cnn)
        {
            this.Cnn = cnn;
            InitializeComponent();

            this.wizDBSelect1.LoadCnn(cnn);
        }
        /// <summary>
        /// Metodo que permite cargar las tablas en el arbol.
        /// </summary>
        public void Populate(CnnString pCnn)
        {
            if (_Tables == null)
            {
                LoadTables(pCnn);
            }



            if (_Tables == null)
            {
                this.tvwChilds.Nodes.Clear();

                return;
            }
            if (_Tables.Count == 0)
            {
                this.tvwChilds.Nodes.Clear();

                return;
            }

            TreeViewHelper.LoadTreeView(this.tvwChilds, _Tables);

            _SelectedTable = _Tables[0];



            lblTreeViewSelected.Text = String.Empty;
        }
Exemple #6
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="pCnnString"></param>
        public UserDefinedTypesBack(CnnString pCnnString)

        {
            _CnnString = pCnnString;

            _GetUserDefinedTypesQuery = GetQuery();
            _UserDefinedTypes         = LoadUserDefinedTypes();
        }
Exemple #7
0
        private void btnNext_Click(object sender, EventArgs e)
        {
            _cnn = GetAuxiliarCnnString();
            UserDefinedTypesBack wUserDefinedTypesBack = new UserDefinedTypesBack(_cnn);

            FwkGeneratorHelper.UserDefinedTypes = wUserDefinedTypesBack.UserDefinedTypes;
            base.DoEvent(null, WizardButton.Next);
        }
Exemple #8
0
        private void btnAceptar_Click(object sender, EventArgs e)
        {
            UserDefinedTypesBack wUserDefinedTypesBack = new UserDefinedTypesBack(_cnn);

            FwkGeneratorHelper.UserDefinedTypes = wUserDefinedTypesBack.UserDefinedTypes;
            _cnn = GetAuxiliarCnnString();
            base.DoEvent(_cnn, WizardButton.Ok);
        }
Exemple #9
0
        /// <summary>
        /// Serializa en binario el diccionario
        /// </summary>
        /// <param name="fs"></param>
        /// <param name="dict"></param>
        private static void SerializeDictionary(FileStream fs, CnnString dict)
        {
            // Create a BinaryFormatter object to perform the serialization
            BinaryFormatter bf = new BinaryFormatter();

            // Use the BinaryFormatter object to serialize the data to the file
            bf.Serialize(fs, dict);
            // Close the file
            fs.Close();
        }
Exemple #10
0
        private void cmbDataBases_Click(object sender, EventArgs e)
        {
            if (_cnn == null)
            {
                _cnn = GetAuxiliarCnnString();
            }

            if (!_cnn.DataSource.Equals(cmbServer.Text.Trim()) || cmbDataBases.Items.Count == 0)
            {
                _cnn.DataSource = cmbServer.Text.Trim();
                FillDatabaseCombo(_cnn);
            }
        }
Exemple #11
0
        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");
            }
        }
Exemple #12
0
        /// <summary>
        /// Obtiene un diccionario ConfigManager con la deserializacion en binario del IsolatedStorageFile
        /// Este diccionario contiene el par [NombreArchivo,Ruta]
        /// </summary>
         void Load()
        {
            IsolatedStorageFile userStore = IsolatedStorageFile.GetUserStoreForAssembly();

            //If No data saved for this user
            if (userStore.GetFileNames(EnvDTESetting).Length == 0)
            {
                _CnnString = new CnnString();
                return;
            }

            IsolatedStorageFileStream userStream = new IsolatedStorageFileStream(EnvDTESetting, FileMode.Open, userStore);
            _CnnString = DeSerializeDictionary(userStream);
        }
Exemple #13
0
        /// <summary>
        /// Obtiene un diccionario ConfigManager con la deserializacion en binario del IsolatedStorageFile
        /// Este diccionario contiene el par [NombreArchivo,Ruta]
        /// </summary>
        void Load()
        {
            IsolatedStorageFile userStore = IsolatedStorageFile.GetUserStoreForAssembly();

            //If No data saved for this user
            if (userStore.GetFileNames(EnvDTESetting).Length == 0)
            {
                _CnnString = new CnnString();
                return;
            }

            IsolatedStorageFileStream userStream = new IsolatedStorageFileStream(EnvDTESetting, FileMode.Open, userStore);

            _CnnString = DeSerializeDictionary(userStream);
        }
        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.Tables.Refresh();
                _Tables = db.Tables;
            }
            catch (Exception ex)
            {
                MessageBox.Show(HelperFunctions.GetAllMessageException(ex));
            }
        }
Exemple #15
0
        /// <summary>
        /// Deserializa en binario el diccionario
        /// </summary>
        /// <param name="fs"></param>
        /// <param name="dict"></param>
        private static CnnString DeSerializeDictionary(FileStream fs)
        {
            CnnString dict;
            // Create a BinaryFormatter object to perform the serialization
            BinaryFormatter bf = new BinaryFormatter();

            try
            {
                // Use the BinaryFormatter object to serialize the data to the file
                dict = (CnnString)bf.Deserialize(fs);
            }
            catch (System.Runtime.Serialization.SerializationException)
            {
                dict = new CnnString();
            }
            finally
            {
                // Close the file
                fs.Close();
            }
            return(dict);
        }
Exemple #16
0
        private CnnString GetAuxiliarCnnString()
        {
            CnnString wCnnString = new CnnString();


            wCnnString.InitialCatalog = cmbDataBases.Text.Trim();
            wCnnString.DataSource     = cmbServer.Text.Trim();

            if (WindowsAutentificaction.Checked)
            {
                wCnnString.User     = String.Empty;
                wCnnString.Password = String.Empty;
            }
            else
            {
                wCnnString.User     = txtUserName.Text.Trim();
                wCnnString.Password = txtPassword.Text.Trim();
            }

            wCnnString.WindowsAutentification = WindowsAutentificaction.Checked;

            return(wCnnString);
        }
Exemple #17
0
        /// <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));
            }
        }
Exemple #18
0
        private CnnString GetAuxiliarCnnString()
        {
            CnnString wCnnString = new CnnString();


            wCnnString.InitialCatalog = cmbDataBases.Text.Trim();
            wCnnString.DataSource = cmbServer.Text.Trim();

            if (WindowsAutentificaction.Checked)
            {
                wCnnString.User = String.Empty;
                wCnnString.Password = String.Empty;

            }
            else
            {
                wCnnString.User = txtUserName.Text.Trim();
                wCnnString.Password = txtPassword.Text.Trim();
            }

            wCnnString.WindowsAutentification = WindowsAutentificaction.Checked;

            return wCnnString;
        }
        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.Tables.Refresh();
                _Tables = db.Tables;
            }
            catch (Exception ex)
            {
                MessageBox.Show(HelperFunctions.GetAllMessageException(ex));
            }
        }
 public void Populate(CnnString pCnn)
 {
     this.ctrlTreeViewTables1.Populate(pCnn);
 }
 public void Populate(CnnString pCnn)
 {
     this.ctrlTreeViewTables1.Populate(pCnn);
 }
Exemple #22
0
 public frmWizDAC_2(CnnString Cnn)
 {
     InitializeComponent();
     wizTablesTreeSelector1.Populate(Cnn);
     wizTablesTreeSelector1.CheckBoxes = false;
 }
Exemple #23
0
 /// <summary>
 /// Serializa en binario el diccionario
 /// </summary>
 /// <param name="fs"></param>
 /// <param name="dict"></param>
 private static void SerializeDictionary(FileStream fs, CnnString dict)
 {
     // Create a BinaryFormatter object to perform the serialization
     BinaryFormatter bf = new BinaryFormatter();
     // Use the BinaryFormatter object to serialize the data to the file
     bf.Serialize(fs, dict);
     // Close the file
     fs.Close();
 }
Exemple #24
0
 private void btnNext_Click(object sender, EventArgs e)
 {
    
      _cnn = GetAuxiliarCnnString();
      UserDefinedTypesBack wUserDefinedTypesBack = new UserDefinedTypesBack(_cnn);
      FwkGeneratorHelper.UserDefinedTypes = wUserDefinedTypesBack.UserDefinedTypes;
     base.DoEvent(null, WizardButton.Next);
 }
Exemple #25
0
 internal void LoadCnn(CnnString cnn)
 {
     cmbDataBases.Text = cnn.InitialCatalog;
     cmbServer.Text    = cnn.DataSource;
     WindowsAutentificaction.Checked = cnn.WindowsAutentification;
 }
Exemple #26
0
 public Storage()
 {
     _CnnString = new CnnString();
 }
Exemple #27
0
        /// <summary>
        /// Deserializa en binario el diccionario
        /// </summary>
        /// <param name="fs"></param>
        /// <param name="dict"></param>
        private static CnnString DeSerializeDictionary(FileStream fs)
        {
            CnnString dict;
            // Create a BinaryFormatter object to perform the serialization
            BinaryFormatter bf = new BinaryFormatter();
            try
            {
                // Use the BinaryFormatter object to serialize the data to the file
                dict = (CnnString) bf.Deserialize(fs);

               
            }
            catch(System.Runtime.Serialization.SerializationException)
            {
                dict = new CnnString();
            }
            finally
            {
                // Close the file
                fs.Close();
            }
            return dict;
        }
Exemple #28
0
 public frmWizDAC_2(CnnString Cnn)
 {
     InitializeComponent();
     wizTablesTreeSelector1.Populate(Cnn);
     wizTablesTreeSelector1.CheckBoxes = false;
 }
Exemple #29
0
        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");
            }
        }
Exemple #30
0
 private void btnAceptar_Click(object sender, EventArgs e)
 {
     UserDefinedTypesBack wUserDefinedTypesBack = new UserDefinedTypesBack(_cnn);
     FwkGeneratorHelper.UserDefinedTypes = wUserDefinedTypesBack.UserDefinedTypes;
     _cnn = GetAuxiliarCnnString();
     base.DoEvent(_cnn, WizardButton.Ok);
 }
Exemple #31
0
 public frmWizEntity_2(CnnString Cnn)
 {
     InitializeComponent();
     wizTablesTreeSelector1.Populate(Cnn);
     wizTablesTreeSelector1.AfterCheckEvent += new AfterCheckHandler(wizTablesTreeSelector1_AfterCheckEvent);
 }
Exemple #32
0
 internal void LoadCnn(CnnString cnn)
 {
     cmbDataBases.Text = cnn.InitialCatalog;
     cmbServer.Text = cnn.DataSource ;
     WindowsAutentificaction.Checked = cnn.WindowsAutentification;
 }
Exemple #33
0
 public Storage()
 {
     _CnnString = new CnnString();
 }
Exemple #34
0
        private void cmbDataBases_Click(object sender, EventArgs e)
        {
            if (_cnn == null)
                _cnn = GetAuxiliarCnnString();

            if (!_cnn.DataSource.Equals(cmbServer.Text.Trim()) || cmbDataBases.Items.Count == 0)
            {
                _cnn.DataSource = cmbServer.Text.Trim();
                FillDatabaseCombo(_cnn);
            }
        }
Exemple #35
0
 public frmWizEntity_2(CnnString Cnn)
 {
     InitializeComponent();
     wizTablesTreeSelector1.Populate(Cnn);
     wizTablesTreeSelector1.AfterCheckEvent += new AfterCheckHandler(wizTablesTreeSelector1_AfterCheckEvent);
 }