/// <summary> /// /// </summary> /// <returns></returns> private GridViewConfig GetGridViewConfig() { GridViewColumnConfig cc = null; Xdgk.UI.GridViewConfig c = new GridViewConfig(); c.GridViewColumnConfigCollection.AddBoundField("放水季名称", YongShuiGuanLiDBI.DBNames.tblDuringWater.Name); cc = c.GridViewColumnConfigCollection.AddBoundField("开始日期", YongShuiGuanLiDBI.DBNames.tblDuringWater.BeginDT); cc.DataFormatString = "{0:MM}-{0:dd}"; cc = c.GridViewColumnConfigCollection.AddBoundField("结束日期", YongShuiGuanLiDBI.DBNames.tblDuringWater.EndDT); cc.DataFormatString = "{0:MM}-{0:dd}"; return(c); }
//#region H ///// <summary> ///// ///// ///// </summary> //private Xdgk.UI.GridViewHelper H //{ // get // { // if (_h == null) // { // _h = new Xdgk.UI.GridViewHelper(this.GridView1); // if (!_h.IsSetGridViewConfig()) // { // _h.GridViewConfig = GetGridViewConfig(); // } // } // return _h; // } //} Xdgk.UI.GridViewHelper _h; //#endregion //H //#region GetGridViewConfig ///// <summary> ///// ///// </summary> ///// <returns></returns> //private GridViewConfig GetGridViewConfig() //{ // GridViewConfig c = new GridViewConfig(); // return c; //} //#endregion //GetGridViewConfig /// <summary> /// /// </summary> /// <param name="tbl"></param> /// <returns></returns> private GridViewConfig GetGridViewConfig(DataTable tbl) { GridViewConfig cfg = new GridViewConfig(); GridViewColumnConfig colCfg = cfg.GridViewColumnConfigCollection.AddBoundField(strings.DT, "DT"); colCfg.DataFormatString = "{0:yyyy-MM-dd}"; for (int i = 1; i < tbl.Columns.Count; i++) { DataColumn col = tbl.Columns[i]; cfg.GridViewColumnConfigCollection.AddBoundField(col.ColumnName, col.ColumnName); } return(cfg); }
/// <summary> /// /// </summary> /// <returns></returns> private GridViewConfig GetGridViewConfig(DataEnum de, DataTable dataSourceDataTable) { if (dataSourceDataTable == null) { throw new ArgumentNullException("dataSourceDataTable"); } GridViewConfig c = new GridViewConfig(); c.GridViewColumnConfigCollection.AddBoundField(strings.ChannelName, "ChannelName"); c.GridViewColumnConfigCollection.AddBoundField(strings.StationName, "StationName"); c.GridViewColumnConfigCollection.AddBoundField(strings.DT, "DT"); string t = string.Empty; switch (de) { case DataEnum.WL: t = DataTableHelper.GetExistColumnName(dataSourceDataTable, "WL1", "AVGWL"); c.GridViewColumnConfigCollection.AddBoundField(strings.WLWithUnit, t); break; case DataEnum.Flux: t = DataTableHelper.GetExistColumnName(dataSourceDataTable, "InstantFlux", "avgflux"); //c.GridViewColumnConfigCollection.AddBoundField(strings.InstantFlux , "InstantFlux"); GridViewColumnConfig columnConfig = c.GridViewColumnConfigCollection.AddBoundField( strings.InstantFluxWithUnit, t, FormatStringManager.FloatValueFormatString); break; case DataEnum.Amount: t = DataTableHelper.GetExistColumnName(dataSourceDataTable, "DayAmount"); c.GridViewColumnConfigCollection.AddBoundField(strings.AmountWithUnit, t, FormatStringManager.FloatValueFormatString); break; } // // c.AllowSorting = true; return(c); }
/// <summary> /// /// </summary> /// <returns></returns> private GridViewConfig GetGridViewConfig() { GridViewConfig cfg = new GridViewConfig(); cfg.AllowSorting = true; cfg.Caption = "Amount caption"; //GridViewColumnConfig c1 = new GridViewColumnConfig(); //c1.DataTextField = "Amount"; //c1.HeaderText = "h-Amount"; //c1.SortExpression = "Amount"; //c1.GridViewColumnTypeEnum = GridViewColumnTypeEnum.BoundField; cfg.GridViewColumnConfigCollection.AddBoundField("a", "Amount"); GridViewColumnConfig c2 = new GridViewColumnConfig(); c2.DataTextField = "WaterUserName"; c2.HeaderText = "名称"; c2.SortExpression = "WaterUserName"; cfg.GridViewColumnConfigCollection.Add(c2); return(cfg); }