private void BindGrid()
    {
        string    email   = SearchEmail.Value.Trim();
        bool      isAdmin = SearchAdmin.Checked;
        DataTable dt      = oUserBLL.searchUser(email, isAdmin);

        UserList.DataSource = dt;
        UserList.DataBind();
    }
Exemplo n.º 2
0
        protected void UserList_ItemCanceling(object sender, ListViewCancelEventArgs e)//отмена редактирования
        {
            UserList.EditIndex = -1;

            UserList.DataSource = usServ.ReadAll()
                                  .Select(c => new { c.Id, c.Name, c.RoleId, c.IsDeleted })
                                  .ToList();
            UserList.DataBind();
        }
        private void BindGrid()
        {
            UserList.DataSource = cEmpleado.obtenerEmpleados(objConexion).Tables[0].DefaultView;
            UserList.DataBind();
            cEmpleado.closeConexion();

            ClienteList.DataSource = cCliente.obtenerClientes(objConexion).Tables[0].DefaultView;
            ClienteList.DataBind();
            cCliente.closeConexion();
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            userBusiness = IOCContainer.Resolve <IUserBusiness>();

            if (!Page.IsPostBack)
            {
                UserList.DataSource = userBusiness.Get();
                UserList.DataBind();
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Handles the Click event of the SearchUsers control to databind the user list with search result.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void SearchUsers_Click(object sender, EventArgs e)
        {
            // Make sure to clear any membership modifications before showing the new search result.
            _modifiedMembers.Clear();
            UserList.PageIndex = 0;
            UserList.DataBind();

            //Hide 'Save' button if there is empty result.
            SaveMembership.Visible = IsEditable;
            SendNotificationsConfirmation.Visible = SaveMembership.Visible;
        }
Exemplo n.º 6
0
        protected void UserList_ItemEditing(object sender, ListViewEditEventArgs e) //переход в режи редактирования
        {
            UserList.EditIndex = e.NewEditIndex;                                    //индекс редактируемой

            RoleIdDbUpdate();

            UserList.DataSource = usServ.ReadAll()
                                  .Select(c => new { c.Id, c.Name, c.RoleId, c.IsDeleted })
                                  .ToList();
            UserList.DataBind();
        }
Exemplo n.º 7
0
        protected void UserList_ItemDeleting(object sender, ListViewDeleteEventArgs e)//CommandName имя команды для уволнения
        {
            var id = (int)e.Keys["Id"];

            usServ.Delete(id);

            UserList.DataSource = usServ.ReadAll()
                                  .Select(c => new { c.Id, c.Name, c.RoleId, c.IsDeleted })
                                  .ToList();
            UserList.DataBind(); //чтобы закинуть в таблицу
        }
        private void BindUsersToUserList()
        {
            // Get all of the user accounts
            MembershipUserCollection users = Membership.GetAllUsers();

            UserList.DataSource = users;
            UserList.DataBind();

            // Check the selected user's roles
            CheckRolesForSelectedUser();
        }
Exemplo n.º 9
0
        protected void CSOM_Click(object sender, EventArgs e)
        {
            string commandAccessToken = ((LinkButton)sender).CommandArgument;

            RetrieveWithCSOM(commandAccessToken);
            WebTitleLabel.Text    = siteName;
            CurrentUserLabel.Text = currentUser;
            UserList.DataSource   = listOfUsers;
            UserList.DataBind();
            ListList.DataSource = listOfLists;
            ListList.DataBind();
        }
Exemplo n.º 10
0
 private void BindData()
 {
     try
     {
         UserList.DataSource = LearningManagementSystem.Components.User.GetUserList();
         UserList.DataBind();
     }
     catch (Exception ex)
     {
         Omnificence.Trace.Logger.Log(ex.Message.ToString());
     }
 }
Exemplo n.º 11
0
        protected void UserList_EditCommand(object source, DataListCommandEventArgs e)
        {
            this.Timer1.Enabled         = false;
            this.UserList.EditItemIndex = e.Item.ItemIndex;
            string    ID      = this.UserList.DataKeys[e.Item.ItemIndex].ToString();
            string    mySql   = "select UserName,Password,PhoneNumber from UserInfo where PhoneNumber='" + ID + "'";
            DataSet   MySet   = DataBase.RunDataSet(mySql);
            DataTable MyTable = MySet.Tables[0];

            UserList.DataSource = MyTable;
            UserList.DataBind();
        }
Exemplo n.º 12
0
    private void RefreshUserList()
    {
        UserList.Items.Clear();
        SnitzRoleProvider srp = new SnitzRoleProvider();

        srp.GetUsersInRole(txtName.Text);
        UserList.DataSource = srp.GetUsersInRole(txtName.Text);
        UserList.DataBind();

        UsersInRole.Text    = String.Format("{0} User(s) in {1} Role", UserList.Items.Count, txtName.Text);
        NewUserForRole.Text = "";
    }
Exemplo n.º 13
0
        protected void SaveBtn_Click(object sender, EventArgs e)
        {
            var NameTxt = UserList.FindControlRecursive <TextBox>("NameTxt"); // имя которое введем
            var NewUser = new User();

            NewUser.Name = NameTxt.Text;
            var RoleIdDdl = UserList.FindControlRecursive <DropDownList>("RoleIdDdl");

            Enum.TryParse <RoleEnum>(RoleIdDdl.SelectedValue, out var role);
            NewUser.RoleId = role;
            usServ.Create(NewUser);
            UserList.DataSource = usServ.ReadAll()
                                  .Select(c => new { c.Id, c.Name, c.RoleId, c.IsDeleted })
                                  .ToList();
            UserList.DataBind();
        }
        void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if ((Page.User.IsInRole("ProjectAdministrator") || Page.User.IsInRole("ProjectManager")))
                {
                    UserList.DataSourceID = "ProjectMembers";

                    if (Page.User.IsInRole("ProjectAdministrator"))
                    {
                        ProjectData.SortParameterName = "sortParameter";
                        ProjectData.SelectMethod      = "GetAllProjects";
                    }
                    else if (Page.User.IsInRole("ProjectManager"))
                    {
                        ProjectData.SelectParameters.Add(new Parameter("userName", TypeCode.String, Page.User.Identity.Name));
                        ProjectData.SortParameterName = "sortParameter";
                        ProjectData.SelectMethod      = "GetProjectsByManagerUserName";
                    }
                }
                else
                {
                    ProjectData.SelectParameters.Add(new Parameter("userName", TypeCode.String, Page.User.Identity.Name));
                    ProjectData.SelectMethod = "GetProjectsByUserName";

                    UserList.Items.Add(Page.User.Identity.Name);
                }
                ProjectList.DataBind();
                UserList.DataBind();
                ProjectListGridView.DataBind();

                if (ProjectList.Items.Count >= 1)
                {
                    TimeEntryView.Visible = true;
                    MessageView.Visible   = false;
                }
                else
                {
                    TimeEntryView.Visible = false;
                    MessageView.Visible   = true;
                }
            }
            if (UserList.Items.Count == 0)
            {
                AddEntry.Enabled = false;
            }
        }
