Ejemplo n.º 1
0
        private void LoadData()
        {
            int    pageCount = 0;
            string filter    = "";                                                                                    //查询过滤条件
            ObservableCollection <object> paras = new System.Collections.ObjectModel.ObservableCollection <object>(); //参数值

            //checkState =
            //if (!string.IsNullOrEmpty(StrTitle))
            //{
            //    IsNull = true;
            //    if (!string.IsNullOrEmpty(filter))
            //    {
            //        filter += " and ";
            //    }
            //    filter += "OACompanySendDoc.SENDDOCTITLE ^@" + paras.Count().ToString();//标题名称
            //    paras.Add(StrTitle);
            //}
            if (checkState != "2")
            {
                filter += "HouseRecordObj.ISSETTLEMENT ^@" + paras.Count().ToString();//标题名称
                paras.Add(checkState);
            }

            SMT.SaaS.OA.UI.SmtOACommonAdminService.LoginUserInfo loginUserInfo = new SMT.SaaS.OA.UI.SmtOACommonAdminService.LoginUserInfo();
            if (string.IsNullOrEmpty(loginUserInfo.companyID))
            {
                //Utility.GetLoginUserInfo(loginUserInfo);
                loginUserInfo.companyID    = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
                loginUserInfo.userID       = Common.CurrentLoginUserInfo.EmployeeID;
                loginUserInfo.departmentID = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
            }
            if (!string.IsNullOrEmpty(txtUptown.Text.Trim()))
            {
                filter += "houseInfoObj.UPTOWN^@" + paras.Count().ToString();
                paras.Add(txtUptown.Text.Trim());
            }
            if (!string.IsNullOrEmpty(txtHouseName.Text.Trim()))
            {
                if (!string.IsNullOrEmpty(filter))
                {
                    filter += " and ";
                }
                filter += "houseInfoObj.HOUSENAME^@" + paras.Count().ToString();
                paras.Add(txtHouseName.Text.Trim());
            }
            string StrStart = "";
            string StrEnd   = "";

            StrStart = dpStart.Text.ToString();
            StrEnd   = dpEnd.Text.ToString();
            DateTime DtStart = new DateTime();
            DateTime DtEnd   = new DateTime();

            if (!string.IsNullOrEmpty(StrStart) && !string.IsNullOrEmpty(StrEnd))
            {
                DtStart = System.Convert.ToDateTime(StrStart);
                DtEnd   = System.Convert.ToDateTime(StrEnd + " 23:59:59");
                if (DtStart > DtEnd)
                {
                    //MessageBox.Show("开始时间不能大于结束时间");
                    Utility.ShowCustomMessage(MessageTypes.Caution, Utility.GetResourceStr("SEARCH"), Utility.GetResourceStr("STARTTIMENOTGREATENDTIME"));
                    return;
                }
                else
                {
                    if (!string.IsNullOrEmpty(filter))
                    {
                        filter += " and ";
                    }
                    filter += "houseAppObj.STARTDATE >=@" + paras.Count().ToString();
                    paras.Add(DtStart);
                    if (!string.IsNullOrEmpty(filter))
                    {
                        filter += " and ";
                    }
                    filter += "houseAppObj.STARTDATE <=@" + paras.Count().ToString();
                    paras.Add(DtEnd);
                }
            }
            loadbar.Start();

            client.GetHireRecordListPagingAsync(dataPager.PageIndex, dataPager.PageSize, "HouseRecordObj.CREATEDATE descending", filter, paras, pageCount, checkState, loginUserInfo);
        }