Ejemplo n.º 1
0
        /// <summary>
        /// 显示列表
        /// </summary>
        private void LoadDataGrid()
        {
            this.lblMessage.Text = "";

            try
            {
                string VoucherID = this.txtSearchVoucherID.Value.Trim();

                VoucherStrategyBuilder sb = new VoucherStrategyBuilder();
                sb.AddStrategy(new Strategy(VoucherStrategyName.ProjectCode, this.txtProjectCode.Value));

                if (VoucherID.Length > 0)
                {
                    sb.AddStrategy(new Strategy(DAL.QueryStrategy.VoucherStrategyName.VoucherID, VoucherID));
                }

                if (this.sltSearchVoucherType.Value != "")
                {
                    sb.AddStrategy(new Strategy(VoucherStrategyName.VoucherType, this.sltSearchVoucherType.Value));
                }

                sb.AddOrder("VoucherID", true);
                string sql = sb.BuildQueryViewString();

                Rms.ORMap.QueryAgent qa     = new QueryAgent();
                EntityData           entity = qa.FillEntityData("Voucher", sql);

                this.dgList.DataSource = entity.CurrentTable;
                this.dgList.DataBind();
                entity.Dispose();
                qa.Dispose();
            }
            catch (Exception ex)
            {
                this.lblMessage.Text = "选择凭证查询出错";
                ApplicationLog.WriteLog(this.ToString(), ex, "选择凭证查询出错");
            }
        }
Ejemplo n.º 2
0
        private void LoadDataGrid()
        {
            try
            {
                VoucherStrategyBuilder sb = new VoucherStrategyBuilder();
                sb.AddStrategy(new Strategy(VoucherStrategyName.ProjectCode, txtProjectCode.Value));

                if (this.ucAccountant.Value != "")
                {
                    sb.AddStrategy(new Strategy(VoucherStrategyName.Accountant, this.ucAccountant.Value));
                }

                if (this.dtbMakeDate0.Value != "" || this.dtbMakeDate1.Value != "")
                {
                    ArrayList ar = new ArrayList();
                    ar.Add(this.dtbMakeDate0.Value);
                    ar.Add(this.dtbMakeDate1.Value);
                    sb.AddStrategy(new Strategy(VoucherStrategyName.MakeDate, ar));
                }

                if (this.sltVoucherType.Value != "")
                {
                    sb.AddStrategy(new Strategy(VoucherStrategyName.VoucherType, this.sltVoucherType.Value));
                }

                if (this.txtVoucherID.Value != "")
                {
                    sb.AddStrategy(new Strategy(VoucherStrategyName.VoucherID, this.txtVoucherID.Value));
                }

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

//				if ( this.sltIsExported.Value != "" )
//					sb.AddStrategy( new Strategy( VoucherStrategyName.IsExported,this.sltIsExported.Value ));

                sb.AddOrder("MakeDate", false);
                sb.AddOrder("VoucherCode", false);
                string sql = sb.BuildQueryViewString();

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

                string[]  arrField = { "TotalMoney" };
                decimal[] arrSum   = BLL.MathRule.SumColumn(entity.CurrentTable, arrField);
                this.dgList.Columns[3].FooterText = arrSum[0].ToString("N");

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

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