Exemplo n.º 15
0
    public void Page_Init()
    {
        UserRoles.DataSource = Roles.GetAllRoles();
        UserRoles.DataBind();

        UserList.DataSource = Membership.GetAllUsers();
        UserList.DataBind();

        if (IsPostBack)
        {
            selectedFolderName = "";
        }
        else
        {
            selectedFolderName = Request.QueryString["selectedFolderName"];
        }
    }
Exemplo n.º 16
0
        protected void UserList_ItemUpdating(object sender, ListViewUpdateEventArgs e) //сохранение после редактирования
        {
            var id       = int.Parse(((Label)UserList.Items[e.ItemIndex].FindControl("IDLbl")).Text);
            var name     = ((TextBox)UserList.Items[e.ItemIndex].FindControl("EditNameTxt")).Text;
            var roleList = ((DropDownList)UserList.Items[e.ItemIndex].FindControl("RoleIdDdl"));
            var user     = usServ.Read(id);

            user.Name = name;
            Enum.TryParse <RoleEnum>(roleList.SelectedValue, out var role);
            user.RoleId = role;


            usServ.Update(user);
            UserList.EditIndex  = -1;
            UserList.DataSource = usServ.ReadAll()
                                  .Select(c => new { c.Id, c.Name, c.RoleId, c.IsDeleted })
                                  .ToList();
            UserList.DataBind();
        }
