Exemplo n.º 1
0
        public static ActionResult CreateXmlSettingsFile(Session session)
        {
            sessionObj = session;
            string sqlservername   = string.IsNullOrEmpty(session["SQLSERVERNAME"]) ? string.Empty : session["SQLSERVERNAME"];
            string sqlinstancename = string.IsNullOrEmpty(session["SQLINSTANCENAME"]) ? string.Empty : session["SQLINSTANCENAME"];
            string databasename    = string.IsNullOrEmpty(session["DATABASENAME"]) ? string.Empty : session["DATABASENAME"];
            string sapassword      = string.IsNullOrEmpty(session["SAPASSWORD"]) ? string.Empty : session["SAPASSWORD"];
            string omluseracct     = string.IsNullOrEmpty(session["OMLUSERACCT"]) ? string.Empty : session["OMLUSERACCT"];
            string omluserpassword = string.IsNullOrEmpty(session["OMLUSERACCT"]) ? string.Empty : session["OMLUSERACCT"];

            if (string.IsNullOrEmpty(sqlservername) || string.IsNullOrEmpty(sqlinstancename) || string.IsNullOrEmpty(databasename) || string.IsNullOrEmpty(omluserpassword) || string.IsNullOrEmpty(omluserpassword))
            {
                return(ActionResult.Failure);
            }

            if (xmlSettings == null)
            {
                xmlSettings = new XMLSettingsManager();
            }

            xmlSettings.SQLServerName   = sqlservername;
            xmlSettings.SQLInstanceName = sqlinstancename;
            xmlSettings.DatabaseName    = databasename;
            xmlSettings.SAPassword      = sapassword;
            xmlSettings.OMLUserAcct     = omluseracct;
            xmlSettings.OMLUserPassword = omluserpassword;
            xmlSettings.SaveSettings();

            return(ActionResult.Success);
        }
Exemplo n.º 2
0
        public static ActionResult CreateXmlSettingsFile(Session session)
        {
            sessionObj = session;
            string sqlservername = string.IsNullOrEmpty(session["SQLSERVERNAME"]) ? string.Empty : session["SQLSERVERNAME"];
            string sqlinstancename = string.IsNullOrEmpty(session["SQLINSTANCENAME"]) ? string.Empty : session["SQLINSTANCENAME"];
            string databasename = string.IsNullOrEmpty(session["DATABASENAME"]) ? string.Empty : session["DATABASENAME"];
            string sapassword = string.IsNullOrEmpty(session["SAPASSWORD"]) ? string.Empty : session["SAPASSWORD"];
            string omluseracct = string.IsNullOrEmpty(session["OMLUSERACCT"]) ? string.Empty : session["OMLUSERACCT"];
            string omluserpassword = string.IsNullOrEmpty(session["OMLUSERACCT"]) ? string.Empty : session["OMLUSERACCT"];

            if (string.IsNullOrEmpty(sqlservername) || string.IsNullOrEmpty(sqlinstancename) || string.IsNullOrEmpty(databasename) || string.IsNullOrEmpty(omluserpassword) || string.IsNullOrEmpty(omluserpassword))
                return ActionResult.Failure;

            if (xmlSettings == null)
                xmlSettings = new XMLSettingsManager();

            xmlSettings.SQLServerName = sqlservername;
            xmlSettings.SQLInstanceName = sqlinstancename;
            xmlSettings.DatabaseName = databasename;
            xmlSettings.SAPassword = sapassword;
            xmlSettings.OMLUserAcct = omluseracct;
            xmlSettings.OMLUserPassword = omluserpassword;
            xmlSettings.SaveSettings();

            return ActionResult.Success;
        }
Exemplo n.º 3
0
        public static ActionResult ScanNetworkForSqlServers(Session session)
        {
            sessionObj = session;
            if (xmlSettings == null)
            {
                xmlSettings = new XMLSettingsManager();
            }

            if ((session["HASSCANNEDFORSQL"].CompareTo("0") == 0) && (session["ISSERVERINSTALL"] != "0"))
            {
                if (xmlSettings.SettingsFileExists())
                {
                    return(ActionResult.SkipRemainingActions);
                }
                else
                {
                    DataTable dt          = SqlDataSourceEnumerator.Instance.GetDataSources();
                    View      sqlComboBox = session.Database.OpenView("SELECT * FROM `ComboBox`");
                    sqlComboBox.Execute();
                    int numRows = 0;
                    while (sqlComboBox.Fetch() != null)
                    {
                        numRows++;
                    }
                    if (numRows == 1)
                    {
                        CustomActions.LogToSession(string.Format("found {0} sql servers", dt.Rows.Count));
                        int itemNumber = 2;
                        foreach (DataRow row in dt.Rows)
                        {
                            Record rec = new Record(3);
                            rec.SetString(1, "OMLProp_SqlServers");
                            rec.SetInteger(2, itemNumber);
                            string description = string.Format("{0} - {1}", row["ServerName"], row["InstanceName"]);
                            rec.SetString(3, description);

                            CustomActions.LogToSession(string.Format("Adding a new record, its number will be {0} and its value will be {1}", itemNumber, string.Format("{0} ({1})", row["ServerName"], row["InstanceName"])));
                            sqlComboBox.Modify(ViewModifyMode.InsertTemporary, rec);
                            itemNumber++;
                        }
                    }
                }
                session["HASSCANNEDFORSQL"] = "1";
            }
            return(ActionResult.Success);
        }
Exemplo n.º 4
0
        public static ActionResult ScanNetworkForSqlServers(Session session)
        {
            sessionObj = session;
            if (xmlSettings == null)
                xmlSettings = new XMLSettingsManager();

            if ((session["HASSCANNEDFORSQL"].CompareTo("0") == 0) && (session["ISSERVERINSTALL"] != "0")) {
                if (xmlSettings.SettingsFileExists()) {
                    return ActionResult.SkipRemainingActions;
                } else {
                    DataTable dt = SqlDataSourceEnumerator.Instance.GetDataSources();
                    View sqlComboBox = session.Database.OpenView("SELECT * FROM `ComboBox`");
                    sqlComboBox.Execute();
                    int numRows = 0;
                    while (sqlComboBox.Fetch() != null) {
                        numRows++;
                    }
                    if (numRows == 1) {
                        CustomActions.LogToSession(string.Format("found {0} sql servers", dt.Rows.Count));
                        int itemNumber = 2;
                        foreach (DataRow row in dt.Rows) {
                            Record rec = new Record(3);
                            rec.SetString(1, "OMLProp_SqlServers");
                            rec.SetInteger(2, itemNumber);
                            string description = string.Format("{0} - {1}", row["ServerName"], row["InstanceName"]);
                            rec.SetString(3, description);

                            CustomActions.LogToSession(string.Format("Adding a new record, its number will be {0} and its value will be {1}", itemNumber, string.Format("{0} ({1})", row["ServerName"], row["InstanceName"])));
                            sqlComboBox.Modify(ViewModifyMode.InsertTemporary, rec);
                            itemNumber++;
                        }
                    }
                }
                session["HASSCANNEDFORSQL"] = "1";
            }
            return ActionResult.Success;
        }