/// <summary> /// Get group access, operator level, Group user from DB and add in combobox /// </summary> private void GetComboBoxData() { try { List <GroupAccess> groupAccesses = GroupAccess.GetAllAccessGroup(); cboAccess.Properties.DataSource = groupAccesses; cboAccess.Properties.DisplayMember = "groupName"; cboAccess.Properties.ValueMember = "groupId"; List <OperatorLevel> operatorLevels = OperatorLevel.GetAllOptLevel(); cboOptLevel.Properties.DataSource = operatorLevels; cboOptLevel.Properties.DisplayMember = "OptName"; cboOptLevel.Properties.ValueMember = "OptId"; List <GroupUser> groupUsers = GroupUser.LoadAllUserGroup(); cboGroup.Properties.DataSource = groupUsers; cboGroup.Properties.DisplayMember = "groupName"; cboGroup.Properties.ValueMember = "groupId"; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public static OperatorLevel GetOptLevelByUser(string userId) { OperatorLevel operatorLevel = null; DataTable dt = null; try { ServiceReference1.WSACUSoapClient client = new ServiceReference1.WSACUSoapClient(); DataSet ds = client.OperatorQuery("U", "", "", userId); dt = ds.Tables[0]; foreach (DataRow dr in dt.Rows) { string Id = dr["optLevelid"].ToString(); string Name = dr["optLevelName"].ToString(); operatorLevel = new OperatorLevel(Id, Name); } return(operatorLevel); } catch (Exception ex) { return(operatorLevel); } }