private void OnEntityPicked(EventMessage e) { var pickedEntity = e.GetValue <object>(Messenger.EntityKey); if (EntityMapper.EntityOf(pickedEntity) == Entity.Service) { Service = (Service)pickedEntity; } }
private void OnEntityPicked(EventMessage e) { var pickedEntity = e.GetValue <object>(Messenger.EntityKey); if (EntityMapper.EntityOf(pickedEntity) == Entity.Registration) { Registration = (Registration)pickedEntity; } }
public PageParams(string uri, object entity, bool showChilds, bool editMode, object extra = null) { PageUri = uri; Entity = entity; ShowChilds = showChilds; EditMode = editMode; ExtraData = extra; Type = EntityMapper.EntityOf(entity); }
public override DataTemplate SelectTemplate(object item, DependencyObject container) { if (item == null) { return(NullEntityTemplate); } switch (EntityMapper.EntityOf(item)) { case Entity.Settlement: return(SettlementTemplate); case Entity.Street: return(StreetTemplate); case Entity.House: return(HouseTemplate); case Entity.Flat: return(FlatTemplate); case Entity.StreetType: return(StreetTypeTemplate); case Entity.FlatType: return(FlatTypeTemplate); case Entity.Meter: return(MeterTemplate); case Entity.MeterType: return(MeterTypeTemplate); case Entity.Reading: return(ReadingTemplate); case Entity.Payment: return(PaymentTemplate); case Entity.Rate: return(RateTemplate); case Entity.Benefit: return(BenefitTemplate); case Entity.Service: return(ServiceTemplate); case Entity.ServiceType: return(ServiceTypeTemplate); case Entity.Unit: return(UnitTemplate); case Entity.Registration: return(RegistrationTemplate); case Entity.Payer: return(PayerTemplate); case Entity.User: return(UserTemplate); case Entity.UserGroup: return(UserGroupTemplate); } throw new ArgumentOutOfRangeException("item"); }
/// <summary> /// Смена представления /// </summary> /// <param name="entity"></param> private void JumpTo(object entity) { if (EntityMapper.EntityOf(entity) != Entity.Empty) { ec.Current.Set(entity); var eventParams = new KeyValuePair <string, object>[] { new KeyValuePair <string, object>(Messenger.EntityKey, entity), new KeyValuePair <string, object>(Messenger.ShowChildsKey, true), new KeyValuePair <string, object>(Messenger.EditModeKey, false) }; this.Send((int)EventId.JumpingToEntity, eventParams); } else { } }
private bool ProtectAdmin(object entity) { return(EntityMapper.EntityOf(entity) == Entity.User && UserController.Instance.IsAdmin((User)entity)); }