예제 #1
0
        private void LoadData()
        {
            string filter    = ""; //查询过滤条件
            int    pageCount = 0;

            if (QueryBtn)
            {
                string StrState = ""; //状态

                string StrStart = ""; //添加文档的起始时间
                string StrEnd   = ""; //添加文档的结束时间

                ComboBox dpState = Utility.FindChildControl <ComboBox>(expander, "dpState");
                switch (dpState.SelectedIndex)
                {
                case 0:
                    StrState = "";
                    break;

                case 1:
                    StrState = "1";
                    break;

                case 2:
                    StrState = "0";
                    break;
                }

                DatePicker DtpStart = Utility.FindChildControl <DatePicker>(expander, "DtStart");
                DatePicker DtpEnd   = Utility.FindChildControl <DatePicker>(expander, "DtEnd");

                StrStart = DtpStart.Text.Trim().ToString();
                StrEnd   = DtpEnd.Text.Trim().ToString();

                if (StrState == "" && StrStart == "" && StrEnd == "")
                {
                    Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("QUERYINFONOTNULL"));
                    return;
                }
                DateTime DtStart = new DateTime();
                DateTime DtEnd   = new DateTime();
                if (!string.IsNullOrEmpty(StrStart) && string.IsNullOrEmpty(StrEnd))
                {
                    //Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("STARTTIMENOTNULL"));
                    //return;
                    DtStart = System.Convert.ToDateTime(StrStart);
                    if (!string.IsNullOrEmpty(filter))
                    {
                        filter += " and ";
                    }
                    filter += "userloginrecord.LOGINDATE >@" + paras.Count().ToString();
                    paras.Add(DtStart);
                }
                if (string.IsNullOrEmpty(StrStart) && !string.IsNullOrEmpty(StrEnd))
                {
                    //Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("ENDTIMENOTNULL"));
                    //return;
                    DtEnd = System.Convert.ToDateTime(StrEnd);
                    if (!string.IsNullOrEmpty(filter))
                    {
                        filter += " and ";
                    }

                    filter += "userloginrecord.LOGINDATE <@" + paras.Count().ToString();
                    paras.Add(DtEnd);
                }
                if (!string.IsNullOrEmpty(StrStart) && !string.IsNullOrEmpty(StrEnd))
                {
                    DtStart = System.Convert.ToDateTime(StrStart);
                    //DtEnd = System.Convert.ToDateTime(StrEnd);
                    DtEnd = System.Convert.ToDateTime(StrEnd + " 23:59:59");
                    if (DtStart > DtEnd)
                    {
                        Utility.ShowCustomMessage(MessageTypes.Caution, Utility.GetResourceStr("SEARCH"), Utility.GetResourceStr("STARTTIMENOTGREATENDTIME")); Utility.ShowCustomMessage(MessageTypes.Caution, Utility.GetResourceStr("SEARCH"), Utility.GetResourceStr("STARTTIMENOTGREATENDTIME"));
                        return;
                    }
                    else
                    {
                        if (!string.IsNullOrEmpty(filter))
                        {
                            filter += " and ";
                        }
                        filter += "userloginrecord.LOGINDATE >@" + paras.Count().ToString();
                        paras.Add(DtStart);
                        filter += " and ";
                        filter += "userloginrecord.LOGINDATE <@" + paras.Count().ToString();
                        paras.Add(DtEnd);
                    }
                }
            }

            loadbar.Start();
            SMT.Saas.Tools.PermissionWS.LoginUserInfo loginUserInfo = new SMT.Saas.Tools.PermissionWS.LoginUserInfo();
            loginUserInfo.companyID = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
            loginUserInfo.userID    = Common.CurrentLoginUserInfo.EmployeeID;
            SysLoginHistoryClient.GetSysUserLoginHistoryRecordAllInfosPagingAsync(dataPager.PageIndex, dataPager.PageSize, "historyrecord.LOGINDATE", filter, paras, pageCount, loginUserInfo);
        }