Пример #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     using(var elm = new Commuticate.Repository.Entities())
     {
         var rrr = (from rg in elm.RouteGroups where rg.CommuterId == Program.UserId select rg);
         RouteGroupRepeater.DataSource = rrr;
         RouteGroupRepeater.DataBind();
     }
 }
    protected void CreateAccount_Click(object sender, EventArgs e)
    {
        using (var ent = new Commuticate.Repository.Entities())
        {
            var comm = new Commuticate.Repository.Commuter()
                           {Email = EmailTextBox.Text, FullName = FullNameTextBox.Text, Password = PasswordTextBox.Text};

            ent.AddToCommuters(comm);
            ent.SaveChanges();

            Program.UserId = comm.Id;
        }

        this.BindUserDetails();
    }
Пример #3
0
    protected void Login_Click(object sender, EventArgs e)
    {
        Program.UserId = 0;

        using (var ent = new Commuticate.Repository.Entities())
        {
            var comm = ent.Commuters.FirstOrDefault(
                c => c.Email.Equals(this.LoginUserName.Text, StringComparison.InvariantCultureIgnoreCase)
                     && c.Password.Equals(this.LoginPassword.Text, StringComparison.Ordinal));

            if (comm != null)
            {
                Program.UserId = comm.Id;
                Response.Redirect("~/");
            }
        }

        this.StatusMessageLiteral.Text = "Incorrect Login";
    }
Пример #4
0
        public void Snooze(Commuticate.Repository.QueSchedule queSchudle, TimeSpan delay)
        {
            using (var rep = new Entities())
            {
                var snoozeQue = new QueSchedule()
                                    {
                                        AtTime = DateTime.Now.Add(delay).TimeOfDay,
                                        Que = queSchudle.Que,
                                        OnDays = queSchudle.OnDays,
                                        NotifyEmail = queSchudle.NotifyEmail,
                                        NotifySMS = queSchudle.NotifySMS,
                                        NotifyTwitter = queSchudle.NotifyTwitter,
                                        RunOnce = true
                                    };

                rep.AddToQueSchedules(snoozeQue);
                rep.SaveChanges();
            }
        }
    private void BindUserDetails()
    {
        if (Program.UserLoggedIn)
        {
            using (var ent = new Commuticate.Repository.Entities())
            {
                var comm = ent.Commuters.FirstOrDefault(i => i.Id == Program.UserId);

                if (comm != null)
                {
                    this.FullNameTextBox.Text = this.UserFullnameHeader.Text = comm.FullName;
                    this.EmailTextBox.Text = this.UserEmailLiteral.Text = comm.Email;
                    this.PasswordTextBox.Text = comm.Password;

                    var pData = comm.CommuterDatas.FirstOrDefault(r => r.DataType == "Phone");
                    if (pData != null)
                        this.UserPhoneLiteral.Text = pData.DataValue;
                }
            }
        }
    }