示例#1
0
    private void DisplayUsers()
    {
        List<CustomerData> customerList = new List<CustomerData>();
        Ektron.Cms.Common.Criteria<CustomerProperty> CustomerCriteria = new Ektron.Cms.Common.Criteria<CustomerProperty>(CustomerProperty.UserName, Ektron.Cms.Common.EkEnumeration.OrderByDirection.Ascending);

        //CustomerCriteria.AddFilter(CustomerProperty.TotalOrders, CriteriaFilterOperator.GreaterThan, 0)
        //CustomerCriteria.AddFilter(CustomerProperty.TotalOrderValue, CriteriaFilterOperator.GreaterThan, 0)

        CustomerManager = new CustomerApi();

        m_strKeyWords = Request.Form["txtSearch"];

        m_strSelectedItem = Request.Form["searchlist"];

        switch (m_strSelectedItem)
        {

            //Case "-1 selected " ' All

            //    CustomerCriteria.AddFilter(CustomerProperty.FirstName, CriteriaFilterOperator.Contains, m_strKeyWords)

            //    CustomerCriteria.AddFilter(CustomerProperty.LastName, CriteriaFilterOperator.Contains, m_strKeyWords)

            //    CustomerCriteria.AddFilter(CustomerProperty.UserName, CriteriaFilterOperator.Contains, m_strKeyWords)

            //Case "-1" ' All

            //    CustomerCriteria.AddFilter(CustomerProperty.FirstName, CriteriaFilterOperator.Contains, m_strKeyWords)

            //    CustomerCriteria.AddFilter(CustomerProperty.LastName, CriteriaFilterOperator.Contains, m_strKeyWords)

            //    CustomerCriteria.AddFilter(CustomerProperty.UserName, CriteriaFilterOperator.Contains, m_strKeyWords)

            case "last_name": // Last Name

                CustomerCriteria.AddFilter(CustomerProperty.LastName, CriteriaFilterOperator.Contains, m_strKeyWords);
                break;

            case "first_name": // First Name

                CustomerCriteria.AddFilter(CustomerProperty.FirstName, CriteriaFilterOperator.Contains, m_strKeyWords);
                break;

            case "user_name": // User Name

                CustomerCriteria.AddFilter(CustomerProperty.UserName, CriteriaFilterOperator.Contains, m_strKeyWords);
                break;

        }

        customerList = CustomerManager.GetList(CustomerCriteria);

        ViewAllUsersToolBar();
        literal1.Text = "";
        if (customerList != null)
        {
            if (customerList.Count != 0)
            {
                if (customerList.Count > 0)
                {
                    dg_customers.DataSource = customerList;
                    dg_customers.DataBind();

                }
                else
                {
                    literal1.Text = "<br/><label style=\"color:#2E6E9E;\" id=\"lbl_noUsers\">" + this.GetMessage("lbl no users") + "</label>";
                }
            }
            else
            {
                literal1.Text = "<br/><label style=\"color:#2E6E9E;\" id=\"lbl_noUsers\">" + this.GetMessage("lbl no users") + "</label>";
            }
        }
        else
        {
            literal1.Text = "<br/><label style=\"color:#2E6E9E;\" id=\"lbl_noUsers\">" + this.GetMessage("lbl no users") + "</label>";
        }
        dg_customers.DataSource = customerList;
        dg_customers.DataBind();
    }