private static CustomerActionCollection DBMapping(DBCustomerActionCollection dbCollection) { if (dbCollection == null) { return(null); } var collection = new CustomerActionCollection(); foreach (var dbItem in dbCollection) { var item = DBMapping(dbItem); collection.Add(item); } return(collection); }
protected void BindGrid() { CustomerActionCollection actions = ACLManager.GetAllCustomerActions(); if (actions.Count == 0) { lblMessage.Text = GetLocaleResourceString("Admin.ACL.NoActionDefined"); return; } CustomerRoleCollection roles = CustomerManager.GetAllCustomerRoles(); if (roles.Count == 0) { lblMessage.Text = GetLocaleResourceString("Admin.ACL.NoRolesDefined"); return; } List <CustomerActionACLMappingHelperClass> dt = new List <CustomerActionACLMappingHelperClass>(); foreach (CustomerAction ca in actions) { CustomerActionACLMappingHelperClass map1 = new CustomerActionACLMappingHelperClass(); map1.CustomerActionId = ca.CustomerActionId; map1.CustomerActionName = ca.Name; map1.Allow = new Dictionary <int, bool>(); foreach (CustomerRole cr in roles) { ACLCollection acls = ACLManager.GetAllAcl(ca.CustomerActionId, cr.CustomerRoleId, null); if (acls.Count > 0) { ACL acl = acls[0]; map1.Allow.Add(cr.CustomerRoleId, acl.Allow); } else { map1.Allow.Add(cr.CustomerRoleId, false); } } dt.Add(map1); } gvACL.DataSource = dt; gvACL.DataBind(); }