Esempio n. 1
0
 private void change_number_button_Click(object sender, EventArgs e)
 {
     if (new_number_box.Text != "")
     {
         spacelocklinqDataContext data = new spacelocklinqDataContext();
         var match = (from d in data.GetTable<setting>()
                      where d.user == "admin"
                      select d).SingleOrDefault();
         match.Phone_Number = new_number_box.Text;
         match.Phone_Number.TrimEnd();
         data.SubmitChanges();
         displaynum();
     }
 }
Esempio n. 2
0
        private void change_password_button_Click(object sender, EventArgs e)
        {
            string password="";
            spacelocklinqDataContext data = new spacelocklinqDataContext();
            var query = from c in data.settings
                        where c.user == "admin"
                        select (c.Password);

            foreach (var item in query)
            {
                password = item.TrimEnd();
            }
            if (old_password_box.Text == password)
            {
                if (new_password_box.Text == confirm_new_password.Text && new_password_box.Text!="" && confirm_new_password.Text!="")
                {
                    spacelocklinqDataContext dat = new spacelocklinqDataContext();
                    var match = (from d in dat.GetTable<setting>()
                                 where d.user == "admin"
                                 select d).SingleOrDefault();
                    match.Password = confirm_new_password.Text;
                    match.Password.TrimEnd();
                    dat.SubmitChanges();
                    MessageBox.Show("Password Change Successful!");
                }
                else
                {
                    MessageBox.Show("Either the old password is wrong or the two passwords dont match");
                }
            }
            else
            {
                MessageBox.Show("Either the old password is wrong or the two passwords dont match");
            }
        }
Esempio n. 3
0
 private void test_phone_connection_button_Click(object sender, EventArgs e)
 {
     spacelocklinqDataContext dat = new spacelocklinqDataContext();
     var match = (from d in dat.GetTable<setting>()
                  where d.user == "admin"
                  select d).SingleOrDefault();
     try
     {
         match.Port_Number = int.Parse(com_port_box.Text.TrimEnd());
     }
     catch (Exception)
     {
         match.Port_Number = 10;
     }
     dat.SubmitChanges();
     GsmCommMain comm = new GsmCommMain(match.Port_Number, 19200, 300);
     try
     {
         comm.Open();
         comm.Close();
         MessageBox.Show("Phone Connection Successful");
     }
     catch (Exception)
     {
         MessageBox.Show("Phone Connection Unsuccessful");
     }
 }