Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Web;
- using System.Web.UI;
- using System.Web.UI.WebControls;
- using ClassLibrary.model;
- using ClassLibrary.DBMon;
- using ClassLibrary.utility;
- using ClassLibrary;
- using System.Data;
- using System.IO;
- using System.Net;
- using System.Threading;
- using System.Text;
- using System.Web.Mail;
- namespace BollyWoodArtists.Admin
- {
- public partial class home : System.Web.UI.Page
- {
- register1 ObjMember = new register1();
- protected void Page_Load(object sender, EventArgs e)
- {
- if (Session["MemberId"] == null)
- {
- Response.Redirect("~/login.aspx");
- }
- if (!IsPostBack)
- {
- LookForExpiredAccounts();
- DataTable Settings = ObjMember.getSettingsTbl();
- txtNoofdays.Text = Settings.Rows[0]["FreeMonths"].ToString();
- if (Settings.Rows[0]["FreeMode"].ToString() == "1")
- {
- rdbFee.Checked = true;
- rdbPayment.Checked = false;
- }
- else
- {
- rdbFee.Checked = false;
- rdbPayment.Checked = true;
- }
- }
- }
- protected void Submit_Click(object sender, EventArgs e)
- {
- ObjMember.PasswordReset(txtNewPassword.Text, 1);
- Response.Write("<script>alert('Your Password has been changed successfully')</script>");
- }
- protected void btnPasswordResetClick(object sender, EventArgs e)
- {
- txtNewPassword.Text = "";
- txtConfirmPassword.Text = "";
- }
- protected void btnSettings_Click(object sender, EventArgs e)
- {
- int mode = 0;
- if (rdbFee.Checked == true)
- {
- mode = 1;
- }
- ObjMember.PostAuditionUpdate(txtNoofdays.Text, mode);
- }
- protected void btn_Submit_Click(object sender, EventArgs e)
- {
- string showreel, content;
- if (radShow.Checked == true)
- {
- showreel = "1";
- content = txtLocation.Text;
- }
- else if (radHide.Checked == true)
- {
- showreel = "0";
- content = null;
- }
- else
- {
- showreel = "0";
- content = null;
- }
- ObjMember.UpdateShowReel(showreel, content);
- Response.Redirect("home.aspx");
- }
- protected void LookForExpiredAccounts()
- {
- register1 ObjLogin = new register1();
- DataTable expiredMembers = new DataTable();
- clsAuditionsDisplay ObjAuditions = new clsAuditionsDisplay();
- expiredMembers = ObjLogin.getMembersExpired();
- if (expiredMembers != null)
- {
- if (expiredMembers.Rows.Count != 0 && expiredMembers != null)
- {
- for (int i = 0; i < expiredMembers.Rows.Count; i++)
- {
- int MemberId = Convert.ToInt32(expiredMembers.Rows[i]["MemberId"].ToString());
- ObjAuditions.ChangeMemberStatustoExpiry1(MemberId);
- sendemail(MemberId, expiredMembers, i);
- SendSMS(expiredMembers, i);
- }
- }
- }
- }
- public void sendemail(int MemberId, DataTable Member, int rowNo)
- {
- MailMessage msgMail = new MailMessage();
- msgMail.To = Member.Rows[rowNo]["EmailID"].ToString();
- msgMail.From = "admin@auditionbollywood.com";
- msgMail.Subject = "Auditions BollyWood Account Expire";
- msgMail.BodyFormat = MailFormat.Text;
- StringBuilder sb = new StringBuilder();
- sb.AppendFormat("Hi !\n\n");
- sb.AppendFormat("Your Audition Bollywood Account has been expired.Please pay the payment for activation.\n");
- sb.AppendFormat("Click the below link to pay to activate your account\n");
- string link = string.Format("http://www.auditionbollywood.com/paymentrenewal.aspx?MemberId={0}", MemberId.ToString());
- sb.Append(link);
- sb.AppendFormat("\n\nThank You");
- msgMail.Body = sb.ToString();
- msgMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver", "mail.auditionbollywood.com");
- msgMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", 587);
- msgMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing", 2);
- msgMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1");
- msgMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "admin@auditionbollywood.com");
- msgMail.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "************");
- SmtpMail.SmtpServer = "mail.auditionbollywood.com";
- SmtpMail.Send(msgMail);
- }
- private void SendSMS(DataTable Member, int rowNo)
- {
- try
- {
- StreamReader objReader;
- string Message = "Hi" + " " + Member.Rows[rowNo]["FirstName"].ToString() + " " + ",Your Audition Bollywood Account has been expired.";
- Uri myuri = new Uri("SMS SENDING TOKEN" + Member.Rows[rowNo]["MobilNo"].ToString() + "&message=" + Message);
- WebRequest myWebRequest = WebRequest.Create(myuri);
- Stream objStream;
- objStream = myWebRequest.GetResponse().GetResponseStream();
- objReader = new StreamReader(objStream);
- objReader.Close();
- }
- catch (Exception Ex)
- {
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement