示例#1
0
        private void MyCmdReloadRadicacionesDBs_Click()
        {
            try
            {
                if (RadicacionesSvr_txt.Trim().Length > 0)
                {
                    cbRadicacionesDB = null;
                    cbRadicacionesDB = new ObservableCollection <string>();
                    cbRadicacionesDB.Clear();

                    GetDataBaseName(RadicacionesSvr_txt, RadicacionesUsr_txt, RadicacionesUPass_txt, cbRadicacionesDB);


                    if (cbRadicacionesDB.Count > 0)
                    {
                        cbRadicacionesDB_Item_Id = 0;
                    }
                    else
                    {
                        cbRadicacionesDB_Item_Id = -1;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "MyCmdReloadRadicacionesDBs_Click", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
示例#2
0
        private void CmdOk_Click()
        {
            try
            {
                _SaveReg = false;

                sqlServer = dfServer_txt.Trim();
                userName  = dfUsername_txt.Trim();

                // IntPtr passwordBSTR = default(IntPtr);
                //   string insecurePassword = "";
                // passwordBSTR = Marshal.SecureStringToBSTR(dfPassword_txt);
                //   insecurePassword = Marshal.PtrToStringBSTR(passwordBSTR);

                password = dfPassword_txt;// insecurePassword;
                database = cbDatabase_Item.Trim();

                mastSvr = dfMastSvr_txt.Trim();
                mastUsr = dfMastUsr_txt.Trim();

                //     insecurePassword = "";
                //passwordBSTR = Marshal.SecureStringToBSTR(dfMastPass_txt);
                // insecurePassword = Marshal.PtrToStringBSTR(passwordBSTR);

                mastPass = dfMastPass_txt;//insecurePassword;
                mastDB   = cbMastDB_Item.Trim();

                imageSvr = dfImageSvr_txt.Trim();
                imageUsr = dfImageUsr_txt.Trim();

                //   insecurePassword = "";
                // passwordBSTR = Marshal.SecureStringToBSTR(dfImagePass_txt);
                // insecurePassword = Marshal.PtrToStringBSTR(passwordBSTR);

                imagePass = dfImagePass_txt;//insecurePassword;
                imageDB   = cbImageDB_Item.Trim();

                RadicacionesSvr  = RadicacionesSvr_txt.Trim();
                RadicacionesUsr  = RadicacionesUsr_txt.Trim();
                RadicacionesPass = RadicacionesUPass_txt.Trim();
                RadicacionesDB   = cbRadicacionesDB_Item.Trim();


                string PDFPath = dfPathtoPictures_txt.Trim();

                if (PDFPath.Trim().Length == 0)
                {
                    throw new Exception("Error con los Path");
                }

                imgPath = PDFPath;

                if ((sqlServer.Trim().Length == 0) ||
                    (userName.Trim().Length == 0) ||
                    (database.Trim().Length == 0) ||
                    (password.Trim().Length == 0) ||
                    (mastSvr.Trim().Length == 0) ||
                    (mastUsr.Trim().Length == 0) ||
                    (mastDB.Trim().Length == 0) ||
                    (mastPass.Trim().Length == 0) ||
                    (imageSvr.Trim().Length == 0) ||
                    (imageUsr.Trim().Length == 0) ||
                    (imageDB.Trim().Length == 0) ||
                    (imagePass.Trim().Length == 0) ||

                    (RadicacionesSvr.Trim().Length == 0) ||
                    (RadicacionesUsr.Trim().Length == 0) ||
                    (RadicacionesDB.Trim().Length == 0) ||
                    (RadicacionesPass.Trim().Length == 0))
                {
                    throw new Exception("Error con los Parametros de la Base de datos");
                }
                else
                {
                    //jolcode.Registry.write(_REGPATH,)


                    jolcode.Registry.write(_REGPATH, "DBServer", sqlServer);
                    jolcode.Registry.write(_REGPATH, "DBUser", userName);
                    jolcode.Registry.write(_REGPATH, "DBPass", PasswordHash.Encrypt1(password));
                    jolcode.Registry.write(_REGPATH, "DBName", database);

                    jolcode.Registry.write(_REGPATH, "MastSvr", mastSvr);
                    jolcode.Registry.write(_REGPATH, "MastUsr", mastUsr);
                    jolcode.Registry.write(_REGPATH, "MastPass", PasswordHash.Encrypt1(mastPass));
                    jolcode.Registry.write(_REGPATH, "MastDB", mastDB);

                    jolcode.Registry.write(_REGPATH, "ImageSvr", imageSvr);
                    jolcode.Registry.write(_REGPATH, "ImageUsr", imageUsr);
                    jolcode.Registry.write(_REGPATH, "ImagePass", PasswordHash.Encrypt1(imagePass));
                    jolcode.Registry.write(_REGPATH, "ImageDB", imageDB);

                    jolcode.Registry.write(_REGPATH, "RadicacionesSvr", RadicacionesSvr);
                    jolcode.Registry.write(_REGPATH, "RadicacionesUsr", RadicacionesUsr);
                    jolcode.Registry.write(_REGPATH, "RadicacionesPass", PasswordHash.Encrypt1(RadicacionesPass));
                    jolcode.Registry.write(_REGPATH, "RadicacionesDB", RadicacionesDB);

                    jolcode.Registry.write(_REGPATH, "ImagePathNew", PDFPath);

                    _SaveReg = true;

                    MessageBox.Show("Done...", "CmdOk_Click", MessageBoxButton.OK, MessageBoxImage.Information);

                    this.View.Close();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "CmdOk_Click", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }