protected void btnSubmit_Click(object sender, EventArgs e) { string pass = ""; pass = txtPass.Text; if (mycheckbox.Checked == false) // register as Guest { GuestModel _guest = new GuestModel(); Eventrix_Client.Registration reg = new Eventrix_Client.Registration(); _guest.NAME = txtName.Text; _guest.SURNAME = txtSurname.Text; _guest.EMAIL = txtEmail.Text; _guest.PASS = pass; _guest.TYPE = "PUBLIC"; int response = reg.RegisterGuest(_guest); // txtName.Text = response; if (response != -1) { EmailClient emailClient = new EmailClient(); emailClient.sendMsg_SuccessRegistration(_guest); if (profilePic.HasFile) { makeDirectory(response); ImageFile mainPic = new ImageFile(); mainPic = UploadFile(profilePic, response, SUBFOLDER); string res = svcClient.saveImage(mainPic); } // Response.Redirect("Login.aspx"); Popup(true, "Login.aspx"); } else { Popup(false, "Registration.aspx"); // Response.Redirect("Registration.aspx"); } } else //register as event host { EventHostModel _host = new EventHostModel(); Eventrix_Client.Registration reg = new Eventrix_Client.Registration(); _host.NAME = txtName.Text; _host.EMAIL = txtEmail.Text; _host.SURNAME = txtSurname.Text; _host.PASS = pass; string response = reg.RegisterHost(_host); if (response.Contains("successfully")) { EmailClient emailClient = new EmailClient(); emailClient.sendMsg_SuccessRegistration(_host); Popup(true, "Login.aspx"); // Response.Redirect("Login.aspx"); } else { Popup(false, "Registration.aspx"); //.Redirect("Registration.aspx"); } } }
public ActionResult IndexOfEditableEvent() { Helper.ValidateLogin(); var list = new EventHostModel(); list.EditableEvents = GetEditable(); return(View(list)); }
public void SetSessions(EventHostModel _host) { Session.Add("ID", _host.ID.ToString()); Session.Add("Name", _host.NAME); Session.Add("Surname", _host.SURNAME); Session.Add("Email", _host.EMAIL); Session.Add("Level", "Host"); Session.Add("DEFAULT_IMAGE", "ProfilePic.png"); }
public EventHostModel hostLogin(string email, string password) { EventHostModel person = new EventHostModel(); string json = null; JavaScriptSerializer js = null; try { WebClient webClient = new WebClient(); json = webClient.DownloadString(BASE_URL + "hostlogin?email=" + email + "&password=" + password); js = new JavaScriptSerializer(); person = JsonConvert.DeserializeObject <EventHostModel>(json); return(person); } catch { return(null); } }
public bool editHost(EventHostModel _host) { try { DataContractJsonSerializer ser = new DataContractJsonSerializer(typeof(EventHostModel)); MemoryStream mem = new MemoryStream(); ser.WriteObject(mem, _host); string data = Encoding.UTF8.GetString(mem.ToArray(), 0, (int)mem.Length); WebClient webclient = new WebClient(); webclient.Headers["Content-type"] = "application/json"; webclient.Encoding = Encoding.UTF8; webclient.UploadString(BASE_URL + "editHost", "PUT", data); return(true); } catch { return(false); } }
//Sending Email For Successful Registration public void sendMsg_SuccessRegistration(EventHostModel _host) { SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "*****@*****.**"); smtp.EnableSsl = true; MailMessage msg = new MailMessage(); msg.Subject = "Welcome to EventriX"; msg.Body = "Hi " + _host.NAME + ","; msg.Body += "<tr><td>Thank you for signing up with Eventrix, Now you can create, browse and manage your events and so much more.</td></tr>"; msg.Body += "<td>Please <a href='http://*****:*****@gmail.com"; msg.From = new MailAddress(FromAddress); msg.IsBodyHtml = true; try { smtp.Send(msg); } catch (Exception ex) { ex.Message.ToString(); } }
//Sending Invitation public void sendMsgInvite(GuestModel _guest, EventModel _event, string pass, int EventID) { EventAddress addres = new EventAddress(); MappingClient add_client = new MappingClient(); addres = add_client.getAddressById(Convert.ToString(_event.EventAddress)); EventHostModel host = new EventHostModel(); HostServiceClient ev_host = new HostServiceClient(); host = ev_host.findhsotbyID(Convert.ToString(_event.HostID)); SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "*****@*****.**"); smtp.EnableSsl = true; MailMessage msg = new MailMessage(); msg.Subject = "Invitation to the " + _event.Name; msg.Body = "Hi " + _guest.NAME + ","; msg.Body += "<tr><td>EventriX would like to invite you to attend the " + _event.Desc + "</td></tr>"; msg.Body += "<tr>"; msg.Body += "<td><img src='" + _event.ImageLocation + "' alt=''/></td>"; msg.Body += "</tr>"; msg.Body += "<tr>"; msg.Body += "<td>" + _event.eDate + "</td>"; msg.Body += "</tr>"; msg.Body += "<tr>"; msg.Body += "<td> Location: " + addres.STREET + ", " + addres.CITY + ", " + addres.PROVINCE + "</td>"; msg.Body += "</tr>"; msg.Body += "<tr>"; //http://localhost:60469/Login.aspx?e_ID= // msg.Body += "<td>To RSVP please <a href='http://*****:*****@gmail.com"; msg.From = new MailAddress(FromAddress); msg.IsBodyHtml = true; try { smtp.Send(msg); } catch (Exception ex) { ex.Message.ToString(); } }
//Sending survey emails to guest public void sendSurvey(string Name, string Email, EventModel _event) { EventAddress addres = new EventAddress(); MappingClient add_client = new MappingClient(); addres = add_client.getAddressById(Convert.ToString(_event.EventAddress)); EventHostModel host = new EventHostModel(); HostServiceClient ev_host = new HostServiceClient(); host = ev_host.findhsotbyID(Convert.ToString(_event.HostID)); SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "*****@*****.**"); smtp.EnableSsl = true; MailMessage msg = new MailMessage(); msg.Subject = "Post Event Survey for " + _event.Name; msg.Body = "Hi " + Name + ","; msg.Body += "<tr><td>On behalf of TNT Eventrix and " + _event.Name + ", we would like to thank you for taking part.</td></tr>"; msg.Body += "<tr>"; msg.Body += "<td>Would you take 3 minutes of your time and complete the very breif survey and help us help you in improving your satisfaction for our next event?</td>"; msg.Body += "</tr>"; msg.Body += "<tr>"; msg.Body += "<td>Kindly <a href='http://*****:*****@gmail.com"; msg.From = new MailAddress(FromAddress); msg.IsBodyHtml = true; try { smtp.Send(msg); } catch (Exception ex) { ex.Message.ToString(); } }
protected void btnLogin_Click1(object sender, EventArgs e) { string RSVPEventID = Request.QueryString["e_ID"]; UserLogin LoginClient = new UserLogin(); GuestModel guest = new GuestModel(); EventHostModel host = new EventHostModel(); StaffModel staff = new StaffModel(); string pass = txtLogPass.Text; string email = txtUserName.Text; host = LoginClient.hostLogin(email, pass); if (host == null) //if user is not a host then check guest and host { guest = LoginClient.Guestlogin(email, pass); if (guest == null) //user is not a host nor a guest { staff = LoginClient.staffLogin(email, pass); if (staff == null) //the user is neither staff, guest nor host { // Response.Redirect("Login.aspx"); Popup(false, "Login.aspx"); } else //the user is a staff { SetSessions(staff); int LogID = Convert.ToInt32(Session["ID"]); string homeIndex = "Index.aspx?LoggedID=" + LogID + "&Type=All"; Popup(true, homeIndex); // Response.Redirect(homeIndex); } } else //the user is a guest { string survey = Request.QueryString["purp"]; if (survey != null && RSVPEventID != null) { SetSessions(guest); string strURL = "EventSurvey.aspx?eventID=" + RSVPEventID; // Response.Redirect("EventSurvey.aspx?eventID="+ RSVPEventID); GetProfilePicture(guest.ID.ToString()); //Get guest image or default picture Popup(true, strURL); } else if (RSVPEventID != null) { SetSessions(guest); GetProfilePicture(guest.ID.ToString()); //Get guest image or default picture string strURL = "EventRSVP.aspx?ev=" + RSVPEventID; // Response.Redirect("EventRSVP.aspx?EventID=" + RSVPEventID); Popup(true, strURL); } else { SetSessions(guest); int LogID = Convert.ToInt32(Session["ID"]); GetProfilePicture(LogID.ToString()); //Get guest image or default picture string homeIndex = "Index.aspx?LoggedID=" + LogID + "&Type=Guest"; Popup(true, homeIndex); } } } else //the user is a host { // txtLogName.Text = host.NAME; SetSessions(host); int LogID = Convert.ToInt32(Session["ID"]); string homeIndex = "Index.aspx?LoggedID=" + LogID + "&Type=Host"; Popup(true, homeIndex); } }