private KPIDefineSource Get_DefineInfo() { try { // Nếu trường hợp có chọn KPI thì không lấy DatasourceID mới mà lấy DatasourceID từ KPI đã lưu. // Ngược lại thì lấy DatasourceID theo bên Tab DatasourceSettings. var ret = new KPIDefineSource() { DisplayName = this.txtKPIDisplayName.Text, DatasourceID = this.DSCode_Target, CtrlTypeDefault = Lib.IsNOE(cboCtrlType.Value) ? "" : Lib.NTE(this.cboCtrlType.Value), VisibleTypeDefault = Lib.IsNOE(cboCtrl.Value)? "" : Lib.NTE(cboCtrl.Value).Split('-', StringSplitOptions.RemoveEmptyEntries).LastOrDefault(), MaxValue = double.Parse(this.txtMaxValue.Text), MinValue = double.Parse(this.txtMinValue.Text) }; // Lấy thông tin Dimension. foreach (KPIPartCtrlBase ctrl in this.ctrl_Dimensions.Controls) { if (ctrl == null) { continue; } ret.AddDimension(ctrl.Get_KPIPartInfo()); } // Lấy thông tin Measure. foreach (KPIPartCtrlBase ctrl in this.ctrl_Measures.Controls) { if (ctrl == null) { continue; } ret.AddMeasure(ctrl.Get_KPIPartInfo()); } // Lấy thông tin ContextMetric. foreach (KPIPartCtrlBase ctrl in this.ctrl_ContextMetric.Controls) { if (ctrl == null) { continue; } ret.AddContext(ctrl.Get_KPIPartInfo()); } // Lấy thông tin Filter KPI. foreach (FilterCtrlBase ctrl in this.ctrl_KPIFilters.Controls) { if (ctrl == null) { continue; } ret.AddFilter(ctrl.Get_FilterInfo()); } return(ret); } catch { return(null); } }
private string Get_ValidMsg(KPIDefineSource obj) { var ret = ""; var newLine = "\r\n"; if (obj.Dimensions.Count == 0) { ret += "Dimensions is Required!\r\n"; } if (obj.Measures.Count == 0) { ret += "Measures is Required!\r\n"; } if (ret.EndsWith(newLine)) { ret = ret.Remove(ret.Length - newLine.Length); } return(ret); }
private string Get_ValidMsg(KPIDefineSource obj) { var ret = ""; var newLine = "\r\n"; if (obj.Dimensions.Count == 0) ret += "Dimensions is Required!\r\n"; if (obj.Measures.Count == 0) ret += "Measures is Required!\r\n"; if (ret.EndsWith(newLine)) ret = ret.Remove(ret.Length - newLine.Length); return ret; }
private KPIDefineSource Get_DefineInfo() { try { // Nếu trường hợp có chọn KPI thì không lấy DatasourceID mới mà lấy DatasourceID từ KPI đã lưu. // Ngược lại thì lấy DatasourceID theo bên Tab DatasourceSettings. var ret = new KPIDefineSource() { DisplayName = this.txtKPIDisplayName.Text, DatasourceID = this.DSCode_Target, CtrlTypeDefault = Lib.IsNOE(cboCtrlType.Value) ? "" : Lib.NTE(this.cboCtrlType.Value), VisibleTypeDefault = Lib.IsNOE(cboCtrl.Value) ? "" : Lib.NTE(cboCtrl.Value).Split('-', StringSplitOptions.RemoveEmptyEntries).LastOrDefault(), MaxValue = double.Parse(this.txtMaxValue.Text), MinValue = double.Parse(this.txtMinValue.Text) }; // Lấy thông tin Dimension. foreach (Control ctrl in this.ctrl_Dimensions.Controls) { if (ctrl is KPIPartCtrlBase) { ret.AddDimension((ctrl as KPIPartCtrlBase).Get_KPIPartInfo()); } } // Lấy thông tin Measure. foreach (Control ctrl in this.ctrl_Measures.Controls) { if (ctrl is KPIPartCtrlBase) { ret.AddMeasure((ctrl as KPIPartCtrlBase).Get_KPIPartInfo()); } } // Lấy thông tin ContextMetric. foreach (Control ctrl in this.ctrl_ContextMetric.Controls) { if (ctrl is KPIPartCtrlBase) { ret.AddContext((ctrl as KPIPartCtrlBase).Get_KPIPartInfo()); } } // Lấy thông tin Filter KPI. foreach (Control ctrl in this.ctrl_KPIFilters.Controls) { if (ctrl is FilterCtrlBase) { ret.AddFilter((ctrl as FilterCtrlBase).Get_FilterInfo()); } } return ret; } #if DEBUG catch (Exception ex) { throw ex; } #else catch { return null; } #endif }