protected string getEventName(string eventID) { int eID = int.Parse(eventID); EventClient evClient = new EventClient(); string evName = evClient.GetEventName(eID); evClient.Close(); return evName; }
private void loadTreeView() { EventClient evClient = new EventClient(); Events event_ = evClient.GetEvent(EventID()); evClient.Close(); treeWS.Nodes.Clear(); TreeNode treeRoot = new TreeNode(event_.Name); treeRoot.ImageUrl = "~/images/folders.gif"; loadFolders(treeRoot); treeWS.Nodes.Add(treeRoot); treeWS.ExpandAll(); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { lblSelectedFolder.Text = "-"; string eventOrganizerID = ""; int domain = -1; try { domain = int.Parse(Session["Domain"].ToString()); } catch (Exception) { domain = -1; } if (domain != 1) Response.Redirect("~/Error404.aspx"); if (EventID() == -1) Response.Redirect("~/Error404.aspx"); bool authenticated = false; EventClient evClient = new EventClient(); eventOrganizerID = evClient.GetEvent(EventID()).Organizerid; evClient.Close(); if (NUSNetUser() != null) { RoleClient roleClient = new RoleClient(); try { if (roleClient.haveRightsTo(EventID(), NUSNetUser().UserID, EnumFunctions.Manage_Artefacts)) { authenticated = true; } } catch (Exception ex) { authenticated = false; } finally { roleClient.Close(); } } if (!authenticated) Response.Redirect("~/Error403.aspx"); } loadTreeView(); }
private void loadTreeView() { EventClient evClient = new EventClient(); Events event_ = null; try { event_ = evClient.GetEvent(EventID()); } catch (Exception) { evClient.Close(); Alert.Show("You are not authorized to view this workspace!", true, "SelectEventWorkspace.aspx"); return; } evClient.Close(); treeWS.Nodes.Clear(); TreeNode treeRoot = new TreeNode(event_.Name); treeRoot.ImageUrl = "~/images/folders.gif"; loadFolders(treeRoot); treeWS.Nodes.Add(treeRoot); treeWS.ExpandAll(); }
public static void sendRequesteeMail(string senderName, int eventID, string title, string targetEmail, string url, string pwd) { EventClient evClient = new EventClient(); Events evnt = evClient.GetEvent(eventID); evClient.Close(); StringBuilder sb = new StringBuilder(); string FromEmail = "*****@*****.**"; MailMessage mailMsg = new MailMessage(); mailMsg.To.Add(targetEmail); mailMsg.From = new System.Net.Mail.MailAddress(FromEmail, "No-Reply (NUS GEMS)"); mailMsg.Subject = "New Request From NUS GEMS (General Events Management System)"; mailMsg.IsBodyHtml = true; sb.AppendLine(); sb.AppendLine("To whom it may concern,"); sb.AppendLine(senderName + " from National University of Singapore has sent you a request regarding " + title); sb.AppendLine("for the event " + evnt.Name + " held from " + evnt.StartDateTime.Date.ToString("dd MMM yyyy") + " to " + evnt.EndDateTime.Date.ToString("dd MMM yyyy")); sb.AppendLine(); sb.AppendLine("For more details about the request, please login at our website <a href='" + url + "'> here </a>"); sb.AppendLine(); sb.AppendLine("Your userid is " + targetEmail + " and your password is " + pwd); sb.AppendLine(); sb.AppendLine(); sb.AppendLine("Thanks and Regards"); sb.AppendLine(); sb.AppendLine("NUS GEMS Server Administrator"); sb.AppendLine(); sb.AppendLine("This e-mail is an auto-responder, Please do not reply to this e-mail"); sb.AppendLine(); sb.AppendLine("We thank you for your co-operation."); mailMsg.Body = sb.ToString().Replace(Environment.NewLine, "<br>"); try { NetworkCredential basicAuthenticationInfo = new NetworkCredential(smtpUserName, smtpPwd); SmtpClient MailObj = new SmtpClient(smtpServer, port); MailObj.Credentials = basicAuthenticationInfo; MailObj.Send(mailMsg); } catch (Exception ex) { throw ex; } }
private void getEventSummary() { Events event_; EventClient client = new EventClient(); event_ = client.GetEvent(EventID()); lblEventName.Text = event_.Name; lblFrmDate.Text = event_.StartDateTime.ToString("dd MMM yyyy"); lblToDate.Text = event_.EndDateTime.ToString("dd MMM yyyy"); txtEventDesc.Text = event_.Description; client.Close(); }
private void GetEventsForUser(DateTime start, DateTime end) { List<Events> events = new List<Events>(); try { User u = (User)Session["nusNETuser"]; if (u == null) { Alert.Show("Please Login First!", true, "SignIn.aspx"); return; } EventClient client = new EventClient(); List<Events> userEvent = client.ViewEventsByDateAndTag(u, start, end, txtTag.Text.Trim()).ToList<Events>(); client.Close(); rtpEvent.DataSource = userEvent; rtpEvent.DataBind(); } catch (Exception ex) { Alert.Show("Error Retreiving List of Events from Server", false, "~/Default.aspx"); return; } }
private void removeUnwantedFolders(string logFile) { string wrkSpaceDir = System.Web.Hosting.HostingEnvironment.MapPath("~") + "WorkSpace\\"; EventClient evClient = new EventClient(); string[] subdirs = System.IO.Directory.GetDirectories(wrkSpaceDir); foreach (string dir in subdirs) { int evFolder; string dirToCheck = dir.Substring(dir.LastIndexOf('\\')).Remove(0, 1); bool parse = int.TryParse(dirToCheck, out evFolder); if (!evClient.isEventExist(evFolder) || !parse) { emptyFolder(dir); System.IO.Directory.Delete(dir); } } evClient.Close(); System.IO.StreamWriter strWriter = new System.IO.StreamWriter(logFile, false); strWriter.WriteLine(DateTime.Now.ToString("yyyyMMdd")); strWriter.Close(); }
//TODO, Put radio buttons to set the date //1 month, 3 months this year.. protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { int eventID = int.Parse(Request.QueryString["EventID"]); EventClient evClient = new EventClient(); Events event_; List<EventDay> evDays_; try { event_ = evClient.GetEvent(eventID); evDays_ = evClient.GetDays(event_.EventID).ToList<EventDay>(); } catch (Exception ex) { evClient.Close(); Response.Redirect("~/Error404.aspx"); return; } evClient.Close(); try { this.hypRegister.NavigateUrl = "~/Register.aspx?EventID=" + eventID.ToString() + "&Name=" + event_.Name; RegistrationClient client = new RegistrationClient(); Publish publish = client.ViewPublish(eventID); client.Close(); menuEvent.Visible = true; mvTab.Visible = true; lbleventname.Text = event_.Name; lbleventdate.Text = "From " + event_.StartDateTime.ToString("dd MMM yyyy") + " To " + event_.EndDateTime.ToString("dd MMM yyyy"); lbleventdescription.Text = event_.Description; hypeventwebsite.Text = event_.Website; if (event_.Website.Length == 0) { hypeventwebsite.Visible = false; lblWebsite.Visible = false; } else { hypeventwebsite.NavigateUrl = event_.Website; } if (publish != null) { lbleventpublishinfo.Text = publish.Remarks; lblPublish.Visible = true; if (publish.PaymentAMount > 0) { lblpaymentinfo.Text = "$" + publish.PaymentAMount.ToString("0.00"); } else { lblpaymentinfo.Text = "Event is Free! :)"; } } else { lbleventpublishinfo.Text = ""; lblPublish.Visible = false; lblpaymentinfo.Text = ""; } lblpaymentinfo.Visible = lblPublish.Visible; lblpaymentinfo.Visible = lblpayment.Visible; ddlEventDay.DataSource = evDays_; ddlEventDay.DataValueField = "DayID"; ddlEventDay.DataTextField = "StartDateTime"; ddlEventDay.DataBind(); ddlEventDay_SelectedIndexChanged(this.ddlEventDay, new EventArgs()); evClient.Close(); if (publish == null || (publish.StartDateTime > DateTime.Now || publish.EndDateTime < DateTime.Now)) { this.hypRegister.Visible = false; } else { hypRegister.Visible = true; } } catch (Exception ex) { Alert.Show("Error Retreiving List of Events from Server", false, "~/Default.aspx"); return; } } }