示例#1
0
    private static void DailyTasks()
    {
        DIYPTEntities db = new DIYPTEntities();

        try
        {
            PrizeEmailWrapper.ExercisePlan2DaysPriorToStartEmailTask();

            db.Database.Connection.Open();
            DateTime today = PrizeCommonUtils.GetDayStart(PrizeCommonUtils.GetSystemDate());

            PrizePollingTask task = (from c in db.PrizePollingTasks
                                     where c.TaskDate >= today && c.TaskType == (int)PrizeConstants.TasksType.DailyRedoAble
                                     select c).FirstOrDefault();

            if (task == null || task.Count < 2)
            {
                PrizeMemberPlanManager.UpdateMemberPlans();

                PrizeEmailWrapper.DailyEmailTask();

                if (task == null)
                {
                    task          = new PrizePollingTask();
                    task.Status   = "1";
                    task.TaskDate = PrizeCommonUtils.GetSystemDate();
                    task.TaskType = (int)PrizeConstants.TasksType.DailyRedoAble;
                    task.Count    = 1;
                    db.PrizePollingTasks.Add(task);
                }
                else
                {
                    task.Count++;
                }

                db.SaveChanges();
            }
        }
        catch (Exception e)
        {
            PrizeLogs.SaveSystemErrorLog(0, 0, PrizeConstants.SystemErrorLevel.LevelSerious, typeof(RegisteredEvents).ToString(), "DailyTasks", e.Message, e.InnerException == null ? "" : e.InnerException.Message);
            return;
        }
        finally
        {
            db.Database.Connection.Close();
        }
    }
示例#2
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            if (!txtPassword.Text.Equals(txtConfirmPwd.Text))
            {
                lblMsg.Text = "The password and the confirmation password are not equal.";
                return;
            }

            string         username = txtFirstName.Text + " " + tbLastName.Text;
            MembershipUser newUser  = Membership.CreateUser(txtEmail.Text, txtPassword.Text, txtEmail.Text);

            bool bLogin = Membership.ValidateUser(txtEmail.Text, txtPassword.Text);
            if (bLogin != false)
            {
                Member uMember = Member.GetMemberFromLoginNameAndPassword(txtEmail.Text, txtPassword.Text);
                if (uMember != null)
                {
                    AddNewUserDetails(uMember.Id);
                    Session["taRegistration"] = uMember.Email;
                    System.Web.Security.FormsAuthentication.SetAuthCookie(uMember.LoginName, true);
                    Member.AddMemberToCache(uMember);   //, true, new TimeSpan(0, timeout, 0));
                    string sLocation = ddlLocation.Text;
                    string sProgram  = ddlProgram.Text;
                    PrizeEmailWrapper.SendWelcomeEmail(PrizeMemberAuthUtils.GetMemberData(uMember.Id), uMember.LoginName, true);
                    Response.Redirect(String.Format("{0}?program={1}&location={2}&level={3}&experience={4}&Trial=1", PrizeConstants.URL_MEMBER_BUY_PLAN, sProgram, sLocation, "Beginner", "Semester 1"));
                    return;
                }
            }
            Response.Redirect("login.aspx");
        }
        catch (MembershipCreateUserException me)
        {
            lblMsg.Text = GetErrorMessage(me.StatusCode);
        }
        catch (HttpException httpe)
        {
            lblMsg.Text = httpe.Message;
        }
    }