/// <summary>
 /// Deletes a single experiment, checks for ESS, deletes from the ESS if needed, deletes Qualifier and the experiment administrative info.
 /// This does not check for authorization the experiment ID should be authorized for deletion before this is called.
 /// </summary>
 /// <param name="experimentID"></param>
 /// <returns></returns>
 public static bool DeleteExperiment(long experimentID)
 {
     bool deleted = false;
      ExperimentSummary summary = InternalDataDB.SelectExperimentSummary(experimentID);
      if (summary.HasEss)
      {
          ProcessAgentDB ticketing = new ProcessAgentDB();
          // Retrieve the ESS Status info and update as needed
          //This uses a generic ReadRecords ticket created for the ESS
          ProcessAgentInfo ess = ticketing.GetProcessAgentInfo(summary.essGuid);
          if ((ess != null) && !ess.retired)
          {
              ExperimentStorageProxy essProxy = new ExperimentStorageProxy();
              essProxy.Url = ess.webServiceUrl;
              essProxy.AgentAuthHeaderValue = new AgentAuthHeader();
              essProxy.AgentAuthHeaderValue.coupon = ess.identOut;
              essProxy.AgentAuthHeaderValue.agentGuid = ProcessAgentDB.ServiceGuid;
              essProxy.DeleteExperiment(experimentID);
          }
      }
     int qualID = Authorization.AuthorizationAPI.GetQualifierID((int)experimentID, Qualifier.experimentQualifierTypeID);
     if (qualID > 0)
         Authorization.AuthorizationAPI.RemoveQualifiers(new int[] { qualID });
     deleted = InternalDataDB.DeleteExperiment(experimentID);
     return deleted;
 }
예제 #2
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string couponId;
            string passkey;
            string issuerGuid;
            dbTicketing = new ProcessAgentDB();

            if (!IsPostBack)
            {

                // try & test for local access or not configured
                if (secure)
                {
                    // retrieve parameters from URL
                    couponId = Request.QueryString["coupon_id"];
                    passkey = Request.QueryString["passkey"];
                    issuerGuid = Request.QueryString["issuer_guid"];
                    Ticket allowAdminTicket = null;
                    if (couponId != null && passkey != null && issuerGuid != null)
                    {
                        allowAdminTicket = dbTicketing.RetrieveAndVerify(
                            new Coupon(issuerGuid, Int64.Parse(couponId), passkey),
                            TicketTypes.ADMINISTER_LS);
                    }
                    else
                    {
                        Response.Redirect("AccessDenied.aspx", true);
                    }
                }
            }
        }
예제 #3
0
 /// <summary>
 /// Queries the Ticket table, for any 'Expired' tickets trys to delete the Ticket. Then checks to 
 /// see if any of the ticket coupons are no longer needed and removes them.
 /// </summary>
 public void ProcessTickets()
 {
     try
     {
         //Need to move all processing into ProcessAgentDB
         ProcessAgentDB agentDB = new ProcessAgentDB();
         int expiredCount = agentDB.ProcessExpiredTickets();
     }
     catch (Exception e)
     {
         Utilities.WriteLog("TicketRemover: " + e.Message + ": " + Utilities.DumpException(e));
     }
 }
예제 #4
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            string couponId;
            string passkey;
            string issuerGuid;
            dbTicketing = new ProcessAgentDB();

            if (!IsPostBack)
            {

                // try & test for local access or not configured
                if (secure)
                {
                    // retrieve parameters from URL
                    couponId = Request.QueryString["coupon_id"];
                    passkey = Request.QueryString["passkey"];
                    issuerGuid = Request.QueryString["issuer_guid"];
                    Ticket allowAdminTicket = null;
                    if (couponId != null && passkey != null && issuerGuid != null)
                    {
                        allowAdminTicket = dbTicketing.RetrieveAndVerify(
                            new Coupon(issuerGuid, Int64.Parse(couponId), passkey),
                            TicketTypes.ADMINISTER_LS);
                    }
                    else
                    {
                        Response.Redirect("AccessDenied.aspx", true);
                    }
                }

                string returnUrl = Request.QueryString["sb_url"];
                if (returnUrl != null && returnUrl.Length > 0)
                    Session["returnURL"] = returnUrl;

            }
            String returnURL = (string)Session["returnURL"];
            if ((returnURL != null) && (returnURL.Length > 0))
            {
                lnkBackSB.NavigateUrl = returnURL;
                lnkBackSB.Visible = true;
            }
            else
            {
                lnkBackSB.Visible = false;
            }
        }
예제 #5
0
        public static int RevokeReservation(ReservationInfo ri)
        {
            int count = 0;
            LssCredentialSet[] sets = DBManager.GetCredentialSets(new int[] { ri.credentialSetId });
            LssExperimentInfo[] exps = DBManager.GetExperimentInfos(new int[] { ri.experimentInfoId });
            if (sets != null && sets.Length > 0 && exps != null && exps.Length > 0)
            {

                USSInfo uss = DBManager.GetUSSInfo(sets[0].ussGuid);
                if (uss != null)
                {
                    ProcessAgentDB paDB = new ProcessAgentDB();
                    UserSchedulingProxy ussProxy = new UserSchedulingProxy();
                    OperationAuthHeader header = new OperationAuthHeader();
                    header.coupon = paDB.GetCoupon(uss.couponId, uss.domainGuid);
                    ussProxy.OperationAuthHeaderValue = header;
                    ussProxy.Url = uss.ussUrl;

                    int num = ussProxy.RevokeReservation(sets[0].serviceBrokerGuid, sets[0].groupName,
                        exps[0].labServerGuid, exps[0].labClientGuid, ri.Start, ri.End, "The reservation time assigned to this reservation is being removed");
                    if (num > 0)
                    {
                        LSSSchedulingAPI.RemoveReservationInfoByIDs(new int[] { ri.reservationInfoId });
                        count += num;
                    }
                }
             }

            return count;
        }
예제 #6
0
 public IntTag[] GetProcessAgentTagsByTypesWrapper(int [] types)
 {
     ProcessAgentDB db = new ProcessAgentDB();
     return db.GetProcessAgentTagsByType(types);
 }
예제 #7
0
 public IntTag[] GetProcessAgentTagsByTypeWrapper(string agentType)
 {
     ProcessAgentDB db = new ProcessAgentDB();
     return db.GetProcessAgentTagsByType(agentType);
 }
예제 #8
0
 /// <summary>
 /// Loads the static varable serviceAgent with the processAgent's ProcessAgent data.
 /// </summary>
 /// <returns></returns>
 public static bool RefreshServiceAgent()
 {
     ProcessAgentDB padb = new ProcessAgentDB();
     ProcessAgent tmp = padb.GetSelfProcessAgent();
     serviceAgent = tmp;
     return (tmp != null);
 }
