Пример #1
0
        private void BuildSearchString()
        {
            string projectCode = Request["ProjectCode"] + "";

            RmsPM.DAL.QueryStrategy.ContractStrategyBuilder CSB = new RmsPM.DAL.QueryStrategy.ContractStrategyBuilder();
            string status = BLL.PageFacade.GetListGroupSelectedValues(this.cblStatus);

            if (status != "")
            {
                CSB.AddStrategy(new Strategy(DAL.QueryStrategy.ContractStrategyName.Status, status));
            }

            if (projectCode != "") //材料库要选合同,不分项目 2006.11.2
            {
                CSB.AddStrategy(new Strategy(DAL.QueryStrategy.ContractStrategyName.ProjectCode, projectCode));
            }


            if (this.txtContractName.Value.Trim() != "")
            {
                CSB.AddStrategy(new Strategy(DAL.QueryStrategy.ContractStrategyName.ContractName, "%" + this.txtContractName.Value.Trim() + "%"));
            }

            if (this.txtContractID.Value.Trim() != "")
            {
                CSB.AddStrategy(new Strategy(DAL.QueryStrategy.ContractStrategyName.ContractID, "%" + this.txtContractID.Value.Trim() + "%"));
            }

            ArrayList arA = new ArrayList();

            arA.Add("050101");
            arA.Add(user.UserCode);
            arA.Add(user.BuildStationCodes());
            CSB.AddStrategy(new Strategy(DAL.QueryStrategy.ContractStrategyName.AccessRange, arA));

            if (this.sltUnit.Value != "")
            {
                CSB.AddStrategy(new Strategy(DAL.QueryStrategy.ContractStrategyName.UnitCode, this.sltUnit.Value));
            }

            if (this.txtSupplierCode.Value != "")
            {
                CSB.AddStrategy(new Strategy(DAL.QueryStrategy.ContractStrategyName.SupplierCode, this.txtSupplierCode.Value));
            }

            if (this.inputSystemGroup.Value != "")
            {
                CSB.AddStrategy(new Strategy(DAL.QueryStrategy.ContractStrategyName.Type, this.inputSystemGroup.Value));
            }


            CSB.AddOrder("ContractDate", false);
            string sql = CSB.BuildMainQueryString();

            this.ViewState.Add("SearchString", sql);
        }
Пример #2
0
        private void LoadData()
        {
            try
            {
                string ContractCode  = Request.QueryString["ContractCode"] + "";
                string ContractLabel = "";

                EntityData entity = DAL.EntityDAO.ContractDAO.GetContractByCode(ContractCode);
                if (entity.HasRecord())
                {
                    ContractLabel = entity.GetString("ContractLabel");
                }

                RmsPM.DAL.QueryStrategy.ContractStrategyBuilder CSB = new RmsPM.DAL.QueryStrategy.ContractStrategyBuilder();

                //显示该合同所有的变更记录
                CSB.AddStrategy(new Strategy(DAL.QueryStrategy.ContractStrategyName.NotOriginalContract));
//				CSB.AddStrategy( new Strategy( DAL.QueryStrategy.ContractStrategyName.Status,"6"));

                CSB.AddStrategy(new Strategy(DAL.QueryStrategy.ContractStrategyName.ContractLabel, ContractLabel));
                string     sql        = CSB.BuildMainQueryString();
                QueryAgent qa         = new QueryAgent();
                EntityData entityTemp = qa.FillEntityData("Contract", sql);
                qa.Dispose();

                this.dgList.DataSource = entityTemp.CurrentTable;
                this.dgList.DataBind();

                entity.Dispose();
                entityTemp.Dispose();
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "加载合同列表错误。");
            }
        }