partial void DeleteAttempt(Attempt instance);
 partial void UpdateAttempt(Attempt instance);
 partial void InsertAttempt(Attempt instance);
		private void detach_Attempts(Attempt entity)
		{
			this.SendPropertyChanging();
			entity.User = null;
		}
		private void attach_Attempts(Attempt entity)
		{
			this.SendPropertyChanging();
			entity.User = this;
		}
Exemplo n.º 6
0
        private void OK_Click(object sender, RoutedEventArgs e)
        {
            IDictionary<string, string> y = this.NavigationContext.QueryString;
                String b = Convert.ToString(y["TextData1"]);
                 textBox2.Text = b.ToString();
                 MessageBox.Show("b" + textBox2.Text);
                 String timeonoff = b.ToString();
                 long tmonoff;
                 long.TryParse(timeonoff, out tmonoff);
              bool tmd;
              if (tmonoff == 0)
              {
                  tmd = false;

              }
              else
              {
                  tmd = true;
              }
              string s = textBox1.Text;
              long l;
              long.TryParse(s, out l);
              var timest = from Test t in catAppDB.Tests
                           where t._id == l
                           select t;
              Tests = new ObservableCollection<Test>(timest);
              var time = Tests.ToList();
              var t2 = time[0] as Test;

              var tt = t2.Allowed_time;
              txtAllowed.Text = tt.ToString();

              // txtAllowed.Text = Tests.ToString();

              // MessageBox.Show("Allowed Time" + txtAllowed.Text);
              //var tt = Tests.ToList();
              // int ts = tt[0].Allowed_time;
              //  txtAllowed.Text = Tests.ToString();
              string tmpstp = txtAllowed.Text;
              int l1;
              long uid = 0;
              int.TryParse(tmpstp, out l1);
              ll = l1;

              IList<User> UserList = this.GetUserList();
              foreach (User usr1 in UserList)
              {
                  uid = usr1._id;
              }

              using (catAppDB = new CatAppDataClasses(DBConnectionString))
              {
                  Attempt newAttempt = new Attempt
                 {
                     T_id = l,
                     Timpstamp = l1,
                     Elapsed_time = l1 - ltotal,
                     U_id = uid,

                     //T_id = 13,
                     //Timpstamp = 2100,

                     Complete = completed,
                     //Elapsed_time = 200,
                     Timed = tmd

                 };

                  catAppDB.Attempts.InsertOnSubmit(newAttempt);

                  catAppDB.SubmitChanges();

                  //DialogClosed("OK");
              }
        }