Exemple #1
0
        private void LoadData()
        {
            string sYear       = Request["iYear"] + "";
            string projectCode = Request["ProjectCode"] + "";

            if (!Rms.Check.StringCheck.IsInt(sYear))
            {
                this.m_iYear = DateTime.Now.Year;
            }
            else
            {
                this.m_iYear = int.Parse(sYear);
            }

            string sMonth = Request["iMonth"] + "";

            if (!Rms.Check.StringCheck.IsInt(sMonth))
            {
                this.m_Month = DateTime.Now.Month;
            }
            else
            {
                this.m_Month = DateTime.Now.Month;
            }

            // 计算本月最后一天和前一个月份最后一天
            this.m_CurrentMonthLastDate = (new DateTime(this.m_iYear, this.m_Month, 1)).AddMonths(1).AddDays(-1).ToString("yyyy-MM-dd");
            this.m_BeforeMonthLastDate  = (new DateTime(this.m_iYear, this.m_Month, 1)).AddDays(-1).ToString("yyyy-MM-dd");

            this.lblProjectName.Text = BLL.ProjectRule.GetProjectName(projectCode);
            this.lblYear.Text        = this.m_iYear.ToString();
            this.lblMonth.Text       = this.m_Month.ToString();

            try
            {
                this.m_Subject = DAL.EntityDAO.SubjectDAO.GetAllSubject();
                VoucherDetailStrategyBuilder sb = new VoucherDetailStrategyBuilder();
                sb.AddStrategy(new Strategy(VoucherDetailStrategyName.ProjectCode, projectCode));
                string     sql = sb.BuildQueryViewString();
                QueryAgent qa  = new QueryAgent();
                this.m_VoucherDetail = qa.FillEntityData("VoucherDetail", sql);
                qa.Dispose();


                DataRow[] drsFirst = this.m_Subject.CurrentTable.Select("layer=1");
                int       iCount   = drsFirst.Length;
                for (int i = 0; i < iCount; i++)
                {
                    DataRow dr = drsFirst[i];
                    BuildRow(dr);
                }

                this.m_Subject.Dispose();
                this.m_VoucherDetail.Dispose();
            }
            catch (Exception ex)
            {
                ApplicationLog.WriteLog(this.ToString(), ex, "");
            }
        }
Exemple #2
0
        private void LoadDataGrid()
        {
            try
            {
                VoucherDetailStrategyBuilder sb = new VoucherDetailStrategyBuilder();
                sb.AddStrategy(new Strategy(VoucherDetailStrategyName.ProjectCode, txtProjectCode.Value));

                if (this.ParamSubjectCode != "")
                {
                    sb.AddStrategy(new Strategy(VoucherDetailStrategyName.SubjectCodeIncludeAllChild, this.ParamSubjectCode));
                }

                if (this.ParamContractCode != "")
                {
                    sb.AddStrategy(new Strategy(VoucherDetailStrategyName.ContractCode, this.ParamContractCode));
                }

                if (this.ParamPaymentCode != "")
                {
                    sb.AddStrategy(new Strategy(VoucherDetailStrategyName.PaymentCode, this.ParamPaymentCode));
                }

                if (this.ParamCheckDateBegin != "" || this.ParamCheckDateEnd != "")
                {
                    ArrayList ar = new ArrayList();
                    ar.Add(this.ParamCheckDateBegin);
                    ar.Add(this.ParamCheckDateEnd);
                    sb.AddStrategy(new Strategy(VoucherDetailStrategyName.CheckDateRange, ar));
                }

                //已审
                sb.AddStrategy(new Strategy(VoucherDetailStrategyName.Status, "1,2"));

                //仅借方
                sb.AddStrategy(new Strategy(VoucherDetailStrategyName.OnlyDebit));

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

                string sql = sb.BuildQueryViewString();

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

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

                string[]  arrField = { "DebitMoney" };
                decimal[] arrSum   = BLL.MathRule.SumColumn(entity.CurrentTable, arrField);
                ViewState["SumMoney"]  = arrSum[0].ToString("N");
                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));
            }
        }