Exemplo n.º 17
0
    private void BindUserData()
    {
        ///定义获取数据的类
        User          user = new User();
        SqlDataReader recu = user.GetUsers();

        ///设定控件的数据源
        UserList.DataSource = recu;

        ///设定控件的Text属性和Value属性
        UserList.DataTextField  = "UserName";
        UserList.DataValueField = "UserID";

        ///绑定控件的数据
        UserList.DataBind();

        ///关闭数据读取器和数据库的连接
        recu.Close();
    }
Exemplo n.º 18
0
 private void BindUserList()
 {
     using (SysUserBusiness user = new SysUserBusiness()) {
         if (IsAdmin)
         {
             UserList.DataSource = user.GetSysUsers();
             List <SysUserViewEntity> SysUsers    = user.GetSysUsers();
             List <RoleMemberEntity>  RoleMembers = m_Role.GetRoleMembers(RoleNo);
             SysUserViewEntity        SysUser;
             foreach (RoleMemberEntity RoleMember in RoleMembers)
             {
                 SysUser = SysUsers.Where(p => p.UserNo == RoleMember.UserNo).ToList().FirstOrDefault();
                 SysUsers.Remove(SysUser);
             }
             UserList.DataSource = SysUsers;
         }
         UserList.DataBind();
     }
 }
Exemplo n.º 19
0
        protected void btnUsers_Click(object sender, EventArgs e)
        {
            var SPContext = SharePointContextProvider.Current.GetSharePointContext(Context);

            using (var clientContext = SPContext.CreateUserClientContextForSPHost())
            {
                clientContext.Load(clientContext.Web.CurrentUser);
                clientContext.ExecuteQuery();

                UserCollection users = clientContext.Web.SiteUsers;
                clientContext.Load <UserCollection>(users);
                clientContext.ExecuteQuery();

                foreach (User siteUser in users)
                {
                    listOfUsers.Add(siteUser.Title);
                }
                UserList.DataSource = listOfUsers;
                UserList.DataBind();
            }
        }
Exemplo n.º 20
0
        /// <summary>
        /// 绑定用户数据
        /// </summary>
        protected void BindOrder()
        {
            string strWhere = "(dbo.Users.RoleID <> 0)";

            if (GroupList.SelectedValue != "all")
            {
                strWhere = strWhere + " and dbo.Users.UserGroup=" + GroupList.SelectedValue;
            }
            DataSet ds = bll.GetUserList(strWhere, "ORDER BY dbo.Users.CreateTime DESC");

            if (ds.Tables[0].Rows.Count == 0)
            {
                GridViewMsg.InnerText = ResourceManager.GetString("Pub_Msg_norecord");
            }
            else
            {
                GridViewMsg.InnerText = ResourceManager.GetString("Pub_Lab_gy") + ds.Tables[0].Rows.Count + ResourceManager.GetString("Pub_Lab_tjl");
            }

            UserList.DataSource = ds;
            UserList.DataBind();
        }
Exemplo n.º 21
0
    protected void LoadUserList()
    {
        using (var db = CLinq.DataContext.Create())
        {
            var userQuery =
                from u in db.Users
                orderby u.UserRef
                select new
            {
                u.UserRef,
                u.UserName,
                u.EmailAddress,
                LastLoginDate = u.LastLogin,
                Comments      = u.Comments.Count,
                Ratings       = u.UserToLinks.Count,
                PollVotes     = u.UserToPollOptions.Count,
                u.IsAdmin
            };

            UserList.DataSource = userQuery.ToList();
            UserList.DataBind();
        }
    }
Exemplo n.º 22
0
        protected void Page_Load(object sender, EventArgs e)
        {
            TimeTxt.Text = DateTime.Now.ToString("yyyy-MM-dd");
            string AddTime = System.DateTime.Now.AddDays(1).ToString("yyyy-MM-dd");

            if (!IsPostBack)
            {
                DataTable dt = Session["UserTable"] as DataTable;
                if (dt.Rows[0]["UserType"].ToString() == "3")
                {
                    this.shop.Visible = false;
                    this.num.Visible  = false;
                }
                SelectInfo(TimeTxt.Text, AddTime);
                string    Sql = "select UserName,Password,PhoneNumber from UserInfo where UserType=3";
                DataSet   ST  = DataBase.RunDataSet(Sql);
                DataTable S   = ST.Tables[0];
                UserList.DataSource = S;
                UserList.DataBind();
                Timer Timer1 = new Timer();
                Timer1.Enabled = true; //启动计时器
            }
        }