예제 #9
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            culture = DateUtil.ParseCulture(Request.Headers["Accept-Language"]);
            localTzOffset = DateUtil.LocalTzOffset;
            credentialSetIDs = LSSSchedulingAPI.ListCredentialSetIDs();
            credentialSets=LSSSchedulingAPI.GetCredentialSets(credentialSetIDs);
            btnRemove.Attributes.Add("onclick", "javascript:if(confirm('Are you sure you want to remove this recurring time block?')== false) return false;");

            btnNew.Attributes.Add("onclick","javascript:window.open('NewTimeBlockPopUp.aspx','NewTimeBlockPopUp','width=910,height=600,left=270,top=180,modal=yes,resizable=yes').focus()");
            hiddenPopupOnNewTB.Attributes.Add("onpropertychange", Page.GetPostBackEventReference(btnSaveChanges));

            if (!IsPostBack)
            {

                if (Session["couponID"] == null || Request.QueryString["coupon_id"] != null)
                    couponID = Request.QueryString["coupon_id"];
                else
                    couponID = Session["couponID"].ToString();

                if (Session["passkey"] == null || Request.QueryString["passkey"] != null)
                    passkey = Request.QueryString["passkey"];
                else
                    passkey = Session["passkey"].ToString();

                if (Session["issuerID"] == null || Request.QueryString["issuer_guid"] != null)
                    issuerID = Request.QueryString["issuer_guid"];
                else
                    issuerID = Session["issuerID"].ToString();

                if (Session["sbUrl"] == null || Request.QueryString["sb_url"] != null)
                    sbUrl = Request.QueryString["sb_url"];
                else
                    sbUrl = Session["sbUrl"].ToString();

                bool unauthorized = false;

                if (couponID != null && passkey != null && issuerID != null)
                {
                    try
                    {
                        Coupon coupon = new Coupon(issuerID, long.Parse(couponID), passkey);
                        ProcessAgentDB dbTicketing = new ProcessAgentDB();
                        Ticket ticket = dbTicketing.RetrieveAndVerify(coupon, TicketTypes.MANAGE_LAB);

                        if ( ticket == null || ticket.IsExpired() || ticket.isCancelled)
                        {
                            unauthorized = true;
                            Response.Redirect("Unauthorized.aspx", false);
                        }

                        Session["couponID"] = couponID;
                        Session["passkey"] = passkey;
                        Session["issuerID"] = issuerID;
                        Session["sbUrl"] = sbUrl;

                        XmlDocument payload = new XmlDocument();
                        payload.LoadXml(ticket.payload);
                        userTZ = Convert.ToInt32(payload.GetElementsByTagName("userTZ")[0].InnerText);
                        Session["userTZ"] = userTZ;
                        labServerGuid = payload.GetElementsByTagName("labServerGuid")[0].InnerText;
                        Session["labServerGuid"] = labServerGuid;
                        labServerName = payload.GetElementsByTagName("labServerName")[0].InnerText;
                        Session["labServerName"] = labServerName;

                    }

                    catch (Exception ex)
                    {
                        unauthorized = true;
                        Response.Redirect("Unauthorized.aspx", false);
                    }
                }

                else
                {
                    unauthorized = true;
                    Response.Redirect("Unauthorized.aspx", false);
                }

                if (!unauthorized)
                {

                    BuildRecurrenceListBox();
                }

            }
            else
            {
                userTZ = (int) Session["userTZ"];
                labServerGuid = (string) Session["labServerGuid"];
                labServerName = (string) Session["labServerName"];

            }
            StringBuilder buf = new StringBuilder("Create, modify or delete recurring time blocks.<br/><br/>Times shown are Local LSS time UTC&nbsp;&nbsp;&nbsp;");
            if (localTzOffset > 0)
                buf.Append("+");
            buf.Append(localTzOffset / 60.0);
            lblDescription.Text = buf.ToString();
        }
예제 #10
0
    /// <summary>
    /// Method that does the actual make reservation for the user. 
    /// makes the basis of the parameters from the message and the application database
    /// </summary>
    /// <param name="userName"> the user who is scheduling for the lab; must be registered with the service broker</param>
    /// <param name="groupName">the group name authorized to do a lab</param>
    /// <param name="labServerGuid">lab server which holds the lab that does the actual scheduling</param>
    /// <param name="clientGuid">Guid of the lab being registered for</param>
    /// <param name="start">Start time of a particular period scheduled for</param>
    /// <param name="end">End time of a particular period being scheduled for</param>
    /// <returns>returns a message string that the application bases on for to give the feedback to the user</returns>
    public static string MakeReservation(string userName, string groupName, string labServerGuid,
        string clientGuid, DateTime start, DateTime end)
    {
        string lsGuid = null;
            int status = -1;
            string message = null;
            if (ProcessAgentDB.ServiceAgent != null && ProcessAgentDB.ServiceAgent.domainGuid != null)
            {
                ProcessAgentDB paDb = new ProcessAgentDB();
                ProcessAgentInfo domainServer = paDb.GetProcessAgentInfo(ProcessAgentDB.ServiceAgent.domainGuid);

                InteractiveSBProxy isbProxy = new InteractiveSBProxy();
                isbProxy.AgentAuthHeaderValue = new AgentAuthHeader();
                isbProxy.AgentAuthHeaderValue.agentGuid = ProcessAgentDB.ServiceGuid;
                isbProxy.AgentAuthHeaderValue.coupon = domainServer.identOut;
                isbProxy.Url = domainServer.ServiceUrl;

                string[] types = new string[] { TicketTypes.SCHEDULE_SESSION };

                Coupon opCoupon = isbProxy.RequestAuthorization(types, 600, 			userName, groupName,  labServerGuid, clientGuid);
                if (opCoupon != null)
                {
                    TicketIssuerProxy ticketProxy = new TicketIssuerProxy();
                    ticketProxy.AgentAuthHeaderValue = new AgentAuthHeader();
                    ticketProxy.AgentAuthHeaderValue.agentGuid = ProcessAgentDB.ServiceGuid;
                    ticketProxy.AgentAuthHeaderValue.coupon = domainServer.identOut;
                    ticketProxy.Url = domainServer.ServiceUrl;
                    //the method call below is one which does not returns a null value
                    //in otherwards the ticket value is not created.
                    Ticket ticketSMS = ticketProxy.RedeemTicket(opCoupon, TicketTypes.SCHEDULE_SESSION, ProcessAgentDB.ServiceGuid);
                    if (ticketSMS != null)
                    {
                        if (ticketSMS.payload != null || ticketSMS.payload.Length > 0)
                        {
                            XmlQueryDoc xdoc = new XmlQueryDoc(ticketSMS.payload);
                            string ussURL = xdoc.Query("ScheduleSessionPayload/ussURL");
                            UserSchedulingProxy ussProxy = new UserSchedulingProxy();
                            ussProxy.OperationAuthHeaderValue = new OperationAuthHeader();
                            ussProxy.OperationAuthHeaderValue.coupon = opCoupon;
                            ussProxy.Url = ussURL;

                            TimePeriod[] times = ussProxy.RetrieveAvailableTimePeriods(ProcessAgentDB.ServiceAgent.domainGuid, groupName, labServerGuid,
                                clientGuid, start, end);
                            // Logic to check for final time
                            DateTime resStart = start;
                            DateTime resEnd = end;

                            message = ussProxy.AddReservation(ProcessAgentDB.ServiceAgent.domainGuid, userName, groupName, labServerGuid, clientGuid, resStart, resEnd);
                        }
                    }
                }
                else
                {
                    message = "coupon is null";
                }
            }
            else
            {
                message = "This service is not part of a domain, please contact the administrator!";

            }
            return message;
    }
예제 #11
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     Utilities.WriteLog("InitializeComponent");
     dbTicketing = new ProcessAgentDB();
 }
예제 #12
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            btnRemove.Attributes.Add("onclick", "javascript:if(confirm('Are you sure you want to remove this experiment Information?')== false) return false;");
            credentialSetIDs=LSSSchedulingAPI.ListCredentialSetIDs();
            credentialSets=LSSSchedulingAPI.GetCredentialSets(credentialSetIDs);
            ussInfoIDs=LSSSchedulingAPI.ListUSSInfoIDs();
            ussInfos=LSSSchedulingAPI.GetUSSInfos(ussInfoIDs);

            if(!IsPostBack)
            {

                if (Session["couponID"] == null || Request.QueryString["coupon_id"] != null)
                    couponID = Request.QueryString["coupon_id"];
                else
                    couponID = Session["couponID"].ToString();

                if (Session["passkey"] == null || Request.QueryString["passkey"] != null)
                    passkey = Request.QueryString["passkey"];
                else
                    passkey = Session["passkey"].ToString();

                if (Session["issuerID"] == null || Request.QueryString["issuer_guid"] != null)
                    issuerID = Request.QueryString["issuer_guid"];
                else
                    issuerID = Session["issuerID"].ToString();

                if (Session["sbUrl"] == null || Request.QueryString["sb_url"] != null)
                    sbUrl = Request.QueryString["sb_url"];
                else
                    sbUrl = Session["sbUrl"].ToString();

                bool unauthorized = false;

                if (couponID != null && passkey != null && issuerID != null)
                {
                    try
                    {
                        Coupon coupon = new Coupon(issuerID, long.Parse(couponID), passkey);

                        ProcessAgentDB dbTicketing = new ProcessAgentDB();
                        Ticket ticket = dbTicketing.RetrieveAndVerify(coupon, TicketTypes.ADMINISTER_LSS);

                        if (ticket.IsExpired() || ticket.isCancelled)
                        {
                            unauthorized = true;
                            Response.Redirect("Unauthorized.aspx", false);
                        }

                        Session["couponID"] = couponID;
                        Session["passkey"] = passkey;
                        Session["issuerID"] = issuerID;
                        Session["sbUrl"] = sbUrl;

                    }

                    catch (Exception ex)
                    {
                        unauthorized = true;
                        Response.Redirect("Unauthorized.aspx", false);
                    }
                }

                else
                {
                    unauthorized = true;
                    Response.Redirect("Unauthorized.aspx", false);
                }

                if (!unauthorized)
                {
                    // Load the Group list box
                    ddlGroup.Items.Add(new ListItem(" ---------- select Group ---------- "));
                    for (int i = 0; i < credentialSets.Length; i++)
                    {
                        USSInfo[] uIn = LSSSchedulingAPI.GetUSSInfos(new int[] { LSSSchedulingAPI.ListUSSInfoID(credentialSets[i].ussGuid) });
                        string cred = credentialSets[i].groupName + " " + credentialSets[i].serviceBrokerName + " " + uIn[0].ussName;
                        ddlGroup.Items.Add(new ListItem(cred, credentialSets[i].credentialSetId.ToString()));
                    }
                    // Load the USS list box
                    ddlUSS.Items.Add(new ListItem(" ---------- select User side scheduling server ---------- "));
                    for (int i = 0; i < ussInfos.Length; i++)
                    {
                        ddlUSS.Items.Add(new ListItem(ussInfos[i].ussName, ussInfos[i].ussGuid.ToString()));
                    }

                    // Set the GUID field to not ReadOnly
                    SetReadOnly(false);
                    //SetDDLUnable(false);
                }
            }
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            culture = DateUtil.ParseCulture(Request.Headers["Accept-Language"]);
             dateF = DateUtil.DateTime24(culture);
            // Load the Group list box
             if (!IsPostBack)
             {
                 if (Session["couponID"] == null || Request.QueryString["coupon_id"] != null)
                     couponID = Request.QueryString["coupon_id"];
                 else
                     couponID = Session["couponID"].ToString();

                 if (Session["passkey"] == null || Request.QueryString["passkey"] != null)
                     passkey = Request.QueryString["passkey"];
                 else
                     passkey = Session["passkey"].ToString();

                 if (Session["issuerID"] == null || Request.QueryString["issuer_guid"] != null)
                     issuerID = Request.QueryString["issuer_guid"];
                 else
                     issuerID = Session["issuerID"].ToString();

                 if (Session["sbUrl"] == null || Request.QueryString["sb_url"] != null)
                     sbUrl = Request.QueryString["sb_url"];
                 else
                     sbUrl = Session["sbUrl"].ToString();
                 if (Session["userTZ"] != null)
                     userTZ = Convert.ToInt32(Session["userTZ"]);
                 bool unauthorized = false;

                 if (couponID != null && passkey != null && issuerID != null)
                 {
                     try
                     {
                         Coupon coupon = new Coupon(issuerID, long.Parse(couponID), passkey);

                         ProcessAgentDB dbTicketing = new ProcessAgentDB();
                         Ticket ticket = dbTicketing.RetrieveAndVerify(coupon, TicketTypes.MANAGE_USS_GROUP);
                         XmlDocument payload = new XmlDocument();
                         payload.LoadXml(ticket.payload);
                         if (ticket.IsExpired() || ticket.isCancelled)
                         {
                             unauthorized = true;
                             Response.Redirect("Unauthorized.aspx", false);
                         }

                         Session["couponID"] = couponID;
                         Session["passkey"] = passkey;
                         Session["issuerID"] = issuerID;
                         Session["sbUrl"] = sbUrl;
                         userTZ = Convert.ToInt32(payload.GetElementsByTagName("userTZ")[0].InnerText);
                         Session["userTZ"] = userTZ;
                     }

                     catch (Exception ex)
                     {
                         unauthorized = true;
                         Response.Redirect("Unauthorized.aspx", false);
                     }
                 }

                 else
                 {
                     unauthorized = true;
                     Response.Redirect("Unauthorized.aspx", false);
                 }

                 if (!unauthorized)
                 {
                     StringBuilder buf = new StringBuilder();
                     buf.Append("Select criteria for the reservations to be displayed.  Enter date values using this format: '");
                     buf.Append(dateF + " [PM]");
                     buf.Append ("' time may be entered as 24 or 12 hour format.");
                     buf.Append("<br/><br/>Times shown are GMT:&nbsp;&nbsp;&nbsp;" + userTZ / 60.0 + "&nbsp;&nbsp; and use a 24 hour clock.");
                     lblDescription.Text = buf.ToString();
                     lblFormat.Text = dateF;
                     LoadGroupListBox();
                     LoadExperimentListBox();
                 }
             }
             else
             {
                 userTZ = userTZ = Convert.ToInt32(Session["userTZ"]);
             }

            if (ddlTimeIs.SelectedIndex!=4)
            {
                txtTime2.ReadOnly=true;
                txtTime2.BackColor=Color.Lavender;
            }
        }
