public DataTable GetIPAddress(CloudApplicationsServer UrlObj, string mode)
        {
            DataTable UrlTable = new DataTable();

            try
            {
                if (mode == "Insert")
                {
                    string     sqlQuery = "Select * from CloudDetails where URL= @URL";
                    SqlCommand cmd      = new SqlCommand(sqlQuery);
                    cmd.Parameters.AddWithValue("@URL", (object)UrlObj.URL ?? DBNull.Value);
                    UrlTable = objAdaptor.FetchDatafromcommand(cmd);
                    // UrlTable = objAdaptor.FetchData(sqlQuery);
                }
                else
                {
                    string     sqlQuery = "Select * from CloudDetails where  ID<> @ID AND URL= @URL ";
                    SqlCommand cmd      = new SqlCommand(sqlQuery);
                    cmd.Parameters.AddWithValue("@URL", (object)UrlObj.URL ?? DBNull.Value);
                    cmd.Parameters.AddWithValue("@ID", (object)UrlObj.ID ?? DBNull.Value);
                    UrlTable = objAdaptor.FetchDatafromcommand(cmd);
                    // UrlTable = objAdaptor.FetchData(sqlQuery);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(UrlTable);
        }
Exemple #2
0
        public DataTable GetAllDatabyUser(int UserID)
        {
            DataTable MSServersDataTable = new DataTable();

            try
            {
                //SqlParameter[] p = new SqlParameter[1];
                // p[0] = new SqlParameter("@UserID", UserID);
                //3/21/2014 NS modified the query - need to add locationid
                //string SqlQuery = "select Sr.ID,Sr.ServerName,S.ServerType,L.Location,sa.ScanInterval,sa.Enabled,sr.ipaddress,sa.category from Servers Sr inner join ServerTypes S on Sr.ServerTypeID=S.ID " +
                //             " inner join Locations L on Sr.LocationID =L.ID left outer join ServerAttributes sa on sr.ID=sa.serverid  where S.ServerType='Exchange' ";
                string SqlQuery = "select Sr.ID,Sr.ServerName,S.ServerType,L.Location,Sr.LocationID,sa.ScanInterval,sa.Enabled,sr.ipaddress,sa.category,ISNULL(sa.ScanDagHealth,'false') as ScanDagHealth from Servers Sr inner join ServerTypes S on Sr.ServerTypeID=S.ID " +
                                  " inner join Locations L on Sr.LocationID =L.ID left outer join ServerAttributes sa on sr.ID=sa.serverid  where S.ServerType='Exchange'  and Sr.ID not in(select serverID from UserServerRestrictions ur inner join Users U on ur.UserID= U.ID where U.ID = @UserID) order by ServerName ";
                SqlCommand cmd = new SqlCommand(SqlQuery);
                cmd.Parameters.AddWithValue("@UserID", UserID);
                MSServersDataTable = objAdaptor.FetchDatafromcommand(cmd);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
            }
            return(MSServersDataTable);
        }
Exemple #3
0
        public DataTable GetDataForCredentialsByname(Credentials LOCbject)
        {
            DataTable LocationsDataTable = new DataTable();

            try
            {
                string SqlQuery = "Select * from Credentials where AliasName = @AliasName";

                SqlCommand cmd = new SqlCommand(SqlQuery);
                cmd.Parameters.AddWithValue("@AliasName", (object)LOCbject.AliasName ?? DBNull.Value);
                LocationsDataTable = objAdaptor.FetchDatafromcommand(cmd);
                //populate & return data object
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
            }
            return(LocationsDataTable);
        }
Exemple #4
0
        public DataTable GetAllDataByName(Servers ServerObject)
        {
            DataTable ServersDataTable  = new DataTable();
            Servers   ReturnSerevrbject = new Servers();

            try
            {
                if (ServerObject.ID == 0)
                {
                    string SqlQuery = "select Sr.ID,Sr.ServerName,sr.Description,S.ServerType,sa.ScanDAGHealth,sa.CredentialsId,L.Location,sr.ipaddress,sa.Enabled,sa.ScanInterval,sa.RetryInterval,sa.OffHourInterval, " +
                                      "sa.category,sa.CPU_Threshold,sa.MemThreshold,sa.ResponseTime,sa.ConsFailuresBefAlert,sa.ConsOvrThresholdBefAlert from Servers Sr inner join ServerTypes S " +
                                      "on Sr.ServerTypeID=S.ID  inner join Locations L on Sr.LocationID =L.ID  left outer join ServerAttributes sa on sr.ID=sa.serverid where sr.ServerName = @ServerName";
                    SqlCommand cmd = new SqlCommand(SqlQuery);
                    cmd.Parameters.AddWithValue("@ServerName", (object)ServerObject.ServerName ?? DBNull.Value);
                    ServersDataTable = objAdaptor.FetchDatafromcommand(cmd);
                    // ServersDataTable = objAdaptor.FetchData(SqlQuery);
                }
                else
                {
                    string SqlQuery = " select Sr.ID,Sr.ServerName,sr.Description,S.ServerType,S.ScanDAGHealth,L.Location,sr.ipaddress,sa.Enabled,sa.ScanInterval,sa.RetryInterval,sa.OffHourInterval, " +
                                      "sa.category,sa.CPU_Threshold,sa.MemThreshold,sa.ResponseTime,sa.ConsFailuresBefAlert,sa.ConsOvrThresholdBefAlert from Servers Sr inner join ServerTypes S " +
                                      "on Sr.ServerTypeID=S.ID  inner join Locations L on Sr.LocationID =L.ID  left outer join ServerAttributes sa on sr.ID=sa.serverid  and ID<> @ID";
                    SqlCommand cmd = new SqlCommand(SqlQuery);
                    cmd.Parameters.AddWithValue("@ID", (object)ServerObject.ID ?? DBNull.Value);
                    ServersDataTable = objAdaptor.FetchDatafromcommand(cmd);
                    //ServersDataTable = objAdaptor.FetchData(SqlQuery);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
            }
            return(ServersDataTable);
        }
Exemple #5
0
        public DataTable getfillgridbyUser(int UserID)
        {
            DataTable dt = new DataTable();

            try
            {
                string s = "select *,servers.ID as SID,ServerName as Name,(Select Location from Locations where ID = LocationID) as Location,Description,IPAddress as Address from BlackBerryServers right join servers on BlackBerryServers.ServerID=servers.ID where servertypeID=(select ID from ServerTypes where ServerType='BES') and servers.ID not in(select serverID from UserServerRestrictions ur inner join Users U on ur.UserID= U.ID where U.ID = @UserID) order by Name ";
                //string s = "select * from BlackBerryServers";
                SqlCommand cmd = new SqlCommand(s);
                cmd.Parameters.AddWithValue("@UserID", UserID);
                dt = objAdaptor.FetchDatafromcommand(cmd);
                //dt = objAdaptor.FetchData(s);
            }
            catch (Exception e)
            {
                throw e;
            }
            return(dt);
        }
Exemple #6
0
        public DataTable Enabledforscanning(string Servername)
        {
            DataTable dt = new DataTable();

            try
            {
                string Sql = "select WsScanMeetingServer,WsScanMediaServer from SametimeServers sa inner join Servers se  on sa.ServeriD=se.Id where  Platform='WebSphere' and  se.ServerName =@Servername";
                //dt = objAdaptor.FetchData(Sql);


                SqlCommand cmd = new SqlCommand(Sql);
                cmd.Parameters.AddWithValue("@Servername", Servername);
                dt = objAdaptor.FetchDatafromcommand(cmd);
            }
            catch (Exception)
            {
                throw;
            }
            return(dt);
        }
Exemple #7
0
        public DataTable GetAllDatabyUser(int UserID)
        {
            DataTable MSServersDataTable = new DataTable();

            try
            {
                string SqlQuery = "select Sr.ID,Sr.ServerName,S.ServerType,L.Location,Sr.LocationID,sa.ScanInterval,sa.Enabled,sr.ipaddress,sa.category from Servers Sr inner join ServerTypes S on Sr.ServerTypeID=S.ID " +
                                  " inner join Locations L on Sr.LocationID =L.ID left outer join ServerAttributes sa on sr.ID=sa.serverid  where S.ServerType='Active Directory' and Sr.ID not in(select serverID from UserServerRestrictions ur inner join Users U on ur.UserID= U.ID where U.ID = @UserID) order by ServerName ";
                SqlCommand cmd = new SqlCommand(SqlQuery);
                cmd.Parameters.AddWithValue("@UserID", UserID);
                MSServersDataTable = objAdaptor.FetchDatafromcommand(cmd);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
            }
            return(MSServersDataTable);
        }