protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { PopulatePricing(); //populateJobs(); referJobs = PopulateReferJobs(); BindDataIntoRepeater(referJobs); //GetCustomersPageWise(1); if (Request.QueryString.Keys.Count > 0) { if (!string.IsNullOrEmpty(ApplicationSession.Current.user.Email)) { if (!string.IsNullOrEmpty(ApplicationSession.Current.user.UserPricingPlan.PlanId)) { Int32 referralsLeft = ApplicationSession.Current.user.UserPricingPlan.ReferralsLeft; Int32 expireDate = DateTime.Compare(Convert.ToDateTime(ApplicationSession.Current.user.UserPricingPlan.PlanExpireDate), DateTime.Now); if (referralsLeft == 0 || expireDate < 0) { userPlanStatus.Visible = true; lblUserPlan.Text = "Your Plan has Expired, Please Buy a new Plan to continue applying Job!!!!"; } else { string jobId = Request.QueryString.GetValues(0)[0].ToString(); string userMessage = SendEmail.BuildAppliedUserJobMail(ApplicationSession.Current.user.Name); string adminMessage = SendEmail.BuildAppliedJobAdminMail(ApplicationSession.Current.user.Email, ApplicationSession.Current.user.Name, jobId); if (ApplyJob(ApplicationSession.Current.user.Email, jobId, userMessage, adminMessage, Constants.MailSubject)) { jobStatus.Visible = true; userPlanStatus.Visible = false; ApplicationSession.Current.user.UserPricingPlan.ReferralsLeft = ApplicationSession.Current.user.UserPricingPlan.ReferralsLeft - 1; } else { jobStatus.Visible = false; userPlanStatus.Visible = false; } } } else { userPlanStatus.Visible = true; lblUserPlan.Text = "Please Buy a Plan to Apply for Jobs!!!!"; } } else { ApplicationSession.Current.UserType = Constants.EMPLOYEE; Response.Redirect("~/register-with-us"); } } //Response.Redirect("~/login"); } }