Exemplo n.º 23
0
    /// <summary>
    /// 绑定数据
    /// </summary>
    protected void BindData()
    {
        #region oooooooooooold Code
        //DataTable sd = new DataTable();
        //string[] sql = new string[2];
        //string topSQL = " top 30 ";
        //sql[0] = "select " + topSQL + "  *  from VUsersAlbum where Enable='" + Library.EnableState.未处理 + "'";
        //sql[1] = "select " + topSQL + " count(*) from VUsersAlbum   where  Enable='" + Library.EnableState.未处理 + "'";

        //string url = "UserAlbum.aspx";

        //PageLink page_set = new PageLink( url, 30, 10, "", sql );
        //page_set.paraLinkType = paraLinkShow.middling.ToString();
        //sd = page_set.get_table();
        //if( sd.Rows.Count > 0 )
        //{

        //    rptDataList.DataSource = sd;
        //    rptDataList.DataBind();
        //    this.pageList.Text = page_set.pageList();
        //}
        //else
        //    this.NoUserList.Visible = true;
        //sd.Clear();
        #endregion

        DbSession.Default.CacheOn();

        string where = "";
        string es     = CommonManager.Web.RequestUrlDecode("es", "");
        string userid = CommonManager.Web.RequestUrlDecode("userid", "");          //Limit.getFormValue( "userid" );
        if (!string.IsNullOrEmpty(es))
        {
            where = "and Enable='" + es + "'";
            //Response.Write( where );
            //Response.End();
        }
        if (!string.IsNullOrEmpty(userid))
        {
            where += string.IsNullOrEmpty(where) ? "and UserName='******'" : "and UserName='******'";

            //Response.Write( where );
            //Response.End();
        }
        DataSet dt = DbSession.Default.FromProc("Web_pGetDataPager")
                     .AddInputParameter("@PageSize", DbType.Int32, anpPageIndex.PageSize)
                     .AddInputParameter("@CurrentPage", DbType.Int32, PageIndex)
                     .AddInputParameter("@Columns", DbType.String, "*")
                     .AddInputParameter("@TableName", DbType.String, "VUsersAlbum")
                     .AddInputParameter("@Wheres", DbType.String, " " + where)
                     .AddInputParameter("@KeyName", DbType.String, "ID")
                     .AddInputParameter("@OrderBy", DbType.String, "InputTime desc")
                     .ToDataSet();

        //.AddInputParameter( "@QueryStr", DbType.String, "select * from VUsersAlbum" + where )
        //.AddInputParameter( "@PageSize", DbType.Int32, anpPageIndex.PageSize )
        //.AddInputParameter( "@PageCurrent", DbType.Int32, PageIndex )
        //.AddInputParameter( "@FdShow", DbType.String, "*" )
        //.AddInputParameter( "@FdOrder", DbType.String, "InputTime desc" )
        //.ToDataTable();

        if (/*dt.Rows.Count <= 0*/ dt.Tables.Count > 0 && dt.Tables[1].Rows.Count > 0)
        {
            anpPageIndex.RecordCount      = (int)dt.Tables[0].Rows[0][0];       //DbSession.Default.Count<VUsersAlbum>( new WhereClip( where.Replace( "where", "" ) ) );
            anpPageIndex.CurrentPageIndex = PageIndex;

            UserList.DataSource = dt.Tables[1];
            UserList.DataBind();
            UserList.Visible   = true;
            NoUserList.Visible = false;
        }
        else
        {
            UserList.Visible        = false;
            this.NoUserList.Visible = true;
        }
    }
 private void BindGrid()
 {
     UserList.DataSource = cMercaderia.obtenerMercaderia(objConexion).Tables[0].DefaultView;
     UserList.DataBind();
     cMercaderia.closeConexion();
 }
Exemplo n.º 25
0
 public override void DataBind()
 {
     base.DataBind();
     UserList.DataSource = Controller.GetUsers();
     UserList.DataBind();
 }
Exemplo n.º 26
0
 protected void GroupList_SelectedIndexChanged(object sender, EventArgs e)
 {
     GroupText.Text = GroupList.SelectedItem.ToString();
     UserList.DataBind();
 }