예제 #14
0
        /// <summary>
        /// Wait the timeout period before checking for Expired issued Tickets,
        /// pause and process External tickets
        /// </summary>
        public void Run()
        {
            while (go)
            {
                // Wait the delay amount
                Thread.Sleep(waitTime);
                ProcessIssuedTickets();
                // sleep 2 minutes then process the external tickets
                Thread.Sleep(120000);
                //Thread.Sleep(3000); // wait 3 seconds - For Debugging
                ProcessAgentDB paDB = new ProcessAgentDB();
                paDB.ProcessExpiredTickets();

            }
        }
예제 #15
0
        public static ProcessAgentInfo[] GetLabServersForClient(int clientID)
        {
            List<ProcessAgentInfo> servers = null;
            DbConnection myConnection = FactoryDB.GetConnection();
            DbCommand myCommand = FactoryDB.CreateCommand("LabServerClient_RetrieveServerIDs", myConnection);
            myCommand.CommandType = CommandType.StoredProcedure;
            myCommand.Parameters.Add(FactoryDB.CreateParameter( "@labClientID", clientID, DbType.Int32));
            DbDataReader reader = null;
            try
            {
                myConnection.Open();
                reader = myCommand.ExecuteReader();
                if (reader != null && reader.HasRows)
                {
                    servers = new List<ProcessAgentInfo>();
                    ProcessAgentDB paDB = new ProcessAgentDB();
                    while (reader.Read())
                    {

                        int serverID = reader.GetInt32(0);
                        ProcessAgentInfo pai = paDB.GetProcessAgentInfo(serverID);
                        if (pai != null && !pai.retired)
                        {
                            servers.Add(pai);
                        }
                    }
                }
            }
            catch(Exception ex)
            {
                throw new Exception("Exception thrown in getLabServersForClient: " + ex.Message, ex);
            }
            finally
            {
                myConnection.Close();
            }

            if (servers != null)
                return servers.ToArray();
            else
                return null;
        }
예제 #16
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            btnRemove.Attributes.Add("onclick", "javascript:if(confirm('Are you sure you want to remove this experiment Information?')== false) return false;");
            experimentInfoIds=USSSchedulingAPI.ListExperimentInfoIDs();
            experimentInfos=USSSchedulingAPI.GetExperimentInfos(experimentInfoIds);
            lssInfoIds=USSSchedulingAPI.ListLSSInfoIDs();
            lssInfos=USSSchedulingAPI.GetLSSInfos(lssInfoIds);

            if(!IsPostBack)
            {
                if (Session["couponID"] == null)
                    couponID = Request.QueryString["coupon_id"];
                else
                    couponID = Session["couponID"].ToString();

                if (Session["passkey"] == null)
                    passkey = Request.QueryString["passkey"];
                else
                    passkey = Session["passkey"].ToString();

                if (Session["issuerID"] == null)
                    issuerID = Request.QueryString["issuer_guid"];
                else
                    issuerID = Session["issuerID"].ToString();

                if (Session["sbUrl"] == null)
                    sbUrl = Request.QueryString["sb_url"];
                else
                    sbUrl = Session["sbUrl"].ToString();

                bool unauthorized = false;

                if (couponID != null && passkey != null && issuerID != null)
                {
                    try
                    {
                        Coupon coupon = new Coupon(issuerID, long.Parse(couponID), passkey);

                        ProcessAgentDB dbTicketing = new ProcessAgentDB();
                        Ticket ticket = dbTicketing.RetrieveAndVerify(coupon, TicketTypes.ADMINISTER_USS);

                        if (ticket.IsExpired() || ticket.isCancelled)
                        {
                            unauthorized = true;
                            Response.Redirect("Unauthorized.aspx", false);
                        }

                        Session["couponID"] = couponID;
                        Session["passkey"] = passkey;
                        Session["issuerID"] = issuerID;
                        Session["sbUrl"] = sbUrl;
                    }

                    catch (Exception ex)
                    {
                        unauthorized = true;
                        Response.Redirect("Unauthorized.aspx", false);
                    }
                }

                else
                {
                    unauthorized = true;
                    Response.Redirect("Unauthorized.aspx", false);
                }

                if (!unauthorized)
                {
                    // Load the Experiment list box
                    ddlExperiment.Items.Add(new ListItem(" ---------- select Experiment ---------- "));
                    for (int i = 0; i < experimentInfos.Length; i++)
                    {
                        string exper = experimentInfos[i].labClientName + " : " + experimentInfos[i].labClientVersion;
                        ddlExperiment.Items.Add(new ListItem(exper, experimentInfos[i].experimentInfoId.ToString()));
                    }
                    // Load the LSSlist box
                    ddlLSS.Items.Add(new ListItem(" ---------- select Lab side scheduling server ---------- "));
                    for (int i = 0; i < lssInfos.Length; i++)
                    {
                        ddlLSS.Items.Add(new ListItem(lssInfos[i].lssName, lssInfos[i].lssGuid));
                    }

                    // Set the GUID field to not ReadOnly
                    SetReadOnly(false);
                }

            }
        }
 public static ExperimentSummary RetrieveExperimentSummary(long experimentID)
 {
     ExperimentSummary summary = InternalDataDB.SelectExperimentSummary(experimentID);
     if (summary.HasEss && ((summary.status | StorageStatus.CLOSED) == 0))
     {
         ProcessAgentDB ticketing = new ProcessAgentDB();
         // Retrieve the ESS Status info and update as needed
         //This uses a generic ReadRecords ticket created for the ESS
         ProcessAgentInfo ess = ticketing.GetProcessAgentInfo(summary.essGuid);
         if ((ess != null) && !ess.retired)
         {
             ExperimentStorageProxy essProxy = new ExperimentStorageProxy();
             essProxy.Url = ess.webServiceUrl;
             essProxy.OperationAuthHeaderValue = new OperationAuthHeader();
             essProxy.OperationAuthHeaderValue.coupon = ess.identOut;
             StorageStatus status = essProxy.GetExperimentStatus(experimentID);
             bool needsUpdate = false;
             if (status != null)
             {
                 if (summary.closeTime != status.closeTime)
                 {
                     summary.closeTime = status.closeTime;
                     needsUpdate = true;
                 }
                 if (summary.recordCount != status.recordCount)
                 {
                     summary.recordCount = status.recordCount;
                     needsUpdate = true;
                 }
                 if (summary.status != status.status)
                 {
                     summary.status = status.status;
                     needsUpdate = true;
                 }
             }
             if (needsUpdate)
             {
                 InternalDataDB.UpdateExperimentStatus(status);
             }
         }
     }
     return summary;
 }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            culture = DateUtil.ParseCulture(Request.Headers["Accept-Language"]);
            localTzOffset = DateUtil.LocalTzOffset;
            if (!IsPostBack)
            {
                lblDateTimeFormat.Text = culture.DateTimeFormat.ShortDatePattern;
                if (Session["couponID"] == null || Request.QueryString["coupon_id"] != null)
                    couponID = Request.QueryString["coupon_id"];
                else
                    couponID = Session["couponID"].ToString();

                if (Session["passkey"] == null || Request.QueryString["passkey"] != null)
                    passkey = Request.QueryString["passkey"];
                else
                    passkey = Session["passkey"].ToString();

                if (Session["issuerID"] == null || Request.QueryString["issuer_guid"] != null)
                    issuerID = Request.QueryString["issuer_guid"];
                else
                    issuerID = Session["issuerID"].ToString();

                if (Session["sbUrl"] == null || Request.QueryString["sb_url"] != null)
                    sbUrl = Request.QueryString["sb_url"];
                else
                    sbUrl = Session["sbUrl"].ToString();

                bool unauthorized = false;

                if (couponID != null && passkey != null && issuerID != null)
                {
                    try
                    {
                        Coupon coupon = new Coupon(issuerID, long.Parse(couponID), passkey);

                        ProcessAgentDB dbTicketing = new ProcessAgentDB();
                        Ticket ticket = dbTicketing.RetrieveAndVerify(coupon, TicketTypes.MANAGE_LAB);

                        if (ticket.IsExpired() || ticket.isCancelled)
                        {
                            unauthorized = true;
                            Response.Redirect("Unauthorized.aspx", false);
                        }

                        Session["couponID"] = couponID;
                        Session["passkey"] = passkey;
                        Session["issuerID"] = issuerID;
                        Session["sbUrl"] = sbUrl;

                        XmlDocument payload = new XmlDocument();
                        payload.LoadXml(ticket.payload);

                        labServerGuid = payload.GetElementsByTagName("labServerGuid")[0].InnerText;
                        Session["labServerGuid"] = labServerGuid;
                        labServerName = payload.GetElementsByTagName("labServerName")[0].InnerText;
                        Session["labServerName"] = labServerName;
                        userTZ = Convert.ToInt32(payload.GetElementsByTagName("userTZ")[0].InnerText);
                        Session["userTZ"] = userTZ;

                        StringBuilder buf = new StringBuilder("Select criteria for the reservations displayed.<br/><br/>Times shown are LSS local time GMT:&nbsp;&nbsp;&nbsp;");
                        if(localTzOffset > 0)
                            buf.Append("+");
                        buf.Append(localTzOffset / 60.0);
                        buf.Append(".");
                        lblDescription.Text =  buf.ToString();

                    }

                    catch (Exception ex)
                    {
                        unauthorized = true;
                        Response.Redirect("Unauthorized.aspx", false);
                    }
                }

                else
                {
                    unauthorized = true;
                    Response.Redirect("Unauthorized.aspx", false);
                }

                if (!unauthorized)
                {
                    LoadResourceListBox(Session["labServerGuid"].ToString());
                    // Load the Group list box
                    LoadGroupListBox(Session["labServerGuid"].ToString());
                    // Load the Experiment list box
                    LoadExperimentListBox(Session["labServerGuid"].ToString());
                    // load the reservation List box.
                    BuildReservationListBox(Session["labServerGuid"].ToString());
                }
            }

            if (ddlTimeIs.SelectedIndex!=4)
            {
                txtTime2.ReadOnly=true;
                txtTime2.BackColor=Color.Lavender;
            }
        }
예제 #19
0
        public static string RegisterGroupCredentials(int sbId)
        {
            StringBuilder message = new StringBuilder();
            ProcessAgentInfo remoteSB = null;

            ProcessAgentDB db = new ProcessAgentDB();
            ResourceDescriptorFactory factory = ResourceDescriptorFactory.Instance();
            string guid = Utilities.MakeGuid();
            ServiceDescription[] values = null;
            // get the remote sb Proxy
            remoteSB = db.GetProcessAgentInfo(sbId);
            if (remoteSB == null || remoteSB.retired)
            {
                throw new Exception("The remote service broker is not registered or is retired");
            }
            ProcessAgentProxy sbProxy = new ProcessAgentProxy();
            sbProxy.Url = remoteSB.webServiceUrl;
            sbProxy.AgentAuthHeaderValue = new AgentAuthHeader();
            sbProxy.AgentAuthHeaderValue.coupon = remoteSB.identOut;
            sbProxy.AgentAuthHeaderValue.agentGuid = ProcessAgentDB.ServiceGuid;
            sbProxy.Register(guid, values);
            message.AppendLine("RegisterGroupCredentials: " + remoteSB.webServiceUrl + " \t" + guid + " \t" + "success");
            return message.ToString();
        }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (!IsPostBack)
            {
                if (secure)
                {
                    // Query values from the request
                    string couponId = Request.QueryString["coupon_id"];
                    string passkey = Request.QueryString["passkey"];
                    string issuerGuid = Request.QueryString["issuer_guid"];
                    string returnTarget = Request.QueryString["sb_url"];
                    if ((returnTarget != null) && (returnTarget.Length > 0))
                        Session["returnURL"] = returnTarget;

                    // this should be the Operation Coupon
                    if (!(passkey != null && passkey != "" && couponId != null && couponId != "" && issuerGuid != null && issuerGuid != ""))
                    {

                        Coupon coupon = new Coupon(issuerGuid, long.Parse(couponId), passkey);

                        ProcessAgentDB dbTicketing = new ProcessAgentDB();
                        Ticket ticket = dbTicketing.RetrieveAndVerify(coupon, TicketTypes.MANAGE_LAB);

                        if (ticket.IsExpired() || ticket.isCancelled)
                        {

                            Response.Redirect("Unauthorized.aspx", false);
                        }

                        Session["couponID"] = couponId;
                        Session["passkey"] = passkey;
                        Session["issuerID"] = issuerGuid;
                        Session["sbUrl"] = returnTarget;
                    }
                }
                btnDelete.Attributes.Add("onclick", "javascript:if(confirm('Are you sure you want to remove this Lab application?')== false) return false;");

                LoadLabList();
                String returnURL = (string)Session["returnURL"];
                if ((returnURL != null) && (returnURL.Length > 0))
                {
                    lnkBackSB.NavigateUrl = returnURL;
                    lnkBackSB.Visible = true;
                }
                else
                {
                    lnkBackSB.Visible = false;
                }
                lblErrorMessage.Visible = false;
            }
        }
