public List <SelectUserModel> GetSelectUsersByTicketId(int tid) { StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT TU.UserID , U.RoleID, U.FirstName, U.LastName "); strSql.Append("FROM dbo.TicketUsers AS TU LEFT JOIN dbo.Users AS U ON TU.UserID = U.UserID "); strSql.Append("WHERE TU.TicketID = @TicketID "); Database db = DatabaseFactory.CreateDatabase(); List <SelectUserModel> list = new List <SelectUserModel>(); using (DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString())) { db.AddInParameter(dbCommand, "TicketID", DbType.Int32, tid); using (IDataReader dr = db.ExecuteReader(dbCommand)) { while (dr.Read()) { SelectUserModel model = new SelectUserModel { UserID = int.Parse(dr["UserID"].ToString()), Role = (RolesEnum)dr["RoleID"], FirstName = dr["FirstName"].ToString(), LastName = dr["LastName"].ToString() }; list.Add(model); } } } return(list); }
protected void groupsControl_OnAddUser(object sender, GenericEventArgs <Guid> e) { var allGroups = UmGroupsUtil.GetAllProjectsGroupsUsers(HbSession); var item = allGroups.FirstOrDefault(n => n.ID == e.Value); if (item == null) { return; } var model = new SelectUserModel { ParentID = item.ID }; selectUserControl.Model = model; mpeUsers.Show(); }