Exemplo n.º 27
0
        /// <summary>
        /// Bind data for this control.
        /// </summary>
        private void BindData()
        {
            // load available images from images/medals folder
            using (DataTable dt = new DataTable("Files"))
            {
                // create structure
                dt.Columns.Add("FileID", typeof(long));
                dt.Columns.Add("FileName", typeof(string));
                dt.Columns.Add("Description", typeof(string));

                // add blank row
                DataRow dr = dt.NewRow();
                dr["FileID"]      = 0;
                dr["FileName"]    = "../spacer.gif";              // use blank.gif for Description Entry
                dr["Description"] = "Select Medal Image";
                dt.Rows.Add(dr);

                // add files from medals folder
                DirectoryInfo dir   = new DirectoryInfo(Request.MapPath(String.Format("{0}images/medals", YafForumInfo.ForumFileRoot)));
                FileInfo[]    files = dir.GetFiles("*.*");

                long nFileID = 1;

                foreach (FileInfo file in files)
                {
                    string sExt = file.Extension.ToLower();

                    // do just images
                    if (sExt != ".png" && sExt != ".gif" && sExt != ".jpg")
                    {
                        continue;
                    }

                    dr                = dt.NewRow();
                    dr["FileID"]      = nFileID++;
                    dr["FileName"]    = file.Name;
                    dr["Description"] = file.Name;
                    dt.Rows.Add(dr);
                }

                // medal image
                MedalImage.DataSource     = dt;
                MedalImage.DataValueField = "FileName";
                MedalImage.DataTextField  = "Description";

                // ribbon bar image
                RibbonImage.DataSource     = dt;
                RibbonImage.DataValueField = "FileName";
                RibbonImage.DataTextField  = "Description";

                // small medal image
                SmallMedalImage.DataSource     = dt;
                SmallMedalImage.DataValueField = "FileName";
                SmallMedalImage.DataTextField  = "Description";

                // small ribbon bar image
                SmallRibbonImage.DataSource     = dt;
                SmallRibbonImage.DataValueField = "FileName";
                SmallRibbonImage.DataTextField  = "Description";
            }

            // bind data to controls
            DataBind();

            // load existing medal if we are editing one
            if (Request.QueryString["m"] != null)
            {
                // load users and groups who has been assigned this medal
                UserList.DataSource = DB.user_medal_list(null, Request.QueryString["m"]);
                UserList.DataBind();
                GroupList.DataSource = DB.group_medal_list(null, Request.QueryString["m"]);
                GroupList.DataBind();

                // enable adding users/groups
                AddUserRow.Visible  = true;
                AddGroupRow.Visible = true;

                using (DataTable dt = YAF.Classes.Data.DB.medal_list(Request.QueryString["m"]))
                {
                    // get data row
                    DataRow row = dt.Rows[0];

                    // load flags
                    MedalFlags flags = new MedalFlags(row["Flags"]);

                    // set controls
                    Name.Text               = row["Name"].ToString();
                    Description.Text        = row["Description"].ToString();
                    Message.Text            = row["Message"].ToString();
                    Category.Text           = row["Category"].ToString();
                    SortOrder.Text          = row["SortOrder"].ToString();
                    ShowMessage.Checked     = flags.ShowMessage;
                    AllowRibbon.Checked     = flags.AllowRibbon;
                    AllowHiding.Checked     = flags.AllowHiding;
                    AllowReOrdering.Checked = flags.AllowReOrdering;

                    // select images
                    SelectImage(MedalImage, MedalPreview, row["MedalURL"]);
                    SelectImage(RibbonImage, RibbonPreview, row["RibbonURL"]);
                    SelectImage(SmallMedalImage, SmallMedalPreview, row["SmallMedalURL"]);
                    SelectImage(SmallRibbonImage, SmallRibbonPreview, row["SmallRibbonURL"]);
                }

                using (DataTable dt = DB.group_list(PageContext.PageBoardID, null))
                {
                    // get data row
                    DataRow row = dt.Rows[0];

                    AvailableGroupList.DataSource     = dt;
                    AvailableGroupList.DataTextField  = "Name";
                    AvailableGroupList.DataValueField = "GroupID";
                    AvailableGroupList.DataBind();
                }
            }
            else
            {
                // set all previews on blank image
                MedalPreview.Src       = String.Format("{0}images/spacer.gif", YafForumInfo.ForumRoot);
                RibbonPreview.Src      = String.Format("{0}images/spacer.gif", YafForumInfo.ForumRoot);
                SmallMedalPreview.Src  = String.Format("{0}images/spacer.gif", YafForumInfo.ForumRoot);
                SmallRibbonPreview.Src = String.Format("{0}images/spacer.gif", YafForumInfo.ForumRoot);
            }
        }