예제 #21
0
        // Provider Registration methods - issued by the provider
        public static string RegisterClientServices(int sbId, Coupon lssCoupon, int lssId,
            Coupon lsCoupon, int lsId, Coupon clientCoupon, int clientId)
        {
            bool error = false;
            StringBuilder message = new StringBuilder();
            string lsDescriptor = null;
            string lssDescriptor = null;
            string clientDescriptor = null;
            ProcessAgentInfo remoteSB;
            ProcessAgentDB db = new ProcessAgentDB();
            ResourceDescriptorFactory factory = ResourceDescriptorFactory.Instance();
            try
            {
                // Check for enough information to perform the register

                    lsDescriptor = factory.CreateProcessAgentDescriptor(lsId);
                    if(lssId > 0)
                        lssDescriptor = factory.CreateProcessAgentDescriptor(lssId);

                    clientDescriptor = factory.CreateClientDescriptor(clientId);

                // What tickets do we need, create them

                string guid = Utilities.MakeGuid();
                ServiceDescription[] values = null;
                if (lssDescriptor != null)
                {
                    // Order is important
                    values = new ServiceDescription[3];
                    values[0] = new ServiceDescription(lssDescriptor, lssCoupon, null);
                    values[1] = new ServiceDescription(lsDescriptor, lsCoupon, null);
                    values[2] = new ServiceDescription(clientDescriptor, clientCoupon, null);
                }
                else
                {
                    values = new ServiceDescription[2];
                    values[0] = new ServiceDescription(lsDescriptor, lsCoupon, null);
                    values[1] = new ServiceDescription(clientDescriptor, clientCoupon, null);
                }

                // get the remote sb Proxy
                remoteSB = db.GetProcessAgentInfo(sbId);
                if (remoteSB == null || remoteSB.retired)
                {
                    throw new Exception("The remote service broker is not registered or is retired");
                }
                ProcessAgentProxy sbProxy = new ProcessAgentProxy();
                sbProxy.Url = remoteSB.webServiceUrl;
                sbProxy.AgentAuthHeaderValue = new AgentAuthHeader();
                sbProxy.AgentAuthHeaderValue.coupon = remoteSB.identOut;
                sbProxy.AgentAuthHeaderValue.agentGuid = ProcessAgentDB.ServiceGuid;
                sbProxy.Register(guid, values);
                message.AppendLine("RegisterClientServices: " + remoteSB.webServiceUrl + " \t" + guid + " \t" + "success");
            }
            catch (Exception ex)
            {
                Utilities.WriteLog("Error in cross-Register: " + ex.Message);
                message.AppendLine("Error in cross-Register: " + ex.Message);
                //throw;
            }
            return message.ToString();
        }
예제 #22
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            btnRemove.Attributes.Add("onclick", "javascript:if(confirm('Are you sure you want to remove this experiment Information?')== false) return false;");
            policyIDs = dbManager.ListUSSPolicyIDs();
            policies = dbManager.GetUSSPolicies(policyIDs);
            experimentInfoIds = dbManager.ListExperimentInfoIDs();
            experimentInfos = dbManager.GetExperimentInfos(experimentInfoIds);
            credentialSetIds = dbManager.ListCredentialSetIds();
            credentials = dbManager.GetCredentialSets(credentialSetIds);

            if (!IsPostBack)
            {

                if (Session["couponID"] == null || Request.QueryString["coupon_id"] != null)
                    couponID = Request.QueryString["coupon_id"];
                else
                    couponID = Session["couponID"].ToString();

                if (Session["passkey"] == null || Request.QueryString["passkey"] != null)
                    passkey = Request.QueryString["passkey"];
                else
                    passkey = Session["passkey"].ToString();

                if (Session["issuerID"] == null || Request.QueryString["issuer_guid"] != null)
                    issuerID = Request.QueryString["issuer_guid"];
                else
                    issuerID = Session["issuerID"].ToString();

                if (Session["sbUrl"] == null || Request.QueryString["sb_url"] != null)
                    sbUrl = Request.QueryString["sb_url"];
                else
                    sbUrl = Session["sbUrl"].ToString();

                bool unauthorized = false;

                if (couponID != null && passkey != null && issuerID != null)
                {
                    try
                    {
                        Coupon coupon = new Coupon(issuerID, long.Parse(couponID), passkey);

                        ProcessAgentDB dbTicketing = new ProcessAgentDB();
                        Ticket ticket = dbTicketing.RetrieveAndVerify(coupon, TicketTypes.MANAGE_USS_GROUP);

                        if (ticket.IsExpired() || ticket.isCancelled)
                        {
                            unauthorized = true;
                            Response.Redirect("Unauthorized.aspx", false);
                        }

                        Session["couponID"] = couponID;
                        Session["passkey"] = passkey;
                        Session["issuerID"] = issuerID;
                        Session["sbUrl"] = sbUrl;

                        XmlDocument payload = new XmlDocument();
                        payload.LoadXml(ticket.payload);

                        groupName = payload.GetElementsByTagName("groupName")[0].InnerText;
                        Session["groupName"] = groupName;
                        sbGuid = payload.GetElementsByTagName("sbGuid")[0].InnerText;
                        Session["sbGuid"] = sbGuid;
                    }

                    catch (Exception ex)
                    {
                        unauthorized = true;
                        Response.Redirect("Unauthorized.aspx", false);
                    }
                }

                else
                {
                    unauthorized = true;
                    Response.Redirect("Unauthorized.aspx", false);
                }

                if (!unauthorized)
                {

                    // Load the Policy list box
                    ddlPolicy.Items.Add(new ListItem(" ---------- select Policy ---------- "));
                    for (int i = 0; i < policies.Length; i++)
                    {
                        UssExperimentInfo exp = dbManager.GetExperimentInfos(new int[] { policies[i].experimentInfoId })[0];
                        string expStr = exp.labClientName + " " + exp.labClientVersion;
                        UssCredentialSet cre = dbManager.GetCredentialSets(new int[] { policies[i].credentialSetId })[0];
                        string creStr = cre.serviceBrokerName + " " + cre.groupName;
                        string pol = creStr + " _ " + expStr;
                        ddlPolicy.Items.Add(new ListItem(pol, policies[i].ussPolicyId.ToString()));
                    }
                    // Load the Experiment box
                    ddlExperiment.Items.Add(new ListItem(" ---------- select Experiment ---------- "));
                    for (int i = 0; i < experimentInfos.Length; i++)
                    {
                        string exper = experimentInfos[i].labClientName + " : " + experimentInfos[i].labClientVersion;
                        ddlExperiment.Items.Add(new ListItem(exper, experimentInfos[i].experimentInfoId.ToString()));
                    }

                    int index = -1;

                    // Load the Credential box
                    ddlGroup.Items.Add(new ListItem(" ---------- select Group ---------- "));
                    for (int i = 0; i < credentials.Length; i++)
                    {
                        string creStr = credentials[i].serviceBrokerName + " : " + credentials[i].groupName;
                        if (credentials[i].groupName.Equals(groupName) && credentials[i].serviceBrokerGuid.Equals(sbGuid))
                            index = credentials[i].credentialSetId;

                        ddlGroup.Items.Add(new ListItem(creStr, credentials[i].credentialSetId.ToString()));

                    }

                    ddlGroup.SelectedValue = index.ToString();
                    ddlGroup.Enabled = false;

                    // Set the GUID field to not ReadOnly
                    SetReadOnly(false);
                }

            }
        }
예제 #23
0
        protected void Page_Load(object sender, System.EventArgs e)
        {
            if (Request.Params["paguid"] != null)
            {
                string paGuid = Request.Params["paguid"];
                ProcessAgentDB ticketing = new ProcessAgentDB();
                paTag = ticketing.GetProcessAgentTag(paGuid);
            }

            if (!Page.IsPostBack)			// populate with all the group IDs
            {
                // populate ticket type drop down
                PopulateTicketTypeDropDown();

                refreshUrlRepeater();
            }
        }
