예제 #1
0
        private void LoadData()
        {
            loadbar.Start();       //打开转动动画
            int    pageCount = 0;
            string filter    = ""; //查询过滤条件
            string StrStart  = "";
            string StrEnd    = "";
            ObservableCollection <object> paras = new System.Collections.ObjectModel.ObservableCollection <object>(); //参数值
            T_SYS_DICTIONARY StrWelfareId       = cbWelfareID.SelectedItem as T_SYS_DICTIONARY;                       //从字典里查询福利名称

            if (this.cbWelfareID.SelectedIndex >= 0)                                                                  //福利名称
            {
                if (!string.IsNullOrEmpty(filter))
                {
                    filter += " and ";
                }
                filter += "welfareStandard.WELFAREPROID ^@" + paras.Count().ToString();
                paras.Add(StrWelfareId.DICTIONARYVALUE.ToString());
            }
            StrStart = ReleaseTime.Text.ToString();
            StrEnd   = ReleaseEndTime.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);
                if (DtStart > DtEnd)
                {
                    Utility.ShowCustomMessage(MessageTypes.Caution, Utility.GetResourceStr("SEARCH"), Utility.GetResourceStr("STARTTIMENOTGREATENDTIME"));
                    return;
                }
                else
                {
                    if (!string.IsNullOrEmpty(filter))
                    {
                        filter += " and ";
                    }
                    filter += "welfareStandard.STARTDATE >=@" + paras.Count().ToString();
                    paras.Add(DtStart);
                    if (!string.IsNullOrEmpty(filter))
                    {
                        filter += " and ";
                    }
                    filter += "welfareStandard.STARTDATE <=@" + paras.Count().ToString();
                    paras.Add(DtEnd);
                }
            }
            else
            {
                //开始时间不为空  结束时间为空
                if (!string.IsNullOrEmpty(StrStart) && string.IsNullOrEmpty(StrEnd))
                {
                    if (!string.IsNullOrEmpty(filter))
                    {
                        filter += " and ";
                    }
                    filter += "welfareStandard.STARTDATE <=@" + paras.Count().ToString();
                    paras.Add(DtStart);
                }
                //结束时间不为空
                if (string.IsNullOrEmpty(StrStart) && !string.IsNullOrEmpty(StrEnd))
                {
                    if (!string.IsNullOrEmpty(filter))
                    {
                        filter += " and ";
                    }
                    filter += "welfareStandard.STARTDATE >=@" + paras.Count().ToString();
                    paras.Add(DtEnd);
                }
            }
            SMT.SaaS.OA.UI.SmtOADocumentAdminService.LoginUserInfo loginUserInfo = new SMT.SaaS.OA.UI.SmtOADocumentAdminService.LoginUserInfo();
            loginUserInfo.companyID = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
            loginUserInfo.userID    = Common.CurrentLoginUserInfo.EmployeeID;
            wssc.GetWelfareListByUserIdAsync(dpGrid.PageIndex, dpGrid.PageSize, "welfareStandard.CHECKSTATE", filter, paras, pageCount, checkState, loginUserInfo);
        }