示例#1
0
    //-----------------------------------------------
    #endregion

    #region --------------LoadData--------------
    //---------------------------------------------------------
    //LoadData
    //---------------------------------------------------------
    private void LoadData()
    {
        pager.PageSize = SiteSettings.Site_AdminPageSize;
        int totalRecords = 0;
        //--------------------------------------------------------------------
        Languages langID = Languages.Unknowen;

        if (SiteSettings.Languages_HasMultiLanguages)
        {
            langID = (Languages)Convert.ToInt32(ddlLanguages.SelectedValue);
        }
        //--------------------------------------------------------------------
        int categoryID = -1;

        if (currentModule.CategoryLevel != 0)
        {
            categoryID = Convert.ToInt32(ddlCategoryID.SelectedValue);
        }
        //--------------------------------------------------------------------
        List <UsersDataEntity> usersDataList;

        usersDataList = UsersDataFactory.GetAll(ModuleTypeID, categoryID, langID, "", UserRole, pager.CurrentPage, pager.PageSize, out totalRecords, OwnerID, false);


        if (usersDataList != null && usersDataList.Count > 0)
        {
            dgUsersData.DataSource   = usersDataList;
            dgUsersData.DataKeyField = "UserId";
            dgUsersData.AllowPaging  = false;
            pager.Visible            = true;
            pager.TotalRecords       = totalRecords;
            dgUsersData.DataBind();
            dgUsersData.Visible = true;
            dgUsersData.Columns[dgUsersData.Columns.Count - 2].Visible = ViewUpdate;
            //-------------------------------------------------------------------------------
            //Security Premession
            //--------------------------
            //Check Delete permission
            if (!ZecurityManager.UserCanExecuteCommand(CommandName.Delete))
            {
                dgUsersData.Columns[dgUsersData.Columns.Count - 1].Visible = false;
            }
            //-------------------------------------------------------------------------------
        }
        else
        {
            dgUsersData.Visible = false;
            pager.Visible       = false;
            lblResult.CssClass  = "operation_error";
            lblResult.Text      = Resources.AdminText.ThereIsNoData;
        }
    }
            //-----------------------------------------------------------


            #region --------------LoadData--------------
            //---------------------------------------------------------
            //LoadData
            //---------------------------------------------------------
            private void LoadData()
            {
                //--------------------------------------------------------------------
                Languages langID = SiteSettings.GetCurrentLanguage();
                //--------------------------------------------------------------------
                //List<UsersDataEntity> usersDataList = UsersDataFactory.GetAll(ModuleTypeID, categoryID, langID, "", UserRole, pager.CurrentPage, pager.PageSize, out totalRecords, OwnerID, true, keywords);
                int totalRecords = 0;
                List <UsersDataEntity> usersDataList = UsersDataFactory.GetAll(ModuleTypeID, CategoryID, langID, "", UserRole, -1, -1, out totalRecords, OwnerID, true, "");
                Repeater r = (Repeater)this.FindControl(TemplateID);

                if (usersDataList != null && usersDataList.Count > 0)
                {
                    r.DataSource = usersDataList;
                    r.DataBind();
                }
            }
示例#3
0
    //-----------------------------------------------
    #endregion

    #region ---------------Load_ddlUsers---------------
    //-----------------------------------------------
    //Load_ddlUsers
    //-----------------------------------------------
    private void Load_ddlUsers()
    {
        List <UsersDataEntity> usersDataList;

        usersDataList = UsersDataFactory.GetAll(601, -1, Languages.Unknowen, OwnerID, false);
        if (usersDataList.Count > 0)
        {
            ddlUsers.DataTextField  = "Name";
            ddlUsers.DataValueField = "UserID";
            ddlUsers.DataSource     = usersDataList;
            ddlUsers.DataBind();
            ddlUsers.Items.Insert(0, new ListItem(Resources.AdminText.Choose, ""));
        }
        else
        {
            ddlUsers.Items.Insert(0, new ListItem(Resources.AdminText.ThereIsNoData, ""));
        }
    }
            //-----------------------------------------------------------



            #region --------------LoadData--------------
            //---------------------------------------------------------
            //LoadData
            //---------------------------------------------------------
            private void LoadData()
            {
                pager.PageSize = currentModule.PageItemCount_UserDefault;
                //--------------------------------------------------------------------
                Languages langID = SiteSettings.GetCurrentLanguage();
                //--------------------------------------------------------------------
                int categoryID = -1;

                if (currentModule.CategoryLevel != 0)
                {
                    categoryID = Convert.ToInt32(Request.QueryString["id"]);
                }
                //--------------------------------------------------------------------
                string keywords = "";

                if (trSearch.Visible)
                {
                    keywords = txtSearch.Text;
                }
                //--------------------------------------------------------------------
                List <UsersDataEntity> usersDataList = UsersDataFactory.GetAll(ModuleTypeID, categoryID, langID, "", UserRole, pager.CurrentPage, pager.PageSize, out totalRecords, OwnerID, true, keywords);

                Control  c;
                DataList dl;
                Repeater r;

                c = this.FindControl(TemplateID);
                if (c is DataList)
                {
                    dl = (DataList)c;
                    LoadDataList(dl, usersDataList);
                }
                else
                {
                    r = (Repeater)c;
                    LoadRepeater(r, usersDataList);
                }
            }
示例#5
0
    //-----------------------------------------------
    #endregion

    #region ---------------Export---------------
    //-----------------------------------------------
    //Export
    //-----------------------------------------------
    private void Export()
    {
        int       catID  = Convert.ToInt32(Request.QueryString["id"]);
        Languages langID = (Languages)Convert.ToInt32(Request.QueryString["lang"]);
        List <UsersDataEntity> usersDataList = UsersDataFactory.GetAll(CurrentUsersModule.ModuleTypeID, catID, langID, OwnerID, false);

        if (usersDataList != null && usersDataList.Count > 0)
        {
            dgUsers.DataSource   = usersDataList;
            dgUsers.DataKeyField = "UserProfileID";
            dgUsers.DataBind();
            dgUsers.Visible = true;
            //-----------------------------------
            Response.Clear();
            //Response.HeaderEncoding = Encoding.GetEncoding("Windows-1256");
            Response.AddHeader("content-disposition", "attachment;filename=SiteUsers.xls");
            Response.ContentEncoding = System.Text.Encoding.GetEncoding("utf-8");
            // Response.Charset = "utf-8";
            Response.Charset = "utf-8";
            Response.Cache.SetCacheability(HttpCacheability.NoCache);
            Response.ContentType = "application/vnd.ms-excel";
            System.IO.StringWriter       stringWrite = new System.IO.StringWriter();
            System.Web.UI.HtmlTextWriter htmlWrite   = new HtmlTextWriter(stringWrite);
            dgUsers.RenderControl(htmlWrite);
            Response.Write(stringWrite.ToString());
            Response.End();
            dgUsers.Visible = false;
            //-----------------------------------
        }
        else
        {
            dgUsers.Visible    = false;
            lblResult.CssClass = "operation_error";
            lblResult.Text     = Resources.AdminText.ThereIsNoData;
        }
    }