예제 #24
0
 public virtual bool CancelTicket(Coupon coupon, string type, string redeemer)
 {
     bool status = false;
     if (dbTicketing.AuthenticateAgentHeader(agentAuthHeader))
     {
         if (ProcessAgentDB.ServiceGuid.Equals(redeemer))
         {
             ProcessAgentDB ticketing = new ProcessAgentDB();
             status = dbTicketing.DeleteTicket(coupon, type, ProcessAgentDB.ServiceGuid);
         }
         else
         {
             status = false;
         }
     }
     return status;
 }
예제 #25
0
        private void redeemReservation(ReservationInfo res)
        {
            long duration = (res.endTime.Ticks - res.startTime.Ticks) / TimeSpan.TicksPerSecond;
            TicketLoadFactory factory = TicketLoadFactory.Instance();
            ProcessAgentDB ticketing = new ProcessAgentDB();

            string payload = factory.createAllowExperimentExecutionPayload(
                res.startTime, duration, Session["groupName"].ToString(),clientGuid);
            DateTime tmpTime = res.startTime.AddTicks(duration * TimeSpan.TicksPerSecond);
            DateTime utcNow = DateTime.UtcNow;
            long ticketDuration = (tmpTime.Ticks - utcNow.Ticks) / TimeSpan.TicksPerSecond;

            TicketIssuerProxy ticketIssuer = new TicketIssuerProxy();

            //get the SB web service URL, and set the proxy's URL accordingly
            ProcessAgentInfo sbInfo = ticketing.GetServiceBrokerInfo();
            ticketIssuer.Url = sbInfo.webServiceUrl;

            //Get the agent coupon Coupon, to be embedded in the SOAP header of the web service call to the SB
            Coupon agentOutCoupon = sbInfo.identOut;

            iLabs.DataTypes.SoapHeaderTypes.AgentAuthHeader agentAuthHeader = new iLabs.DataTypes.SoapHeaderTypes.AgentAuthHeader();

            //set the SOAP header (of the proxy class) to the agentCoupon
            agentAuthHeader.coupon = agentOutCoupon;
            agentAuthHeader.agentGuid = ProcessAgentDB.ServiceGuid;
            ticketIssuer.AgentAuthHeaderValue = agentAuthHeader;

            //call the CreateTicket web service method on the SB (ticket issuer)
            Coupon allowExecutionCoupon = ticketIssuer.CreateTicket(TicketTypes.ALLOW_EXPERIMENT_EXECUTION,
                sbInfo.agentGuid, ticketDuration, payload);

            if (allowExecutionCoupon != null)
            {
                string couponId = allowExecutionCoupon.couponId.ToString();
                string passkey = allowExecutionCoupon.passkey;
                string issuerGuid = allowExecutionCoupon.issuerGuid;

                string backToSbUrl = Session["sbUrl"].ToString() +
                    "?coupon_id=" + couponId +
                    "&passkey=" + passkey +
                    "&issuer_guid=" + issuerGuid;

                Response.Redirect(backToSbUrl, false);
            }
            else
            {
                string msg = "Exception: ExperimentExecution is not allowed.";
                lblErrorMessage.Text = Utilities.FormatErrorMessage(msg);
                lblErrorMessage.Visible = true;
            }
        }
예제 #26
0
 /// <summary>
 /// anyone access
 /// </summary>
 /// <param name="labServerIDs"></param>
 /// <returns></returns>
 public ProcessAgentInfo[] GetProcessAgentInfosWrapper(int[] ids)
 {
     ProcessAgentDB ticketing = new ProcessAgentDB();
     return ticketing.GetProcessAgentInfos(ids);
 }
예제 #27
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="qualifierReferenceID">the ID of the resource represented by the qualifier (null if not necessary);</param>
        /// <param name="type">one of the statically configured qualifierTypes registered with the Service Broker; the qualifier type is used to check type compatibility between function and qualifier in grants</param>
        /// <param name="name">A semantically meaningful string describing the purpose of the qualifier</param>
        /// <param name="parentQualifierID">the ID of a previously created Qualifier to serve as the parent of the Qualifier being added; the parentID locates the new Qualifier in the hierarchy; additional parents may be added by the AddQualifier-Parent() method</param>
        /// <returns>the ID of the new qualifier if it is successfully created, null otherwise</returns>
        public static int AddQualifier( int qualifierReferenceID, int type, string name, int parentQualifierID )
        {
            Qualifier q = new Qualifier();
            q.qualifierReferenceID = qualifierReferenceID;
            q.qualifierType = type;
            q.qualifierName = name;
            bool qualifierReferenceIDValid = false;

            int qualifierID = -1;
            ProcessAgentDB db = new ProcessAgentDB();
            ProcessAgent agent = null;
            //need to check whether the qualifierReferenceID for a particular qualifierType
            //actually exists before it is added to the table
            switch (type)
            {
                    // LabServerfo
                    // Replace with case for all processAgent types an use exits for the combination of ID & type
                case Qualifier.labServerQualifierTypeID:
                {
                    agent = db.GetProcessAgent(qualifierReferenceID);
                    if(agent != null && ((agent.type.Equals(ProcessAgentType.BATCH_LAB_SERVER))
                        ||(agent.type.Equals(ProcessAgentType.LAB_SERVER)))){
                            qualifierReferenceIDValid = true;
                    }
                    break;
                }

                    //LabClient

            case Qualifier.serviceBrokerQualifierTypeID:
                {
                    agent = db.GetProcessAgent(qualifierReferenceID);
                    if (agent != null && ((agent.type.Equals(ProcessAgentType.SERVICE_BROKER))
                          ||(agent.type.Equals(ProcessAgentType.BATCH_SERVICE_BROKER))
                          || (agent.type.Equals(ProcessAgentType.REMOTE_SERVICE_BROKER))))
                    {
                        qualifierReferenceIDValid = true;
                    }
                    break;
                }

            case Qualifier.labSchedulingQualifierTypeID:
                {
                    agent = db.GetProcessAgent(qualifierReferenceID);
                    if (agent != null && agent.type.Equals(ProcessAgentType.LAB_SCHEDULING_SERVER))
                    {
                        qualifierReferenceIDValid = true;
                    }
                    break;
                }
            case Qualifier.userSchedulingQualifierTypeID:
                {
                    agent = db.GetProcessAgent(qualifierReferenceID);
                    if (agent != null && agent.type.Equals(ProcessAgentType.SCHEDULING_SERVER))
                    {
                        qualifierReferenceIDValid = true;
                    }
                    break;
                }
            case Qualifier.storageServerQualifierTypeID:
                {
                    agent = db.GetProcessAgent(qualifierReferenceID);
                    if (agent != null && agent.type.Equals(ProcessAgentType.EXPERIMENT_STORAGE_SERVER))
                    {
                        qualifierReferenceIDValid = true;
                    }
                    break;
                }
            case Qualifier.labClientQualifierTypeID:
                {
                    int[] labClientIDs = InternalAdminDB.SelectLabClientIDs();
                    foreach (int labClientID in labClientIDs)
                    {
                        if (labClientID == qualifierReferenceID)
                        {
                            qualifierReferenceIDValid = true;
                            break;
                        }
                    }
                    break;
                }
                    //Group
                case Qualifier.groupQualifierTypeID:
                {
                    int[] groupIDs = InternalAdminDB.SelectGroupIDs();
                    foreach(int groupID in groupIDs)
                    {
                        if(groupID == qualifierReferenceID)
                        {
                            qualifierReferenceIDValid = true;
                            break;
                        }
                    }
                    break;
                }

                    //Experiment Collection
                case Qualifier.experimentCollectionQualifierTypeID:
                {
                    int[] groupIDs = InternalAdminDB.SelectGroupIDs();
                    foreach(int groupID in groupIDs)
                    {
                        if(groupID == qualifierReferenceID)
                        {
                            qualifierReferenceIDValid = true;
                            break;
                        }
                    }
                    break;
                }

                //Experiment
                case Qualifier.experimentQualifierTypeID:
                {
                    Criterion c = new Criterion("experiment_id","=",qualifierReferenceID.ToString());
                    if (InternalDataDB.SelectExperimentIDs(new Criterion[] { c }).Length > 0)
                        qualifierReferenceIDValid = true;
                    break;
                }

                // Resource Mapping
                case Qualifier.resourceMappingQualifierTypeID:
                {
                    BrokerDB brokerDb = new BrokerDB();
                    ResourceMapping mapping = brokerDb.GetResourceMapping(qualifierReferenceID);
                    if (mapping != null)

                            qualifierReferenceIDValid = true;
                            break;
                }
            }

            if(qualifierReferenceIDValid)
            {
                try
                {
                    qualifierID = InternalAuthorizationDB.InsertQualifier(q);

                    if(qualifierID != -1)
                    {
                        InternalAuthorizationDB.InsertQualifierHierarchy(qualifierID,parentQualifierID);
                    }
                }
                catch(Exception ex)
                {
                    throw;
                }
            }

            return qualifierID;
        }
