/// <summary> /// /// </summary> /// <returns></returns> static public DuringWaterCollection CreateDuringWaterCollection() { DuringWaterCollection d = new DuringWaterCollection(); DataTable t = DuringWaterDBI.GetDuringDataTable(); foreach (DataRow row in t.Rows) { DuringWaterClass item = CreateDuringWater(row); d.Add(item); } return(d); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void UCConditionYear1_QueryEvent(object sender, EventArgs e) { int year = this.UCConditionYear1.Year; DuringWaterCollection d = DuringWaterFactory.CreateDuringWaterCollection(); DataTable tbl = this.UCConditionYear1.WaterUser.LowLevelWaterUserCollection.GetMultiDuringAmount(year, d); //this.GridView1.DataSource = tbl; //this.GridView1.DataBind(); H.DataSource = tbl; H.Bind(); this.UCZedChart1.GraphPaneConfig = GetGraphPaneConfig(tbl); this.UCZedChart1.DataSource = tbl; }
/// <summary> /// /// </summary> /// <param name="year"></param> /// <param name="d"></param> public DataTable GetMultiDuringAmount(int year, DuringWaterCollection duringCollection) { DataTable t = CreateDuringDataTable(duringCollection); foreach (WaterUserClass w in this) { foreach (DuringWaterClass d in duringCollection) { DateTime b = new DateTime(year, d.Begin.Month, d.Begin.Day); DateTime e = new DateTime(year, d.End.Month, d.End.Day); double a = w.CalcUsedAmount(b, e); AddDuringWaterValue(t, d, w.Name, a); } } return(t); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Init(object sender, EventArgs e) { if (!IsPostBack) { if (WU != null) { ChannelDataBinder.DataBind(WU, this.DropDownList1); BindStationCheckBoxList(); // fill year // for (int year = DateTime.Now.Year - 10; year < DateTime.Now.Year + 10; year++) { this.ddlYear.Items.Add( new ListItem(year.ToString(), year.ToString()) ); } this.rbYear.Checked = true; this.rbYear_CheckedChanged(this, EventArgs.Empty); } // fill water during // DuringWaterCollection duringWaters = DuringWaterFactory.CreateDuringWaterCollection(); this.ddlWaterDuring.DataSource = duringWaters; this.ddlWaterDuring.DataTextField = "Name"; this.ddlWaterDuring.DataValueField = "ID"; this.ddlWaterDuring.DataBind(); // set default value // this.UCShiDuan1.DuringBegin = YongShuiGuanLiLib.DateTimeHelper.GetYesterday(); this.UCShiDuan1.DuringEnd = YongShuiGuanLiLib.DateTimeHelper.GetYesterday(); this.UCDanRi1.Day = DateTime.Now; } }
/// <summary> /// /// </summary> /// <param name="duringCollection"></param> /// <returns></returns> private DataTable CreateDuringDataTable(DuringWaterCollection duringCollection) { DataTable t = new DataTable(); t.Columns.Add("放水季", typeof(string)); t.Columns.Add("开始日期", typeof(string)); t.Columns.Add("结束日期", typeof(string)); foreach (WaterUserClass w in this) { DataColumn c = t.Columns.Add(w.Name, typeof(double)); c.DefaultValue = 0d; } foreach (DuringWaterClass d in duringCollection) { DataRow r = t.NewRow(); r[0] = d.Name; r[1] = d.BeginString; r[2] = d.EndString; t.Rows.Add(r); } return(t); }