Beispiel #1
0
        void LoadData()
        {
            loadbar.Start();
            int    pageCount = 0;
            string filter    = "";

            System.Collections.ObjectModel.ObservableCollection <object> paras = new System.Collections.ObjectModel.ObservableCollection <object>();

            TextBox txtEmpName = Utility.FindChildControl <TextBox>(expander, "txtEmpName");
            TextBox txtEmpCode = Utility.FindChildControl <TextBox>(expander, "txtEmpCode");

            if (!string.IsNullOrEmpty(txtEmpCode.Text.Trim()))
            {
                //filter += "EMPLOYEECODE==@" + paras.Count().ToString();
                filter += " @" + paras.Count().ToString() + ".Contains(EMPLOYEECODE)";
                paras.Add(txtEmpCode.Text.Trim());
            }
            if (!string.IsNullOrEmpty(ListEmployeeids))
            {
                //if (!string.IsNullOrEmpty(filter))
                //{
                //    filter += " and ";
                //}
                //filter += " @" + paras.Count().ToString() + ".Contains(EMPLOYEEID)";
                if (ListEmployeeids.IndexOf(',') > 0)
                {
                    if (!string.IsNullOrEmpty(filter))
                    {
                        filter += " and ";
                    }
                    string[] ArrEmployeeids = ListEmployeeids.Split(',');
                    if (ArrEmployeeids.Count() > 1)
                    {
                        filter += "( ";
                        for (int i = 0; i < ArrEmployeeids.Count(); i++)
                        {
                            if (i > 0)
                            {
                                filter += " or ";
                            }
                            filter += " @" + paras.Count().ToString() + ".Contains(EMPLOYEEID)";
                            paras.Add(ArrEmployeeids[i].ToString());
                        }
                        filter += " ) ";
                    }
                }
                else
                {
                    if (!string.IsNullOrEmpty(filter))
                    {
                        filter += " and ";
                    }
                    filter += " @" + paras.Count().ToString() + ".Contains(EMPLOYEEID)";
                    paras.Add(ListEmployeeids);
                }
                //filter += " EMPLOYEEID.Contains(@" + paras.Count().ToString() + ")";
                //paras.Add(ListEmployeeids);
            }
            if (!string.IsNullOrEmpty(txtEmpName.Text.Trim()))
            {
                if (!string.IsNullOrEmpty(filter))
                {
                    filter += " and ";
                }
                filter += " @" + paras.Count().ToString() + ".Contains(EMPLOYEECNAME)";
                paras.Add(txtEmpName.Text.Trim());
            }

            string       sType = "", sValue = "";
            TreeViewItem selectedItem = treeOrganization.SelectedItem as TreeViewItem;

            if (selectedItem != null)
            {
                string IsTag = selectedItem.Tag.ToString();
                OrganizationWS.T_HR_COMPANY company = selectedItem.DataContext as OrganizationWS.T_HR_COMPANY;
                sType  = "Company";
                sValue = company.COMPANYID;
            }
            client.GetEmployeeViewsWithOutPermissionsAsync(dataPager.PageIndex, dataPager.PageSize, "EMPLOYEECNAME", filter, paras, pageCount, sType, sValue);
        }