/// <summary> /// Get all the roles the database. /// </summary> /// <returns>List of Rles</returns> public List <RBACD.DatalayerDef.sResource> GetAllResources() { List <RBACD.DatalayerDef.sResource> sResourceList = new List <RBACD.DatalayerDef.sResource>(); DataSet ds = new DataSet(); string sql = string.Empty; try { sql = "Select SecurityRightID,SecurityRight,SecurityDescrition,FormName from securityright order by formname,securityright"; OdbcConnection con = (OdbcConnection)this.DbConnection; OdbcDataAdapter adp = new OdbcDataAdapter(sql, con); adp.Fill(ds); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { RBACD.DatalayerDef.sResource sresource = new RBACD.DatalayerDef.sResource(); sresource.ResourceId = ds.Tables[0].Rows[i][0].ToString(); sresource.ResourceName = ds.Tables[0].Rows[i][1].ToString(); sresource.ResourceDescrition = ds.Tables[0].Rows[i][2].ToString(); sresource.ResourceParentName = ds.Tables[0].Rows[i][3].ToString(); sResourceList.Add(sresource); } return(sResourceList); } catch { return(sResourceList); } }
/// <summary> /// Load all the controls used in an assembly. This will load only RBAC controls /// </summary> /// <param name="pFormName"></param> private void LoadAllControlsIntoList() { if (rcsList != null) { rcsList.Clear(); } foreach (Form f in results) { foreach (Control c in f.Controls) //Loop through all the controls { Type t = c.GetType(); PropertyInfo[] properties = t.GetProperties(); //Get all the properties associated with the RBAC controls foreach (PropertyInfo property in properties) { if (property.Name == "GroupUniqueID") { RBACD.DatalayerDef.sResource rcs = new RBACD.DatalayerDef.sResource(); rcs.ResourceId = property.GetValue(c, null).ToString(); rcs.ResourceName = c.Name; rcs.ResourceDescrition = t.Name; rcs.ResourceParentName = f.Name; rcsList.Add(rcs); //Load all resources into a list for database saving } } } } }
private void LoadControlResourceIntoDataLayer(Control c, Form f) { Type t = c.GetType(); PropertyInfo[] properties = t.GetProperties(); //Get all the properties associated with the RBAC controls foreach (PropertyInfo property in properties) { if (property.Name == "GroupUniqueID") { RBACD.DatalayerDef.sResource rcs = new RBACD.DatalayerDef.sResource(); rcs.ResourceId = property.GetValue(c, null).ToString(); rcs.ResourceName = c.Name; rcs.ResourceDescrition = t.Name; rcs.ResourceParentName = f.Name; rcsList.Add(rcs); //Load all resources into a list for database saving } } }
/// <summary> /// Load all the controls used in an assembly. This will load only RBAC controls /// </summary> /// <param name="pFormName"></param> private void LoadAllControlsIntoList() { if (rcsList != null) { rcsList.Clear(); } foreach (Form f in results) { foreach (Control c in f.Controls) //Loop through all the controls { Type t = c.GetType(); PropertyInfo[] properties = t.GetProperties(); //Get all the properties associated with the RBAC controls foreach (PropertyInfo property in properties) { if (property.Name == "GroupUniqueID") { RBACD.DatalayerDef.sResource rcs = new RBACD.DatalayerDef.sResource(); rcs.ResourceId = property.GetValue(c, null).ToString(); rcs.ResourceName = c.Name; rcs.ResourceDescrition = t.Name; rcs.ResourceParentName = f.Name; rcsList.Add(rcs); //Load all resources into a list for database saving } } } } }
/// <summary> /// Get all the roles the database. /// </summary> /// <returns>List of Rles</returns> public List<RBACD.DatalayerDef.sResource> GetAllResources() { List<RBACD.DatalayerDef.sResource> sResourceList = new List<RBACD.DatalayerDef.sResource>(); DataSet ds = new DataSet(); string sql = string.Empty; try { sql = "Select SecurityRightID,SecurityRight,SecurityDescrition,FormName from securityright order by formname,securityright"; OdbcConnection con = (OdbcConnection)this.DbConnection; OdbcDataAdapter adp = new OdbcDataAdapter(sql, con); adp.Fill(ds); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { RBACD.DatalayerDef.sResource sresource = new RBACD.DatalayerDef.sResource(); sresource.ResourceId = ds.Tables[0].Rows[i][0].ToString(); sresource.ResourceName = ds.Tables[0].Rows[i][1].ToString(); sresource.ResourceDescrition = ds.Tables[0].Rows[i][2].ToString(); sresource.ResourceParentName = ds.Tables[0].Rows[i][3].ToString(); sResourceList.Add(sresource); } return sResourceList; } catch { return sResourceList; } }
private void LoadControlResourceIntoDataLayer(Control c, Form f) { Type t = c.GetType(); PropertyInfo[] properties = t.GetProperties(); //Get all the properties associated with the RBAC controls foreach (PropertyInfo property in properties) { if (property.Name == "GroupUniqueID") { RBACD.DatalayerDef.sResource rcs = new RBACD.DatalayerDef.sResource(); rcs.ResourceId = property.GetValue(c, null).ToString(); rcs.ResourceName = c.Name; rcs.ResourceDescrition = t.Name; rcs.ResourceParentName = f.Name; rcsList.Add(rcs); //Load all resources into a list for database saving } } }