public override void OnRegister() { base.OnRegister(); if (InstanceMap != null && !InstanceMap.Deleted) { InstanceMap.AddRegion(this, false); } AllRegions.AddOrReplace(this); }
private void OnRegionsLoaded(DataLoaded <Region> e) { foreach (var region in e.Data) { var viewmodel = new RegionViewModel(region); AllRegions.Add(viewmodel); //viewmodel.Exists(); viewmodel.AddToUI(Overlay); } }
public override void OnUnregister() { base.OnUnregister(); if (InstanceMap != null) { InstanceMap.RemoveRegion(this, false); } AllRegions.Remove(this); AllRegions.Free(false); }
protected override ValidationResult IsValid(object value, ValidationContext validationContext) { var s = value as string; if (string.IsNullOrEmpty(s)) { return(new ValidationResult("Region is required")); } return(AllRegions.Contains(s, StringComparer.OrdinalIgnoreCase) ? ValidationResult.Success : new ValidationResult("Invalid Region")); }
private void CommitRegion() { if (EditingRegion != null) { lock (AllRegions) { AllRegions.Add(EditingRegion); } EditingRegion.Commit(); System.Diagnostics.Debug.WriteLine(JsonConvert.SerializeObject(EditingRegion)); EditingRegion = null; } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { RegionController sysmgr = new RegionController(); List <Region> info = sysmgr.ListAllRegions(); AllRegions.DataSource = info; AllRegions.DataBind(); RegionsDDL.DataSource = info; RegionsDDL.DataValueField = "RegionID"; RegionsDDL.DataTextField = "RegionDescription"; RegionsDDL.DataBind(); } }
public static void AddRegion(Region r) { AllRegions.Add(r); AppDb.Regions.Add(r); AppDb.SaveChanges(); }
public RegionViewModel GetRegion(string name) { name = name.ToLower(); return(AllRegions.FirstOrDefault(each => each.Name.ToLower() == name)); }