protected void popFilterMenu_Click(object sender, DevExpress.Web.ASPxMenu.MenuItemEventArgs e) { String filterType = e.Item.Name; FilterCtrlBase ctl = GenerateFilterControl(filterType, String.Empty); m_Filters.Add(new FilterControlInfo(ctl) { Type = filterType }); }
protected void cbDataSource_ValueChanged(object sender, EventArgs e) { Cleanup(); // re-init information ASPxComboBox cb = (ASPxComboBox)sender; object selectedItemValue = cb.SelectedItem != null ? cb.SelectedItem.Value : null; if (selectedItemValue != null) { m_DSCode = selectedItemValue.ToString(); lsttbl_DashboardSource datasource = MyBI.Me.Get_DashboardSourceBy(m_DSCode); if (datasource != null) { MySession.DSDefine_CurEditing = datasource.Code; txtDataSourceName.Text = datasource.NameEN; if (datasource.WHCode != Lib.NTE(cbDataWarehouse.Value)) { cbDataWarehouse.Value = datasource.WHCode; } InqDefineSourceMDX inq = datasource.JsonObjMDX; Helpers.SetDataSource(lbSelectedFields, inq.Fields, "UniqueName", "Caption"); Helpers.SetDataSource(lbSelectedMetricFields, inq.Summaries, "UniqueName", "Caption"); foreach (InqFilterInfoMDX filter in inq.Filters) { FilterCtrlBase ctrl = GenerateFilterControl(filter.FilterType, String.Empty); ctrl.Set_Info(filter); m_Filters.Add(new FilterControlInfo(ctrl) { Type = filter.FilterType }); } } } else { m_DSCode = String.Empty; } // refress kpi tab if (!IsPostBack && MyPage != null) { MyPage.My_wcKPISetting.DSCode = m_DSCode; //MyPage.My_wcKPISetting.Raise_OnChange(String.Empty, EventArgs.Empty); } }
private FilterCtrlBase Add_FilterControl(string type, bool isReCreate) { if (string.IsNullOrEmpty(type)) { type = "NORMAL"; } var guiID = Guid.NewGuid().ToString(); FilterCtrlBase ctrl = null; var whCode = this.MyPage.WHCode; var tblFactNames = MyBI.Me.Get_DWTableName("FACT", whCode); var ds = MyBI.Me.Get_DWColumn(whCode); var dsField = new List <lsttbl_DWColumn>(); // ReCreate... if (isReCreate) { foreach (var obj in this.CtrlKPIFilterIDs) { var arr = obj.Split(',', StringSplitOptions.RemoveEmptyEntries); var ctrlID = arr.First(); var ctrlType = arr.Last(); if (ctrlType == "NUM") { ctrl = this.LoadControl("wcNumFilter.ascx") as wcNumFilter; dsField = ds.Where(p => p.Visible && tblFactNames.Contains(p.TblName_Virtual) && p.DataType == "NUM").ToList(); } else if (ctrlType == "DATE") { ctrl = this.LoadControl("wcTimeFilter.ascx") as wcTimeFilter; dsField = ds.Where(p => p.Visible && p.TblName_Virtual.Contains("DimTime")).ToList(); } else { ctrl = this.LoadControl("wcNormalFilter.ascx") as wcNormalFilter; dsField = ds.Where(p => p.Visible && p.DataType != "NUM" && p.DataType != "DATE").ToList(); } ctrl.ID = ctrlID; ctrl.OnRemove += this.FilterCtrl_Remove; ctrl.Set_Source(dsField, "KeyField", "ColAliasVI"); this.ctrl_KPIFilters.Controls.Add(ctrl); } return(null); } // Add new... if (type == "NUM") { ctrl = this.LoadControl("wcNumFilter.ascx") as wcNumFilter; dsField = ds.Where(p => p.Visible && tblFactNames.Contains(p.TblName_Virtual) && p.DataType == "NUM" ).ToList(); } else if (type == "DATE") { ctrl = this.LoadControl("wcTimeFilter.ascx") as wcTimeFilter; dsField = ds.Where(p => p.Visible && p.TblName_Virtual.Contains("DimTime")).ToList(); } else // normal { ctrl = this.LoadControl("wcNormalFilter.ascx") as wcNormalFilter; dsField = ds.Where(p => p.Visible && p.DataType != "NUM" && p.DataType != "DATE" ).ToList(); } ctrl.ID = string.Format("gen_{1}_{0}_{1}", guiID, type); ctrl.OnRemove += this.FilterCtrl_Remove; ctrl.Set_Source(dsField, "KeyField", "ColAliasVI"); this.ctrl_KPIFilters.Controls.Add(ctrl); this.CtrlKPIFilterIDs.Add(string.Format("{0},{1}", ctrl.ID, type)); return(ctrl); }