public int AddCredentialSet(string serviceBrokerGuid, string serviceBrokerName,
            string groupName)
        {
            int add = 0;
               UserSchedulingDB dbManager = new UserSchedulingDB();
            if (dbManager.AuthenticateAgentHeader(agentAuthHeader))
            {
                try
                {
                    int test = dbManager.GetCredentialSetID(serviceBrokerGuid,groupName);
                    if(test > 0)
                    {

                        add = 1; ;
                    }
                    else{
                        int i = dbManager.AddCredentialSet(serviceBrokerGuid, serviceBrokerName, groupName);
                        add = (i != -1) ? 1 : 0;

                    }
                }
                catch
                {
                    throw;
                }
            }
            return add;
        }
 public int RemoveCredentialSet(string serviceBrokerGuid, string serviceBrokerName,
     string groupName)
 {
     int removed = 0;
     UserSchedulingDB dbManager = new UserSchedulingDB();
     if (dbManager.AuthenticateAgentHeader(agentAuthHeader))
     {
         try
         {
             removed = dbManager.RemoveCredentialSet(serviceBrokerGuid, serviceBrokerName, groupName);
         }
         catch
         {
             throw;
         }
     }
     return removed;
 }
        public int RemoveLSSInfo(string lssGuid)
        {
            int added = 0;
            UserSchedulingDB dbManager = new UserSchedulingDB();
            if (dbManager.AuthenticateAgentHeader(agentAuthHeader))
            {
                try
                {
                    added = dbManager.RemoveLSSInfoByGuid(lssGuid);

                }
                catch
                {
                    throw;
                }
            }
            return added;
        }
        public int ModifyLSSInfo(string lssGuid, string lssName, string lssUrl, Coupon coupon)
        {
            int status = 0;
            UserSchedulingDB dbManager = new UserSchedulingDB();
            if (dbManager.AuthenticateAgentHeader(agentAuthHeader))
            {
                try
                {
                    status = dbManager.ModifyLSSInfo(lssGuid, lssName, lssUrl, coupon);

                }
                catch
                {
                    throw;
                }
            }
            return status;
        }
 public override int ModifyProcessAgent(string originalGuid, ProcessAgent agent, string extra)
 {
     int status = 0;
     UserSchedulingDB dbManager = new UserSchedulingDB();
     if (dbManager.AuthenticateAgentHeader(agentAuthHeader))
     {
         status = dbManager.ModifyProcessAgent(originalGuid, agent, extra);
     }
     return status;
 }
 public int ModifyExperimentInfo(string labServerGuid, string labServerName,
     string labClientGuid, string labClientName, string labClientVersion,
     string providerName, string lssGuid)
 {
     int status = 0;
     UserSchedulingDB dbManager = new UserSchedulingDB();
     if (dbManager.AuthenticateAgentHeader(agentAuthHeader))
     {
         try
         {
             status = dbManager.ModifyExperimentInfo(labServerGuid, labServerName, labClientGuid, labClientName, labClientVersion, providerName, lssGuid);
         }
         catch
         {
             throw;
         }
     }
     return status;
 }
        public override int ModifyDomainCredentials(string originalGuid, ProcessAgent agent, string extra, 
            Coupon inCoupon, Coupon outCoupon)
        {
            int status = 0;
              UserSchedulingDB dbManager = new UserSchedulingDB();
            if (dbManager.AuthenticateAgentHeader(agentAuthHeader))
            {

            try
            {
                status = dbManager.ModifyDomainCredentials(originalGuid, agent, inCoupon, outCoupon, extra);
            }
            catch (Exception ex)
            {
                throw new Exception("USS: ", ex);
            }

            }
            return status;
        }
 public int ModifyCredentialSet(string originalGuid, string serviceBrokerGuid, string serviceBrokerName,
     string groupName)
 {
     int status = 0;
     UserSchedulingDB dbManager = new UserSchedulingDB();
     if (dbManager.AuthenticateAgentHeader(agentAuthHeader))
     {
         try
         {
             status = dbManager.ModifyCredentialSetServiceBroker(originalGuid, serviceBrokerGuid, serviceBrokerName);
         }
         catch
         {
             throw;
         }
     }
     return status;
 }
 public int AddLSSInfo(string lssGuid, string lssName, string lssUrl, Coupon coupon)
 {
     int added = 0;
     UserSchedulingDB dbManager = new UserSchedulingDB();
     if (dbManager.AuthenticateAgentHeader(agentAuthHeader))
     {
         try
         {
             int lID = dbManager.AddLSSInfo(lssGuid, lssName, lssUrl, coupon);
             added = (lID != -1) ? 1 : 0;
         }
         catch
         {
             throw;
         }
     }
     return added;
 }
 public int AddExperimentInfo(string labServerGuid, string labServerName, 
     string labClientGuid, string labClientName, string labClientVersion,
     string providerName, string lssGuid)
 {
     int added = 0;
        UserSchedulingDB dbManager = new UserSchedulingDB();
     if (dbManager.AuthenticateAgentHeader(agentAuthHeader))
     {
         try
         {
             int eID = dbManager.AddExperimentInfo(labServerGuid, labServerName,labClientGuid,  labClientName, labClientVersion, providerName, lssGuid);
             added = (eID != -1) ? 1 : 0;
         }
         catch
         {
             throw;
         }
     }
     return added;
 }