private void RemoveSubDatasetByDataset(Dataset dataset) { foreach (var subDataset in dataset.SubDatasets.ToList()) { TrackManager.Instance.RemoveAllAnnotationsBySubDataset(subDataset); } }
private static void AddCurvesByDataset(Dataset dataset) { foreach (var curveObject in dataset.Curves) { var requiredCharts = IoC.Kernel.Get<IGlobalDataModel>().MainViewModel.Charts.Where(u => u.Tracks != null && u.ChartObject.ID == curveObject.RefChart); var requiredTracks = requiredCharts.SelectMany(u => u.Tracks.Where(v => v.TrackObject.ID == curveObject.RefTrack)); foreach (var track in requiredTracks) { var curve = new Curve { RefChart = curveObject.RefChart, RefTrack = curveObject.RefTrack, RefDataset = dataset.ID, RefProject = dataset.RefProject, RefWell = dataset.RefWell, IsSeriesVisible = true }; var trackObj = HelperMethods.Instance.GetTrackByID(curve.RefTrack); trackObj.Curves.ShouldUndoRedo = false; CurveManager.Instance.AddCurveObject(curve); ///trackObj.Curves.Add(curve); trackObj.Curves.ShouldUndoRedo = true; } } }
public void RemoveDatasetObject(Dataset dataset) { var wellObject = HelperMethods.Instance.GetWellByID(dataset.RefWell); if (wellObject == null) return; RemoveCurvesByDataset(dataset); RemoveSubDatasetByDataset(dataset); wellObject.Datasets.Remove(dataset); }
public DatasetPrintingClass(Dataset dataset, bool includeSpreadsheetData = false) { _includeSpreadsheetData = includeSpreadsheetData; if (dataset == null) return; var ds = GetReportDatasetFromGAPDataset(dataset); Report = new rptDatasetPrinting(); Report.SetDataSource(ds); }
public MaintainDatasetViewModel(string token, Dataset dataset) : base(token) { //if (dataset != null && (!string.IsNullOrWhiteSpace(dataset.DatasetName) && // !string.IsNullOrWhiteSpace(dataset.RefProject) && !string.IsNullOrWhiteSpace(dataset.RefWell))) // InitializeExistingDataset(dataset); //else // InitializeNewDataset(); }
public MaintainSpreadsheetView(Dataset dataSet, bool isEdit) { InitializeComponent(); _dataContext = new MaintainSpreadsheetViewModel(Token, dataSet, isEdit); DataContext = _dataContext; AddKeyBindings<Dataset>(); Closing += MaintainSpreadsheetView_Closing; }
private void GetRows(DataTable dt, Dataset dataset) { foreach (var row in dataset.DepthAndCurves) { DataRow dataRow = dt.NewRow(); dataRow["Depth"] = row.Depth; dataRow["Curve"] = row.Curve; dt.Rows.Add(dataRow); } }
protected override void ReceiveMessage(Helpers.NotificationMessageType messageType) { base.ReceiveMessage(messageType); switch(messageType.MessageType) { case Helpers.NotificationMessageEnum.SelectDataset: SelectedDataset = messageType.MessageObject as Dataset; Close(); break; } }
private void RemoveCurvesByDataset(Dataset dataset) { var curves = HelperMethods.Instance.GetCurvesByDatasetID(dataset.ID); while (curves.Any()) { var curve = curves.First(); var track = HelperMethods.Instance.GetTrackByID(curve.RefTrack); track.Curves.ShouldUndoRedo = false; CurveManager.Instance.RemoveCurveObject(curve); track.Curves.ShouldUndoRedo = true; } }
private void GetRowsExtended(DataTable dt, Dataset dataset) { foreach (var row in dataset.DepthAndCurves) { DataRow dataRow = dt.NewRow(); dataRow["Depth"] = row.Depth; dataRow["Curve"] = row.Curve; dataRow["Project"] = HelperMethods.Instance.GetProjectByID(dataset.RefProject).Name; dataRow["Well"] = HelperMethods.Instance.GetWellByID(dataset.RefWell).Name; dataRow["Dataset"] = dataset.Name; dt.Rows.Add(dataRow); } }
public DatasetViewModel(string token) : base(token) { Initialization(); CurrentObject = new Dataset(); Projects = HelperMethods.Instance.ProjectsWithWells(); if (Projects.Any()) SelectedProject = Projects.First(); Title = IoC.Kernel.Get<IResourceHelper>().ReadResource("NewDataset"); SelectedFamily = Families.First(); }
public DatasetViewModel(string token, Dataset dataset) : base(token) { Initialization(); OriginalObject = dataset; Title = IoC.Kernel.Get<IResourceHelper>().ReadResource("EditDataset"); Projects = new[] { HelperMethods.Instance.GetProjectByID(dataset.RefProject) }; if (Projects.Any()) SelectedProject = Projects.First(); Wells = new[] { HelperMethods.Instance.GetWellByID(dataset.RefWell) }; if (Wells.Any()) SelectedWell = Wells.First(); CurrentObject = HelperMethods.GetNewObject<Dataset>(dataset); string units = CurrentObject.Units; //upon setting family we'll lose the value of units SelectedFamily = Families.SingleOrDefault(u => u.FamilyName == CurrentObject.Family); if (SelectedFamily != null) SelectedUnit = units; CurrentObject.ObjectChanged += CurrentObject_ObjectChanged; }
public EquationViewModel(string token) : base(token) { CurrentObject = new Dataset(); Operators = new List<string>(); Operators.Add("Addition"); Operators.Add("Subtraction"); Operators.Add("Multiplication"); Operators.Add("Division"); Operators.Add("Log Number"); Equations = new ObservableCollection<EquationInfo>(); Equations.CollectionChanged += Equations_CollectionChanged; var newEquation = new EquationInfo(Equations.Count); Equations.Add(newEquation); newEquation.OperandChanged += equation_OperandChanged; _allDatasets = HelperMethods.Instance.GetFilteredDatasets(u => u.Units == "API"); Operand1 = new List<BaseEntity>(); foreach (var dataset in _allDatasets) { var well = HelperMethods.Instance.GetWellByID(dataset.RefWell).Name; string name = string.Format("{0}/{1}", well, dataset.Name); Operand1.Add(new BaseEntity { ID = dataset.ID, Name = name }); Operand2.Add(new BaseEntity { ID = dataset.ID, Name = name }); } if (Families.Any()) SelectedFamily = Families.First(); ViewSpreadsheet = false; CalculationContent = new FlowDocument(); }
private DataTable GetDataTableFromDataset(Dataset dataset) { DataTable dtDataset = CreateDatasetTable(); AddDataRowFromDatasetToDataTable(dataset, dtDataset); return dtDataset; }
//private DataTable GetBlankDataTableForCompany() //{ // DataTable dt = new DataTable(); // dt.Columns.Add(new DataColumn("CompanyName")); // dt.Columns.Add(new DataColumn("DatasetName")); // dt.Columns.Add(new DataColumn("WellName")); // dt.Columns.Add(new DataColumn("ProjectName")); // dt.Columns.Add(new DataColumn("Family")); // dt.Columns.Add(new DataColumn("Units")); // dt.Columns.Add(new DataColumn("MinUnitValue")); // dt.Columns.Add(new DataColumn("MaxUnitValue")); // dt.Columns.Add(new DataColumn("TVDMD")); // dt.Columns.Add(new DataColumn("LineStyle")); // dt.Columns.Add(new DataColumn("LineColor")); // dt.Columns.Add(new DataColumn("Grossor")); // dt.Columns.Add(new DataColumn("MarkerStyle")); // dt.Columns.Add(new DataColumn("MarkerColor")); // dt.Columns.Add(new DataColumn("MarkerSize")); // dt.Columns.Add(new DataColumn("BorderColor")); // return dt; //} private void AddDataRowFromDatasetToDataTable(Dataset dataset, DataTable dtDataset) { DataRow row = dtDataset.NewRow(); row["CompanyName"] = GlobalData.CompanyName; row["DatasetName"] = dataset.Name; row["WellName"] = HelperMethods.Instance.GetWellByID(dataset.RefWell).Name; row["ProjectName"] = HelperMethods.Instance.GetProjectByID(dataset.RefProject).Name; row["Family"] = dataset.Family; row["Units"] = dataset.Units; row["MinUnitValue"] = dataset.MinUnitValue; row["MaxUnitValue"] = dataset.MaxUnitValue; row["TVDMD"] = dataset.IsTVD ? "TVD" : "MD"; row["LineStyle"] = DatasetLineStyle(dataset.LineStyle); row["LineColor"] = "#" + dataset.LineColor.R.ToString("X2") + dataset.LineColor.G.ToString("X2") + dataset.LineColor.B.ToString("X2"); row["Grossor"] = DatasetLineGrossor(dataset.LineGrossor); row["MarkerStyle"] = DatasetMarkerStyle(dataset.MarkerStyle); row["MarkerColor"] = "#" + dataset.MarkerColor.R.ToString("X2") + dataset.MarkerColor.G.ToString("X2") + dataset.MarkerColor.B.ToString("X2"); row["MarkerSize"] = dataset.MarkerSize; row["BorderColor"] = dataset.ShouldApplyBorderColor.Value.ToString(); dtDataset.Rows.Add(row); }
private void DatasetPropertiesScreen(Dataset dataset) { new DatasetView(dataset).ShowDialog(); }
private NumericAxis GetNewXAxisAndSetVisibleRangeLimit(Dataset dataset) { double minValueXAxis, maxValueXAxis; minValueXAxis = GlobalDataModel.GetValidMinUnitValue(dataset); maxValueXAxis = Convert.ToDouble(dataset.MaxUnitValue); var xAxis = new NumericAxis { DrawLabels = false, DrawMajorBands = false, DrawMajorGridLines = false, DrawMajorTicks = false }; xAxis.VisibleRange = new DoubleRange(minValueXAxis, maxValueXAxis); xAxis.VisibleRangeLimit = new DoubleRange(minValueXAxis, maxValueXAxis); return xAxis; }
public void AddExistingSubDatasetToTrack(TrackToShow trackToShow, Dataset dataset, CurveToShow curveToShow) { if (dataset.SubDatasets.Any()) { foreach (var subdataset in dataset.SubDatasets) { curveToShow.SubDatasets.Add(subdataset); foreach (var annotation in subdataset.Annotations) { var lineAnnotation = HelperMethods.Instance.GetLineAnnotationByAnnotationInfoAndSubDataset(annotation, subdataset, curveToShow); curveToShow.LineAnnotationExtendedBinding(lineAnnotation); lineAnnotation.Id = annotation.ID; trackToShow.Annotations.Add(lineAnnotation); } } } }
public void AddDatasetObject(Dataset dataset) { var wellObject = HelperMethods.Instance.GetWellByID(dataset.RefWell); wellObject.Datasets.Add(dataset); AddCurvesByDataset(dataset); }
private static bool CreateDatasetObject(XmlNodeList nodes) { Dataset dataset = new Dataset(); foreach (XmlElement node in nodes) { switch (node.LocalName) { case "mnemonic": if (string.IsNullOrWhiteSpace(node.InnerText)) { SendMessage("Empty name found for dataset in xml file"); return false; } dataset.Name = node.InnerText; break; case "columnIndex": int intVar = 0; if (!Int32.TryParse(node.InnerText, out intVar)) { SendMessage("Empty column index for dataset in xml file"); return false; } dataset.DisplayIndex = intVar; break; } } lstDatasets.Add(dataset); return true; }
/// <summary> /// get GAP dataset and return ADO.Net dataset /// </summary> /// <param name="dataset"></param> /// <returns></returns> public DataSet GetReportDatasetFromGAPDataset(Dataset dataset) { var dt = GetDataTableFromDataset(dataset); dt.TableName = "Dataset"; DataSet ds = new DataSet(); ds.DataSetName = "DatasetPrinting"; ds.Tables.Add(dt); DataTable dtCurves = GetDepthCurvesTable(); dtCurves.TableName = "DepthCurves"; if (_includeSpreadsheetData) GetRows(dtCurves, dataset); ds.Tables.Add(dtCurves); ds.WriteXmlSchema("DatasetPrintingSchema.xsd"); return ds; }
/// <summary> /// this information is helpful while getting information about curves while restoring a dataset in undo redo process /// </summary> /// <param name="curve"></param> /// <param name="dataset"></param> private static void AddCurveInformationInDataset(Curve curve, Dataset dataset) { if (!dataset.Curves.Any(u => u.RefChart == curve.RefChart && u.RefTrack == curve.RefTrack)) { dataset.Curves.Add(new DatasetCurveInfo { RefChart = curve.RefChart, RefTrack = curve.RefTrack }); } }
private static void AddSubDatasetAnnotationsToSelectedChart(SubDataset subDataset, Dataset dataset) { foreach (var track in IoC.Kernel.Get<IGlobalDataModel>().MainViewModel.SelectedChart.Tracks) { var curveToShow = track.Curves.SingleOrDefault(u => u.RefDataset == dataset.ID); if (curveToShow != null) { CurveManager.Instance.AddExistingSubDatasetToTrack(track, dataset, curveToShow); } } }