private void add_MissingRecords() { if (security_rolesecurity_curdViewSource.View != null) { security_role security_role = (security_role)security_roleDataGrid.SelectedItem; List <security_curd> security_curd = dbContext.security_curd.Where(x => x.id_role == security_role.id_role).ToList(); List <entity.App.Names> _DbApplication = security_curd.Select(x => x.id_application).ToList(); List <entity.App.Names> Application = Enum.GetValues(typeof(entity.App.Names)).Cast <entity.App.Names>().ToList(); List <entity.App.Names> finalapplicaiton = Enumerable.Except <entity.App.Names>(Application, (IEnumerable <entity.App.Names>)_DbApplication).ToList(); foreach (entity.App.Names AppName in finalapplicaiton) { security_curd _security_curd = new security_curd(); _security_curd.id_application = AppName; _security_curd.can_update = false; _security_curd.can_read = false; _security_curd.can_delete = false; _security_curd.can_create = false; _security_curd.can_approve = false; _security_curd.can_annul = false; security_role.security_curd.Add(_security_curd); } security_rolesecurity_curdViewSource.View.Refresh(); security_rolesecurity_role_privilageViewSource.View.Refresh(); } }
private void TextBox_TextChanged(object sender, TextChangedEventArgs e) { security_role security_role = security_roleViewSource.View.CurrentItem as security_role; if (security_role != null) { if (security_rolesecurity_curdViewSource != null) { if (security_rolesecurity_curdViewSource.View != null) { security_rolesecurity_curdViewSource.View.Filter = i => { security_curd security_curd = (security_curd)i; string TranslatedName = entity.Brillo.Localize.StringText(security_curd.id_application.ToString()); if (TranslatedName.ToUpper().Contains(txtsearch.Text.ToUpper())) { return(true); } else { return(false); } }; } } } }
public Security(App.Names AppName) { view = true; create = true; edit = true; delete = true; approve = true; annul = true; if (CurrentSession.UserRole == null) { db db = new entity.db(); security_role security_role = new security_role(); security_role.name = "Master"; security_role.is_active = true; security_role.is_master = true; db.security_role.Add(security_role); db.SaveChanges(); CurrentSession.UserRole = security_role; } if (CurrentSession.UserRole.is_master == false) { if (CurrentSession.Security_CurdList.Where(x => x.id_application == AppName).FirstOrDefault() != null) { security_curd security_curd = CurrentSession.Security_CurdList.Where(x => x.id_application == AppName).FirstOrDefault(); view = security_curd.can_read; create = security_curd.can_create; edit = security_curd.can_update; delete = security_curd.can_delete; approve = security_curd.can_approve; annul = security_curd.can_annul; } } }