Exemplo n.º 28
0
//-------------------------------------------------------------------------------------------
    private void UpdateUsers()
    {
        UserList.DataSource = Roles.GetUsersInRole(RolesList.SelectedItem.Text);
        UserList.DataBind();
    }
Exemplo n.º 29
0
        /// <summary>
        /// Updates the state of the control (visible buttons etc.) according to the new View Mode.
        /// </summary>
        /// <param name="viewMode">The new view mode.</param>
        private void SetViewMode(ViewMode viewMode)
        {
            bool isAdministrator = Membership.QueryDistinctMembershipLevel(WorkroomStartPage, MembershipLevels.Administer);

            if (!isAdministrator)
            {
                viewMode = ViewMode.ViewMembers;
            }

            ActiveMode = viewMode;
            switch (viewMode)
            {
            case ViewMode.ViewMembers:
                ToolBarButtons.Visible                = isAdministrator;
                PersistButtons.Visible                = false;
                ConfirmDeleteButtons.Visible          = false;
                SearchDialog.Visible                  = false;
                ConfirmDeleteButtons.Visible          = false;
                DeleteButton.Visible                  = false;
                DeleteUserDialog.Visible              = false;
                MemberListHeading.Text                = Translate("/workroom/membershipmanager/viewmembersheading");
                SendNotificationsConfirmation.Visible = false;
                break;

            case ViewMode.AddMembers:
                ToolBarButtons.Visible       = false;
                PersistButtons.Visible       = true;
                DeleteButton.Visible         = false;
                SearchDialog.Visible         = true;
                ConfirmDeleteButtons.Visible = false;
                DeleteButton.Visible         = false;
                DeleteUserDialog.Visible     = false;
                MemberListHeading.Text       = Translate("/workroom/membershipmanager/searchresultheading");
                FillInviteMembershipDropDown();
                SendNotificationsConfirmation.Visible = true;
                SendOkPanel.Visible    = false;
                SendErrorPanel.Visible = false;
                SendNotificationsConfirmation.Visible = false;
                break;

            case ViewMode.EditMembers:
                ToolBarButtons.Visible                = false;
                PersistButtons.Visible                = true;
                SearchDialog.Visible                  = false;
                DeleteButton.Visible                  = true;
                ConfirmDeleteButtons.Visible          = false;
                DeleteUserDialog.Visible              = false;
                MemberListHeading.Text                = Translate("/workroom/membershipmanager/managemembersheading");
                SendNotificationsConfirmation.Visible = true;
                break;

            case ViewMode.DeleteMember:
                ToolBarButtons.Visible                = false;
                PersistButtons.Visible                = false;
                DeleteButton.Visible                  = false;
                ConfirmDeleteButtons.Visible          = true;
                DeleteUserDialog.Visible              = true;
                SearchDialog.Visible                  = false;
                MemberListHeading.Text                = Translate("/workroom/membershipmanager/managemembersheading");
                SendOkPanel.Visible                   = false;
                SendErrorPanel.Visible                = false;
                SendNotificationsConfirmation.Visible = true;
                break;
            }

            //Clear search criteria
            UserName.Text = string.Empty;
            Email.Text    = string.Empty;

            // Always clear the collection of modified members,
            // this is only for persisting modifications between changes in paging.
            _modifiedMembers.Clear();
            SetupDeleteUserSelection();
            UserList.PageIndex = 0;
            UserList.DataBind();
        }
