Esempio n. 1
0
        public static EntityData GetV_DocumentByCode(string code)
        {
            EntityData data2;

            try
            {
                DocumentStrategyBuilder builder = new DocumentStrategyBuilder();
                builder.AddStrategy(new Strategy(DocumentStrategyName.DocumentCode, code));
                string     queryString = builder.BuildQueryViewString();
                QueryAgent agent       = new QueryAgent();
                EntityData data        = agent.FillEntityData("Document", queryString);
                agent.Dispose();
                data2 = data;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(data2);
        }
Esempio n. 2
0
        private void LoadDataGrid()
        {
            try
            {
//				string DocumentTypeCode = Request.QueryString["DocumentTypeCode"]+"";

                DAL.QueryStrategy.DocumentStrategyBuilder sb = new DocumentStrategyBuilder();

//				if (DocumentTypeCode != "")
//				{
//					sb.AddStrategy( new Strategy( DocumentStrategyName.DocumentTypeCodeFull ,DocumentTypeCode) );
//					this.lblDocumentTypeName.Text = BLL.DocumentRule.Instance().GetDocumentTypeName(DocumentTypeCode);
//				}
//				else
//				{
//					this.lblDocumentTypeName.Text = "所有文档";
//				}

                if (this.txtGroupFullID.Value != "")
                {
                    sb.AddStrategy(new Strategy(DocumentStrategyName.GroupFullIDs, this.txtGroupFullID.Value));
                }

                string title = this.txtSearchTitle.Value.Trim();
                if (title.Length > 0)
                {
                    sb.AddStrategy(new Strategy(DAL.QueryStrategy.DocumentStrategyName.Title, title));
                }

                //状态
                ArrayList arStatus = new ArrayList();
                if (this.chkStatus0.Checked)
                {
                    arStatus.Add("0");
                }
                if (this.chkStatus1.Checked)
                {
                    arStatus.Add("1");
                }
                string status = BLL.ConvertRule.GetArrayLinkString(arStatus);
                if (status != "")
                {
                    sb.AddStrategy(new Strategy(DocumentStrategyName.Status, status));
                }

                if (this.txtAdvSearch.Value != "none")
                {
                    string CreateDate_begin = this.dtCreateDate_begin.Value.Trim();
                    string CreateDate_end   = this.dtCreateDate_end.Value.Trim();
                    string ModifyDate_begin = this.dtModifyDate_begin.Value.Trim();
                    string ModifyDate_end   = this.dtModifyDate_end.Value.Trim();
                    string DocumentID       = this.txtSearchDocumentID.Value.Trim();
                    string author           = this.txtSearchAuthor.Value.Trim();
                    string CreatePerson     = this.ucCreatePerson.Value.Trim();
                    string ModifyPerson     = this.ucModifyPerson.Value.Trim();

                    string FixedType = this.sltFixedType.Value.Trim();
                    string Code      = this.txtCode.Value.Trim();

                    ArrayList ar = new ArrayList();
                    ar.Add(CreateDate_begin);
                    ar.Add(CreateDate_end);

                    ArrayList ar2 = new ArrayList();
                    ar2.Add(ModifyDate_begin);
                    ar2.Add(ModifyDate_end);

                    sb.AddStrategy(new Strategy(DAL.QueryStrategy.DocumentStrategyName.CreateDateRange, ar));
                    sb.AddStrategy(new Strategy(DAL.QueryStrategy.DocumentStrategyName.ModifyDateRange, ar2));

                    if (DocumentID.Length > 0)
                    {
                        sb.AddStrategy(new Strategy(DAL.QueryStrategy.DocumentStrategyName.DocumentID, "%" + DocumentID + "%"));
                    }
                    if (author.Length > 0)
                    {
                        sb.AddStrategy(new Strategy(DAL.QueryStrategy.DocumentStrategyName.Author, author));
                    }
                    if (CreatePerson.Length > 0)
                    {
                        sb.AddStrategy(new Strategy(DAL.QueryStrategy.DocumentStrategyName.CreatePerson, CreatePerson));
                    }
                    if (ModifyPerson.Length > 0)
                    {
                        sb.AddStrategy(new Strategy(DAL.QueryStrategy.DocumentStrategyName.ModifyPerson, ModifyPerson));
                    }

                    if (Code.Length > 0)
                    {
                        if (FixedType.Length > 0)
                        {
                            ArrayList arTmp = new ArrayList();
                            arTmp.Add(FixedType);
                            arTmp.Add(Code);
                            sb.AddStrategy(new Strategy(DAL.QueryStrategy.DocumentStrategyName.RelationKey, arTmp));
                        }
                        else
                        {
                            //					ssb.AddStrategy( new Strategy(DAL.QueryStrategy.DocumentStrategyName.Code, Code));
                        }
                    }
                }

                //权限
                ArrayList arA = new ArrayList();
                arA.Add("100101");
                arA.Add(user.UserCode);
                arA.Add(user.BuildStationCodes());
                sb.AddStrategy(new Strategy(DAL.QueryStrategy.DocumentStrategyName.AccessRange, arA));

                //排序
                string sortsql = BLL.GridSort.GetSortSQL(ViewState);
                if (sortsql == "")
                {
                    //缺省排序
                    sb.AddOrder("CreateDate", false);
                }

                string sql = sb.BuildQueryViewString();

                if (sortsql != "")
                {
                    //点列标题排序
                    sql = sql + " order by " + sortsql;
                }

                QueryAgent qa     = new QueryAgent();
                EntityData entity = qa.FillEntityData("Document", sql);
                qa.Dispose();

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

                this.GridPagination1.RowsCount = entity.CurrentTable.Rows.Count.ToString();

                entity.Dispose();
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "");
                Response.Write(Rms.Web.JavaScript.Alert(true, "显示列表出错:" + ex.Message));
            }
        }