public static void CreateArrest(Arrest _arrest) { _arrest.ArrestId = currentArrests.Item1.Count > 0 ? currentArrests.Item1.LastOrDefault().ArrestId + 1 : 1; currentArrests.Item1.Add(_arrest); currentArrests.Item2.Add(API.shared.createMarker(30, _arrest.Position, new Vector3(0, 0, 0), _arrest.Rotation, new Vector3(1, 1, 1), 200, 10, 20, 255, _arrest.Dimension)); currentArrests.Item3.Add(API.shared.createTextLabel(_arrest.Name, _arrest.Position + new Vector3(0, 0, 0.5), 15, 1, false, _arrest.Dimension)); SaveChanges(); }
public void UpdateData(Arrest arrest) { Device.BeginInvokeOnMainThread(() => { // This includes the defendant's age. _report = arrest; var today = DateTime.Today; if (_report.DateOfBirth != null && _report.DateOfBirth.Length > 5) { DateTime birthdate; DateTime.TryParse(_report.DateOfBirth, out birthdate); if (birthdate > DateTime.Parse("1/1/1900")) { var age = today.Year - birthdate.Year; if (birthdate > today.AddYears(-age)) { age--; } textDefendantName.Text = string.Format("{0}, {1}", _report.Defendant, age); } else { textDefendantName.Text = string.Format("{0}", _report.Defendant); } } else { textDefendantName.Text = string.Format("{0}", _report.Defendant); } // See if this is a valid arrest date if (_report.DateArrested != null) { if (_report.DateArrested.GetValueOrDefault().Year > 2000) { textArrestDate.Text = string.Format("{0}", _report.DateArrested.GetValueOrDefault().ToString("dddd, MMM d yyyy")); } } // See if bail is set if (_report.Bail != null && _report.Bail.Length > 2) { textBail.Text = string.Format("Bail Amount: {0}", _report.Bail); } textOffenseTitle.Text = string.Format("{0}", _report.PrimaryCharge); textArrestingOfficer.Text = string.Format("{0}", _report.ArrestingOfficer); textSuspectLivesIn.Text = string.Format("{0}", _report.DefendantZip); _url = string.Format("https://docs.google.com/viewer?url={0}", _report.Url); this.IsVisible = true; }); }
/// <summary> /// 记录属性修改 /// </summary> /// <param name="propertyName">属性</param> protected virtual void RecordModifiedInner(string propertyName) { if (!this.ModifiedProperties.Contains(propertyName)) { this.ModifiedProperties.Add(propertyName); } if (!Arrest.HasFlag(EditArrestMode.InnerLogical)) { this.EditObject.OnModified(propertyName); } }
/// <summary> /// 记录属性修改 /// </summary> /// <param name="propertyName">属性</param> internal protected void RecordModified(string propertyName) { if (!Arrest.HasFlag(EditArrestMode.RecordChanged)) { RecordModifiedInner(propertyName); } if (!Arrest.HasFlag(EditArrestMode.InnerLogical)) { this.EditObject.OnModified(propertyName); } }
/// <summary> /// 记录属性修改 /// </summary> /// <param name="propertyIndex">属性</param> private void RecordModifiedInner(int propertyIndex) { //Trace.WriteLine(string.Format("{1} => Modified:{0}", EditObject.__Struct.Properties[propertyIndex].PropertyName, EditObject.GetValue(EditObject.__Struct.PrimaryKey)), // EditObject.GetType().Name); SetModified(propertyIndex); if (!Arrest.HasFlag(EditArrestMode.InnerLogical)) { EditObject.OnModified(propertyIndex); } }
/// <summary> /// 记录属性修改 /// </summary> /// <param name="propertyIndex">属性</param> internal void RecordModified(int propertyIndex) { if (!Arrest.HasFlag(EditArrestMode.RecordChanged)) { RecordModifiedInner(propertyIndex); } if (!Arrest.HasFlag(EditArrestMode.InnerLogical)) { EditObject.OnModified(propertyIndex); } }
public void TestArrestIsValid00() { var testSubject = new Arrest { IsAwareOfBeingArrested = lp => true, ProbableCause = new ExampleExigentCircumstances(), IsOccurInPublicPlace = lp => true }; var testResult = testSubject.IsValid(new ExampleSuspect(), new ExampleLawEnforcement()); Console.WriteLine(testSubject.ToString()); Assert.IsTrue(testResult); }
public void TestArrestIsValid01() { var testSubject = new Arrest { IsAwareOfBeingArrested = lp => true, ProbableCause = new ExampleProbableCause(), IsOccurInPublicPlace = lp => false, Warrant = new ArrestWarrant { GetObjectiveOfSearch = () => new ExampleSuspect(), IsObjectiveDescribedWithParticularity = lp => lp is ExampleSuspect, IsIssuerNeutralAndDetached = lp => lp is ExampleJudge, IsIssuerCapableDetermineProbableCause = lp => lp is ExampleJudge, GetIssuerOfWarrant = lps => lps.FirstOrDefault(lp => lp is IJudge) } }; var testResult = testSubject.IsValid(new ExampleSuspect(), new ExampleLawEnforcement(), new ExampleJudge()); Console.WriteLine(testSubject.ToString()); Assert.IsTrue(testResult); }
public bool CreateArrest(ArrestCreate model) { var localDateTime = DateTime.Now.ToString("MM/dd/yyyy", System.Globalization.CultureInfo.InvariantCulture); var entity = new Arrest() { ArrestDate = DateTime.Parse(localDateTime), StreetName = model.StreetName, ArrestCity = model.ArrestCity, ArrestCounty = model.ArrestCounty, ArrestState = model.ArrestState, ArrestZipcode = model.ArrestZipcode, ArrestDesc = model.ArrestDesc, DefendantID = model.DefendantID, OfficerID = model.OfficerID }; using (var arr = new ApplicationDbContext()) { arr.Arrests.Add(entity); return(arr.SaveChanges() == 1); } }
public static bool UpdateArrest(Arrest _arrest) { var _Index = FindIndexById(_arrest.ArrestId); if (_Index >= 0) { try { currentArrests.Item1[_Index] = _arrest; currentArrests.Item2[_Index].position = _arrest.Position; currentArrests.Item2[_Index].rotation = _arrest.Rotation; currentArrests.Item2[_Index].dimension = _arrest.Dimension; currentArrests.Item3[_Index].text = _arrest.Name; SaveChanges(); return(true); } catch (Exception) { return(false); } } return(false); }