Exemplo n.º 30
0
    public void UsersLoginList()
    {
        string bt         = CommonManager.Web.Request("bt", "");
        string et         = CommonManager.Web.Request("et", "");
        string kw         = CommonManager.Web.Request("kw", "").Replace('$', '\\');
        string isLike     = CommonManager.Web.Request("IsLike", "");
        string selType    = CommonManager.Web.Request("sel", "");         //关键字类别
        string sel2       = CommonManager.Web.Request("sel2", "");        //某条件如:ip/matchinecode
        string sel3       = CommonManager.Web.Request("sel3", "");        //玩家状态
        string sel4       = CommonManager.Web.Request("sel4", "");        //排列条件
        string sel5       = CommonManager.Web.Request("sel5", "desc");    //排列方式
        string loginCount = CommonManager.Web.Request("loginCount", "0"); //某条件下登录的次数
        string sqlWhere   = "";
        string order      = "";

        if (sel4 == "mcode")
        {
            order = " MachineCode " + sel5;
        }
        else if (sel4 == "ip")
        {
            order = "LastLoginIP " + sel5;
        }
        else
        {
            order = "LastLoginTM " + sel5;
        }



        if (bt != "")
        {
            sqlWhere += " and LastLoginTm>='" + bt + "'";
        }
        if (et != "")
        {
            sqlWhere += " and LastLoginTM<='" + et + "'";
        }
        if (kw != "")
        {
            if (selType == "1")
            {
                sqlWhere += (isLike == "1")? " and username  like '%" + kw + "%'":" and username='******'";
            }
            else if (selType == "2")
            {
                sqlWhere += (isLike == "1") ? " and userid like '%" + kw + "%'" : " and userid=" + kw;
            }
            else if (selType == "3")
            {
                sqlWhere += (isLike == "1") ? " and LastLoginIP like '%" + kw + "%'" : " and LastLoginIP='" + kw + "'";
            }
            else if (selType == "4")
            {
                sqlWhere += (isLike == "1") ? " and machinecode like '%" + kw + "%'" : " and machinecode='" + kw + "'";
            }
            else
            {
                sqlWhere += (isLike == "1") ? " and HardID like '%" + kw + "%'" : " and HardID='" + kw + "'";
            }
        }
        if (sel3 != "" && sel3 != "0")
        {
            if (sel3 == "1")
            {
                sqlWhere += " and [disabled]=1 or machinecode in (select LockCode from TLockCode) or lastloginip in (select accessipchar from TGameIPRule where LimitedLogon<>0)  ";
            }
            else
            {
                sqlWhere += " and [disabled]=0 and machinecode not in (select LockCode from TLockCode) and lastloginip not in (select accessipchar from TGameIPRule where LimitedLogon<>0)";
            }
        }
        if (loginCount != "0")
        {
            if (sel2 == "ip")
            {
                sqlWhere += " and lastloginip IN ( SELECT lastloginip FROM web_vuserloginlist GROUP BY lastloginip HAVING COUNT(lastloginip)>" + loginCount + ")";
            }
            else
            {
                sqlWhere += " and MachineCode in (select MachineCode from Web_vuserLoginList GROUP BY MachineCode  having  count(machinecode)>" + loginCount + ")";
            }
        }


        DataSet ds = DbSession.Default.FromProc("Web_pGetDataPager")
                     .AddInputParameter("@PageSize", DbType.Int32, anpPageIndex.PageSize)
                     .AddInputParameter("@CurrentPage", DbType.Int32, PageIndex)
                     .AddInputParameter("@Columns", DbType.String, "*")
                     .AddInputParameter("@TableName", DbType.String, "Web_vUserLoginList")
                     .AddInputParameter("@Wheres", DbType.String, sqlWhere)
                     .AddInputParameter("@KeyName", DbType.String, "UserID")
                     .AddInputParameter("@OrderBy", DbType.String, order)
                     .ToDataSet();

        if (ds.Tables.Count > 0 && ds.Tables[1].Rows.Count > 0)
        {
            anpPageIndex.RecordCount      = (int)ds.Tables[0].Rows[0][0];
            anpPageIndex.CurrentPageIndex = PageIndex;
            DataTable dt = ds.Tables[1];
            dt.Columns.Add("IsLimitIP", typeof(bool));
            dt.Columns.Add("IsLockCode", typeof(bool));
            dt.Columns.Add("IsLockHard", typeof(bool));
            foreach (DataRow row in dt.Rows)
            {
                row["IsLimitIP"]  = DbSession.Default.FromSql("select count(AccessIPChar) from TGameIPRule where LimitedLogon<>0 and AccessIPChar='" + row["LastLoginIP"].ToString() + "'").ToScalar();
                row["IsLockCode"] = DbSession.Default.FromSql("select count(LockCode) from TLockCode where LockCode='" + row["MachineCode"].ToString() + "'").ToScalar();
                row["IsLockHard"] = DbSession.Default.FromSql("select count(LockHard) from TLockCode where LockHard='" + row["HardID"].ToString() + "'").ToScalar();
            }
            UserList.DataSource = dt;
            UserList.DataBind();
            UserList.Visible   = true;
            NoUserList.Visible = false;
        }
        else
        {
            anpPageIndex.CurrentPageIndex = 1;

            this.NoUserList.Visible = true;
            UserList.Visible        = false;
        }
    }