예제 #28
0
        private void btnReportBug_Click(object sender, System.EventArgs e)
        {
            if((userID == -1) && (txtEmail.Text.Length == 0))
            {
                lblResponse.Text = "<div class=errormessage><p>Please enter an emailaddress, so we can respond to your report.</p></div>";
                lblResponse.Visible = true;
            }
            else if(ddlArea.SelectedItem.Text.CompareTo("") == 0)
            {
                lblResponse.Text = "<div class=errormessage><p>Please select a general problem catagory.</p></div>";
                lblResponse.Visible = true;
            }
            else if (txtBugReport.Text == "")
            {
                lblResponse.Text = "<div class=errormessage><p>Please enter a description of the problem!</p></div>";
                lblResponse.Visible = true;
            }
            else
            {
                string userEmail = null;
                if((currentUser.email != null) && (currentUser.email != ""))
                {
                    userEmail = currentUser.email;
                }
                else if( ( txtEmail != null) && (txtEmail.Text != null) && (txtEmail.Text != ""))
                {
                    userEmail = txtEmail.Text;
                }
                string problemArea = ddlArea.SelectedItem.Text;
                StringBuilder sb = new StringBuilder();
                ProcessAgentDB agentDB = new ProcessAgentDB();
                SystemSupport support = agentDB.RetrieveSystemSupport(ProcessAgentDB.ServiceGuid);
                //Generate email
                MailMessage mail = new MailMessage();
                if (support.bugEmail != null && support.bugEmail.Length > 2)
                {
                    mail.To = support.bugEmail;
                }
                else
                {
                    mail.To = ConfigurationSettings.AppSettings["bugReportMailAddress"];
                }
                mail.From = userEmail;
                mail.Subject = "[iLabs] " + Server.MachineName + " Bug Report: " + problemArea ;

                if(userID == -1 )
                {
                    sb.Append("User Not Logged In:\n\r");
                    sb.Append("Username: "******"\n\r");
                    sb.Append("Email:  " + txtEmail.Text + "\n\r");
                    if(Session["GroupName"] != null)
                        sb.Append("Group: " + Session["GroupName"].ToString()+ "\n\r");
                }
                else
                {
                    sb.Append(currentUser.firstName + " "+ currentUser.lastName +"\n\r");
                    sb.Append("Username: "******"\n\r");
                    sb.Append("Email:  " + currentUser.email + "\n\r");
                        if(Session["GroupName"] != null)
                            sb.Append("Group: " + Session["GroupName"].ToString()+ "\n\r");
                }
                    sb.Append("\n\r");

                sb.Append("reports the following bug '"+problemArea+"':  \n\r\n\r");
                sb.Append(txtBugReport.Text) ;
                sb.Append("\n\r\n\r");
                sb.Append("Additional Information:\n\r");
                sb.Append("User Browser: "+ Request.Browser.Type +"\n\r");
                sb.Append("User Browser Agent: "+ Request.UserAgent +"\n\r");
                sb.Append("User Platform: "+ Request.Browser.Platform+"\n\r");
                sb.Append("URL used to access page: "+ Request.Url+"\n\r");
                sb.Append("Machine Name: " + Server.MachineName+"\n\r");

                sb.Append("Server Type: " + Server.GetType() + "\n\r");

                if(excep != null)
                {
                    sb.Append("\n\rException Thrown:\n\r");
                    sb.Append(excep.Message + "\n\r\n\r");
                    sb.Append(excep.StackTrace);
                    Server.ClearError();
                }

                mail.Body = sb.ToString();
                SmtpMail.SmtpServer = "127.0.0.1";
                try
                {
                    SmtpMail.Send(mail);
                    if(userEmail != null)
                    {
                        MailMessage uMail = new MailMessage();
                        uMail.To = userEmail;
                        uMail.From = ConfigurationSettings.AppSettings["bugReportMailAddress"];
                        uMail.Subject = "[iLabs] Bug Report: " + problemArea ;
                        uMail.Body = "Thank you for taking the time to report the following bug:\n\r";
                        uMail.Body += txtBugReport.Text;
                        SmtpMail.Send(uMail);
                    }
                    lblResponse.Text = "<div class=errormessage><p>Thank-you! Your bug report has been submitted. An administrator will contact you within 24-48 hours.</p></div>";
                    lblResponse.Visible = true;

                }
                catch (Exception ex)
                {
                    lblResponse.Text = "<div class=errormessage><p>Error sending your bug report, please email "
                        + ConfigurationSettings.AppSettings["bugReportMailAddress"] + ". "+ex.Message+"</p></div>";
                    lblResponse.Visible = true;
                }
            }
        }
예제 #29
0
 /// <summary>
 /// anyone access
 /// </summary>
 /// <param name="labServerIDs"></param>
 /// <returns></returns>
 public ProcessAgentInfo[] GetProcessAgentInfosWrapper(string type)
 {
     ProcessAgentDB ticketing = new ProcessAgentDB();
     return ticketing.GetProcessAgentInfos(type);
 }
예제 #30
0
 public WS_ILabCore()
 {
     //CODEGEN: This call is required by the ASP.NET Web Services Designer
     InitializeComponent();
     dbTicketing = new ProcessAgentDB();
 }