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; } } }
/// <summary> /// This only registers the ProviderInfo systemSupport block(s) /// </summary> /// <param name="registerGuid"></param> /// <param name="info"></param> protected virtual void register(string registerGuid, ServiceDescription[] info) { StringBuilder message = new StringBuilder(); ProcessAgentDB dbTicketing = new ProcessAgentDB(); message.AppendLine("Register called on " + ProcessAgentDB.ServiceAgent.codeBaseUrl); if (info != null && info.Length > 0) { foreach (ServiceDescription sd in info) { Coupon coupon = null; if (sd.coupon != null) { coupon = sd.coupon; } if (sd.serviceProviderInfo != null && sd.serviceProviderInfo.Length > 0) { XmlQueryDoc xdoc = new XmlQueryDoc(sd.serviceProviderInfo); string descriptorType = xdoc.GetTopName(); if (descriptorType.Equals("systemSupport")) { SystemSupport ss = SystemSupport.Parse(xdoc); if (ss.agentGuid != null && ss.agentGuid.Length > 0) { int id = dbTicketing.GetProcessAgentID(ss.agentGuid); if (id > 0) { dbTicketing.SaveSystemSupport(ss.agentGuid, ss.contactEmail, ss.bugEmail, ss.infoUrl, ss.description, ss.location); if (sd.consumerInfo != null && sd.consumerInfo.CompareTo("requestSystemSupport") == 0) { ProcessAgentInfo paInfo = dbTicketing.GetProcessAgentInfo(ss.agentGuid); if (paInfo != null) { SystemSupport mySS = dbTicketing.RetrieveSystemSupport(ProcessAgentDB.ServiceGuid); if (mySS != null) { ServiceDescription[] values = new ServiceDescription[1]; values[0] = new ServiceDescription(mySS.ToXML(), null, null); ProcessAgentProxy proxy = new ProcessAgentProxy(); proxy.Url = paInfo.webServiceUrl; proxy.AgentAuthHeaderValue = new AgentAuthHeader(); proxy.AgentAuthHeaderValue.coupon = paInfo.identOut; proxy.AgentAuthHeaderValue.agentGuid = ProcessAgentDB.ServiceGuid; proxy.Register(registerGuid, values); } } } } } } } } } }