void cboOrganisation_ItemsRequested(object o, RadComboBoxItemsRequestedEventArgs e)
        {
            Page.Response.Cache.SetCacheability(HttpCacheability.NoCache);

            RadComboBox cboOrganisation = (RadComboBox)o;

            cboOrganisation.Items.Clear();

            Facade.IReferenceData facReferenceData = new Facade.ReferenceData();
            DataSet dsOrganisationNames            = facReferenceData.GetAllOrganisationsFiltered(e.Text, eOrganisationType.ClientCustomer);

            if (dsOrganisationNames.Tables[0].Rows.Count > 0)
            {
                int itemsToRequest = 20;
                if (dsOrganisationNames.Tables[0].Rows.Count < itemsToRequest)
                {
                    itemsToRequest = dsOrganisationNames.Tables[0].Rows.Count;
                }

                Telerik.Web.UI.RadComboBoxItem rcItem = null;
                for (int rowIndex = 0; rowIndex < itemsToRequest; rowIndex++)
                {
                    DataRow dr = dsOrganisationNames.Tables[0].Rows[rowIndex];
                    rcItem       = new Telerik.Web.UI.RadComboBoxItem();
                    rcItem.Text  = dr["OrganisationName"].ToString();
                    rcItem.Value = dr["IdentityID"].ToString();
                    cboOrganisation.Items.Add(rcItem);
                }
            }
        }
Esempio n. 2
0
        void cboOwner_ItemsRequested(object o, Telerik.Web.UI.RadComboBoxItemsRequestedEventArgs e)
        {
            cboOwner.Items.Clear();

            Facade.IReferenceData facReferenceData = new Facade.ReferenceData();
            DataSet ds = facReferenceData.GetAllOrganisationsFiltered(e.Text, false);

            int itemsPerRequest = 20;
            int itemOffset      = e.NumberOfItems;
            int endOffset       = itemOffset + itemsPerRequest;

            if (endOffset > ds.Tables[0].Rows.Count)
            {
                endOffset = ds.Tables[0].Rows.Count;
            }

            DataTable dt = ds.Tables[0];

            Telerik.Web.UI.RadComboBoxItem rcItem = null;
            for (int i = itemOffset; i < endOffset; i++)
            {
                rcItem       = new Telerik.Web.UI.RadComboBoxItem();
                rcItem.Text  = dt.Rows[i]["OrganisationName"].ToString();
                rcItem.Value = dt.Rows[i]["IdentityId"].ToString();
                cboOwner.Items.Add(rcItem);
            }

            if (dt.Rows.Count > 0)
            {
                e.Message = string.Format("Items <b>1</b>-<b>{0}</b> out of <b>{1}</b>", endOffset.ToString(), dt.Rows.Count.ToString());
            }
        }
        void repClientCustomers_NeedDataSource(object source, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
        {
            int identityID;

            int.TryParse(cboOrganisation.SelectedValue, out identityID);

            if (identityID != 0)
            {
                Facade.IReferenceData facReferenceData = new Facade.ReferenceData();
                repClientCustomers.DataSource = facReferenceData.GetAllOrganisationsFiltered(txtClientCustomerFiler.Text, eOrganisationType.ClientCustomer);
            }
        }