private void DeleteButton_Click(object sender, RoutedEventArgs e)
        {
            kinectdataEntities con = new kinectdataEntities();
            Alarm alarmdataRow     = Imported1.SelectedItem as Alarm;
            var   alarmD           = (from p in con.Alarms
                                      where p.Id == alarmdataRow.Id
                                      select p).Single();

            con.Alarms.Remove(alarmD);
            con.SaveChanges();
            System.Windows.MessageBox.Show("Record deleted successfully.");
            GetListData();
        }
示例#2
0
        private void DeleteButton_Click(object sender, RoutedEventArgs e)
        {
            kinectdataEntities con          = new kinectdataEntities();
            Eventdata          eventdataRow = Imported.SelectedItem as Eventdata;
            var events = (from p in con.Eventdatas
                          where p.Id == eventdataRow.Id
                          select p).Single();

            con.Eventdatas.Remove(events);
            con.SaveChanges();
            System.Windows.MessageBox.Show("Record deleted successfully.");
            GetListData();
        }
示例#3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            Eventdata eve = new Eventdata();

            eve.@event    = txtEvent.Text;
            eve.eventmsg  = txtDes.Text;
            eve.eventdate = Convert.ToDateTime(datePicker1.Text);
            eve.eventtime = Convert.ToDateTime(timipicker1.Text);
            //eve.eventdate =Convert.ToDateTime(Convert.ToDateTime(dtpDate.Text).ToShortDateString());
            //eve.eventtime = Convert.ToDateTime(Convert.ToDateTime(dtpTime.Text).ToShortDateString());
            //this._context.Events.Add(eve);
            //this._context.Events.AddObject(eve);
            //this._context.SaveChanges();

            context.Eventdatas.Add(eve);
            context.SaveChanges();
            System.Windows.MessageBox.Show("Record saved successfully.");
            GetListData();
        }
        private void Button_Click_1(object sender, RoutedEventArgs e)
        {
            Alarm alr = new Alarm();

            if (chckbox1.IsChecked == true)
            {
                alr.Repeat = true;
            }

            else
            {
                alr.Repeat = false;
            }
            alr.AlarmTime = Convert.ToDateTime(timipicker1.Text);

            context.Alarms.Add(alr);
            context.SaveChanges();
            System.Windows.MessageBox.Show("Record saved successfully.");
            GetListData();
        }
        private void Submit_Click(object sender, RoutedEventArgs e)
        {
            if (textBoxFirstName.Text.Length == 0)
            {
                errormessage1.Text = "Enter First Name.";
                textBoxFirstName.Focus();
            }
            else if (textBoxLastName.Text.Length == 0)
            {
                errormessage1.Text = "Enter Last Name.";
                textBoxLastName.Focus();
            }
            else if (textBoxEmail1.Text.Length == 0)
            {
                errormessage1.Text = "Enter an email.";
                textBoxEmail1.Focus();
            }
            else if (!Regex.IsMatch(textBoxEmail1.Text, @"^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$"))
            {
                errormessage1.Text = "Enter a valid email.";
                textBoxEmail1.Select(0, textBoxEmail1.Text.Length);
                textBoxEmail1.Focus();
            }
            else
            {
                string firstname = textBoxFirstName.Text;
                string lastname  = textBoxLastName.Text;
                string email     = textBoxEmail1.Text;
                string password  = passwordBox2.Password;
                if (passwordBox2.Password.Length == 0)
                {
                    errormessage1.Text = "Enter password.";
                    passwordBox2.Focus();
                }
                else if (passwordBoxConfirm.Password.Length == 0)
                {
                    errormessage1.Text = "Enter Confirm password.";
                    passwordBoxConfirm.Focus();
                }
                else if (passwordBox2.Password != passwordBoxConfirm.Password)
                {
                    errormessage1.Text = "Password doesn't match.";
                    passwordBoxConfirm.Focus();
                }
                else if (textBlockAddress.Text.Length == 0)
                {
                    errormessage1.Text = "Enter Address.";
                    textBlockAddress.Focus();
                }
                else
                {
                    UserLogIn usr = new UserLogIn();
                    usr.FirstName = textBoxFirstName.Text;
                    usr.LastName  = textBoxLastName.Text;
                    usr.Email     = textBoxEmail1.Text;
                    usr.Password  = passwordBox2.Password.ToString();
                    usr.Address   = textBoxAddress.Text;


                    context.UserLogIns.Add(usr);
                    context.SaveChanges();
                    System.Windows.MessageBox.Show("Record saved successfully.");
                }
            }
        }