public void UpdateDatasets() { Datasets.Clear(); foreach (var info in m_analysis.MetaData.Datasets) { var viewmodel = new DatasetInformationViewModel(info); Datasets.Add(viewmodel); } }
public BlobUtilities GetBlob(string datasetName) { Dataset dataset = Datasets.Single(x => x.Name == datasetName); AzureBlobDataset outputProps = (AzureBlobDataset)dataset.Properties.TypeProperties; AzureStorageLinkedService outputLinkedService = LinkedServices.First(x => x.Name == dataset.Properties.LinkedServiceName).Properties.TypeProperties as AzureStorageLinkedService; string outputConnectionString = outputLinkedService?.ConnectionString; BlobUtilities outputBlob = new BlobUtilities(Logger, outputConnectionString, outputProps.FolderPath); return(outputBlob); }
public void PrepareData() { mnist = MnistDataSet.read_data_sets("mnist", one_hot: true, train_size: train_size, validation_size: validation_size, test_size: test_size); full_data_x = mnist.train.images; // download graph meta data string url = "https://raw.githubusercontent.com/SciSharp/TensorFlow.NET/master/graph/kmeans.meta"; Web.Download(url, "graph", "kmeans.meta"); }
private void NewDatabtn_Click(object sender, EventArgs e) { data.Clear(); Datasets.DataSource = null; Datasets.Rows.Clear(); Datasets.Refresh(); features_Extract.AddHeader(data); Datasets.DataSource = data; }
private async Task CheckArguments() { await Task.Run(() => { var parser = new ArgumentParser(); parser.Check("log", () => { Log.Instance.ShouldSave = true; }); parser.Check("title", (arg) => { SimObjectTitle = arg; log.Info(string.Format("Title argument: {0}", arg)); }); parser.Check("confidence", (arg) => { int val = 0; int.TryParse(arg, out val); if (val > 100) { MinimumConfidence = 100; } else if (val < 0) { MinimumConfidence = 0; } else { MinimumConfidence = val; } log.Info(string.Format("Confidence argument: {0} parsed: {1}", arg, MinimumConfidence)); }); parser.Check("download", (arg) => { log.Info(string.Format("Download argument: {0}", arg)); if (Datasets.ContainsKey(arg)) { SelectedDatasetUrl = Datasets[arg]; } else { log.Warning(string.Format("Unknown dataset: \"{0}\". Defaulting to World.", arg)); } activeFires.LoadData(SelectedDatasetUrl); OnPropertyChanged("TotalFiresCount"); }); parser.Check("connect", () => { log.Info(string.Format("Connect argument")); log.Info(string.Format("Minimum detection confidence: {0}%", MinimumConfidence)); if (SimInfo.Instance.IncompatibleFSXRunning) { throw new NotSupportedException("FS Active Fires is only compatible with Microsoft Flight Simulator X: Acceleration and SP2."); } sc.AddLocations(SimObjectTitle, activeFires.hotspots.Where(x => x.Confidence >= MinimumConfidence)); sc.Connect(); }); }); }
/// <summary> /// Adds a new dataset to the chart. /// </summary> /// <param name="datasets">Data set(s).</param> public async Task AddDataSet(params TDataSet[] datasets) { dirty = true; Datasets.AddRange(datasets); if (initialized) { await JSModule.AddDataSet(ElementId, datasets); } }
/// <summary> /// Adds new datasets and then update the chart. /// </summary> /// <param name="datasets">List of datasets.</param> /// <returns>A task that represents the asynchronous operation.</returns> public async Task AddDatasetsAndUpdate(params TDataSet[] datasets) { dirty = true; Datasets.AddRange(datasets); if (initialized) { await JS.AddDatasetsAndUpdate(JSRuntime, ElementId, datasets); } }
/// <summary> /// Removed the dataset at the specified index. /// </summary> /// <param name="dataSetIndex">Index of the dataset in the data list.</param> /// <returns>A task that represents the asynchronous operation.</returns> public async Task RemoveDataSet(int dataSetIndex) { dirty = true; Datasets.RemoveAt(dataSetIndex); if (initialized) { await JSModule.RemoveDataSet(ElementId, dataSetIndex); } }
private void Start() { datasets = GameObject.Find("Dataset").GetComponent <Datasets>(); eggList = datasets.EggList; if (eggList == null) { Debug.Log("egg list is null"); } Debug.Log(eggList.Count); Debug.Log(String.Join(", ", eggList.ToArray())); setEggPlate(); }
/// <summary> /// Adds new set of labels and datasets and then update the chart. /// </summary> /// <param name="labels">List of labels.</param> /// <param name="datasets">List of datasets.</param> /// <returns>A task that represents the asynchronous operation.</returns> public async Task AddLabelsDatasetsAndUpdate(IReadOnlyCollection <object> labels, params TDataSet[] datasets) { dirty = true; Labels.AddRange(labels); Datasets.AddRange(datasets); if (initialized) { await JSModule.AddLabelsDatasetsAndUpdate(ElementId, labels, datasets); } }
/// <summary> /// Clears all the labels and data from the chart. /// </summary> /// <returns>A task that represents the asynchronous operation.</returns> public async Task Clear() { dirty = true; Labels.Clear(); Datasets.Clear(); if (initialized) { await JSModule.Clear(ElementId); } }
/// <summary> /// Initializes a new instance of <see cref="Workspace"/> for a given <see cref="Token"/> with a given <see cref="ICommunication"/> /// </summary> /// <param name="token"><see cref="Token">Access token to use</see></param> /// <param name="communication"><see cref="ICommunication"/> to use</param> public Workspace(Token token, ICommunication communication) { _communication = communication; Groups = new Groups(token, communication); Datasets = new Datasets(token, communication); Tables = new Tables(token, communication); Rows = new Rows(token, communication); Dashboards = new Dashboards(token, communication); Reports = new Reports(token, communication); Tiles = new Tiles(token, communication); }
/// <summary> /// Clears all the labels and data from the chart. /// </summary> /// <returns>A task that represents the asynchronous operation.</returns> public async Task Clear() { dirty = true; Labels.Clear(); Datasets.Clear(); if (initialized) { await JS.Clear(JSRuntime, ElementId); } }
public PBIDataset GetDatasetByName(string name) { try { return(Datasets.Single(x => string.Equals(x.Name, name, StringComparison.InvariantCultureIgnoreCase))); } catch (Exception e) { //return null; throw new KeyNotFoundException(string.Format("No Dataset with name '{0}' could be found in PowerBI!", name), e); } }
public void PrepareData() { mnist = MNIST.read_data_sets("mnist", one_hot: true); (x_train, y_train) = (mnist.train.data, mnist.train.labels); (x_valid, y_valid) = (mnist.validation.data, mnist.validation.labels); (x_test, y_test) = (mnist.test.data, mnist.test.labels); print("Size of:"); print($"- Training-set:\t\t{len(mnist.train.data)}"); print($"- Validation-set:\t{len(mnist.validation.data)}"); print($"- Test-set:\t\t{len(mnist.test.data)}"); }
public void PrepareData() { mnist = MnistModelLoader.LoadAsync(".resources/mnist", oneHot: true, showProgressInConsole: true).Result; (x_train, y_train) = (mnist.Train.Data, mnist.Train.Labels); (x_valid, y_valid) = (mnist.Validation.Data, mnist.Validation.Labels); (x_test, y_test) = (mnist.Test.Data, mnist.Test.Labels); print("Size of:"); print($"- Training-set:\t\t{len(mnist.Train.Data)}"); print($"- Validation-set:\t{len(mnist.Validation.Data)}"); print($"- Test-set:\t\t{len(mnist.Test.Data)}"); }
public void BenchmarkEval() { var rand = new Random(Seed); int numColumns = 100; var pms = new Parameters(); pms.Objective.Objective = ObjectiveType.Binary; pms.Dataset.MaxBin = 63; pms.Learning.LearningRate = 1e-3; pms.Learning.NumIterations = 1000; pms.Common.DeviceType = DeviceType.CPU; var categorical = new Dictionary <int, int>(); // i.e., no cat var trainData = CreateRandomDenseClassifyData(rand, 2, ref categorical, pms.Dataset.UseMissing, numColumns); DataDense validData = null; pms.Dataset.CategoricalFeature = categorical.Keys.ToArray(); using (var datasets = new Datasets(pms.Common, pms.Dataset, trainData, validData)) using (var trainer = new BinaryTrainer(pms.Learning, pms.Objective)) { var model = trainer.Train(datasets); output.WriteLine($"MaxNumTrees={model.Managed.MaxNumTrees}"); var timer = System.Diagnostics.Stopwatch.StartNew(); model.Native.GetOutputs(trainData.Features); var elapsed1 = timer.Elapsed; output.WriteLine($"EvalNativeMulti={elapsed1.TotalMilliseconds}"); timer.Restart(); foreach (var row in trainData.Features) { trainer.Evaluate(Booster.PredictType.Normal, row); } var elapsed2 = timer.Elapsed; output.WriteLine($"EvalNativeSingle={elapsed2.TotalMilliseconds}"); foreach (var maxThreads in new int[] { 1, 2, 4, 8, 16, 32, Environment.ProcessorCount }) // { model.Managed.MaxThreads = maxThreads; timer.Restart(); foreach (var row in trainData.Features) { double output = 0; var input = new VBuffer <float>(row.Length, row); model.Managed.GetOutput(ref input, ref output); } var elapsed3 = timer.Elapsed; output.WriteLine($"MaxThreads={maxThreads} EvalManaged={elapsed3.TotalMilliseconds}"); } } }
public void PrepareData() { Directory.CreateDirectory(Name); mnist = MnistModelLoader.LoadAsync(".resources/mnist", oneHot: true, showProgressInConsole: true).Result; (x_train, y_train) = Reformat(mnist.Train.Data, mnist.Train.Labels); (x_valid, y_valid) = Reformat(mnist.Validation.Data, mnist.Validation.Labels); (x_test, y_test) = Reformat(mnist.Test.Data, mnist.Test.Labels); Console.WriteLine("Size of:"); Console.WriteLine($"- Training-set:\t\t{mnist.Train.Data.Shape.Size}"); Console.WriteLine($"- Validation-set:\t{mnist.Validation.Data.Shape.Size}"); }
public async Task <Datasets> DeleteDatasets(Guid id) { Datasets datasets = await db.Datasets.FindAsync(id); if (datasets == null) { return(null); //return NotFound(); } db.Datasets.Remove(datasets); await db.SaveChangesAsync(); return(datasets); }
public T GetDataset <T>(string name) where T : class { int datasetCount = Datasets.Count(x => x.Name == name); if (datasetCount == 0) { throw new Exception($"The dataset '{name}' was not found."); } if (datasetCount > 1) { throw new Exception($"More than one datasets with name '{name}' were found. Only one should exist."); } return(Datasets.First(x => x.Name == name).Properties.TypeProperties as T); }
public IActionResult DeleteDataset(Datasets _datasets) { try { var datasets = _CLRCP_MASTERContext.Datasets.Where(e => e.DatasetId == _datasets.DatasetId).FirstOrDefault(); _CLRCP_MASTERContext.Datasets.Remove(datasets); _CLRCP_MASTERContext.SaveChanges(); return(Ok(true)); } catch (Exception) { return(BadRequest(false)); } }
// 최초 오브젝트 생성 void Start() { datasets = GameObject.Find("Dataset").GetComponent <Datasets>(); chickList = datasets.ChickList; for (int i = 0; i < ObjectList.transform.childCount; ++i) { if (chickList.Contains(ObjectList.transform.GetChild(i).GetComponent <ObjectValue>().objectValue)) { GameObject obj = Instantiate(ObjectList.transform.GetChild(i).gameObject); obj.transform.SetParent(MyObjectList.transform); obj.transform.position = getPosition(); obj.GetComponent <Object_Moving>().isMoving = true; obj.SetActive(true); } } }
//获取天际线 private void btn_GetSkyline_Click(object sender, EventArgs e) { try { if (m_skyline != null) { GeoLine3D line3D = m_skyline.GetSkyline(); if (m_workspace.Datasources.Count == 0) { MessageBox.Show("请先打开一个数据源"); return; } Datasource datasource = m_workspace.Datasources[0]; Datasets datasets = datasource.Datasets; String datasetName = "NewLine3D"; if (datasource.Datasets.Contains(datasetName)) { datasource.Datasets.Delete(datasetName); } DatasetVectorInfo datasetInfo = new DatasetVectorInfo(); datasetInfo.Type = DatasetType.Line3D; datasetInfo.Name = datasetName; datasetInfo.EncodeType = EncodeType.None; DatasetVector newDataset = datasource.Datasets.Create(datasetInfo); if (newDataset == null) { MessageBox.Show("创建三维面数据集失败!"); } if (m_sceneControl.Scene.Type == SceneType.Globe) { newDataset.PrjCoordSys = new PrjCoordSys(PrjCoordSysType.EarthLongitudeLatitude); } Recordset recordset = newDataset.GetRecordset(false, CursorType.Dynamic); recordset.AddNew(line3D); recordset.Update(); recordset.Dispose(); } } catch (System.Exception ex) { Console.Write(ex.Message); } }
public override void PrepareData() { mnist = MnistModelLoader.LoadAsync(".resources/mnist", oneHot: true, showProgressInConsole: true).Result; (x_train, y_train) = (mnist.Train.Data, mnist.Train.Labels); (x_valid, y_valid) = (mnist.Validation.Data, mnist.Validation.Labels); (x_test, y_test) = (mnist.Test.Data, mnist.Test.Labels); y_valid = np.argmax(y_valid, axis: 1); x_valid = x_valid.reshape(-1, n_steps, n_inputs); y_test = np.argmax(y_test, axis: 1); x_test = x_test.reshape(-1, n_steps, n_inputs); print("Size of:"); print($"- Training-set:\t\t{len(mnist.Train.Data)}"); print($"- Validation-set:\t{len(mnist.Validation.Data)}"); print($"- Test-set:\t\t{len(mnist.Test.Data)}"); }
public IPTConfigReader(string path) { var xmlSerializer = new XmlSerializer(typeof(cpu)); var deserialize = (cpu)xmlSerializer.Deserialize(File.OpenRead(path)); foreach (cpuBusinterfacelist o in deserialize.Items.Where(i => i is cpuBusinterfacelist)) { foreach (cpuBusinterfacelistBusinterface businterface in o.Businterface) { Telegrams.AddRange(businterface.Telegram); } } foreach (cpuDatasetlist cpuDatasetlist in deserialize.Items.Where(i => i is cpuDatasetlist)) { Datasets.AddRange(cpuDatasetlist.Dataset); } }
public IActionResult EditDataset(Datasets _datasets) { try { var datasets = _CLRCP_MASTERContext.Datasets.Where(e => e.DatasetId == _datasets.DatasetId).FirstOrDefault(); datasets.Name = _datasets.Name; datasets.Description = _datasets.Description; datasets.MaxCollectionUsers = _datasets.MaxCollectionUsers; datasets.MaxValidationUsers = _datasets.MaxValidationUsers; _CLRCP_MASTERContext.SaveChanges(); return(Ok(true)); } catch (Exception) { return(BadRequest(false)); } }
/// <summary> /// Adds the list of input files into the analysis configuration. /// </summary> public List <DatasetInformation> AddDatasets(List <DatasetInformation> datasets) { Analysis.MetaData.Datasets.AddRange(datasets); for (int i = 0; i < Analysis.MetaData.Datasets.Count; i++) { Analysis.MetaData.Datasets[i].DatasetId = i; } foreach ( var infoViewModel in datasets.Select(info => new DatasetInformationViewModel(info))) { infoViewModel.Selected += info_Selected; Datasets.Add(infoViewModel); } return(datasets); }
private void CreateDataset_Click(object sender, RoutedEventArgs e) { Workspace workspace = null; DatasourceConnectionInfo info = null; try { Toolkit.SetDtNameAsTableName(true); var datasetName = "test222"; workspace = new Workspace(); info = new DatasourceConnectionInfo(); Datasource datasource = GetDbDatasource(workspace, info); Datasets datasets = datasource.Datasets; if (!datasets.IsAvailableDatasetName(datasetName)) { datasets.Delete(datasetName); } DatasetVectorInfo vectorInfo = new DatasetVectorInfo(); vectorInfo.Name = datasetName; vectorInfo.Type = DatasetType.Point; var result = datasets.Create(vectorInfo); if (result != null) { MessageBox.Show("添加数据集成功"); } } catch (Exception ex) { throw ex; } finally { if (info != null) { info.Dispose(); } if (workspace != null) { workspace.Dispose(); } } }
public double?GetData(string assetName, int timeframe, string dataName, int offset = 1) { if (!Datasets.ContainsKey(timeframe) || !Assets.ContainsKey(assetName) || !Assets[assetName].Data.ContainsKey(timeframe)) { return(null); } //get the open time of the bar with the passed offset Bar bar = Datasets[timeframe][offset]; if (!Assets[assetName].Data[timeframe].Data.ContainsKey(bar.OpenTime)) { return(null); } //the Data object will have the corresponding data in a dictionary with the key as the bar open time //look this up and return it. return(Assets[assetName].Data[timeframe].Data[bar.OpenTime][dataName]); }
public async Task <string> PostDatasets(string user, Datasets dataset) { var org = db.UserBase.Where(u => u.Email == user).Select(u => u.Organization).FirstOrDefault(); var uid = await db.Users.Where(u => u.Email == user).Select(u => u).FirstOrDefaultAsync();//await _userManager.FindByEmailAsync(user); Datasets datasets = new Datasets() { ApprovalStatus = dataset.ApprovalStatus, Category = dataset.Category, Description = dataset.Description, FileUrl = dataset.FileUrl, IsDataOpen = dataset.IsDataOpen, isDeleted = false, isPromoOn = false, Name = dataset.Name, Organization = org, //dataset.Organization, Price = dataset.Price, TransactionID = new Guid(), UploadedDate = DateTime.Now, Id = uid.Id }; db.Datasets.Add(datasets); try { await db.SaveChangesAsync(); return("success"); } catch (DbUpdateException) { if (DatasetsExists(datasets.TransactionID)) { return("Conflict"); //Conflict(); } else { throw; } } }
/// <summary> /// Removes all selected items. /// </summary> private void RemoveSelected() { var datasets = Datasets.Where(dataset => dataset.IsSelected).ToList(); foreach (var dataset in datasets) { Datasets.Remove(dataset); Analysis.MetaData.Datasets.Remove(dataset.Dataset); } var id = 0; foreach (var info in Datasets) { info.DatasetId = id++; } OnPropertyChanged("SelectedCount"); }
public int Create(DataRow r, DataRow observacion, Datasets.Ticket_Prestador.TICKET_PRESTADORESDataTable Prestadores) { int result = 0; DBRepository repository = DBRepository.GetDbRepository(true); repository.BeginTransaction(); try { List<IDbDataParameter> paramList = new List<IDbDataParameter>(); Datasets.Tickets.TICKETSDataTable dtable = (Datasets.Tickets.TICKETSDataTable)r.Table; Datasets.Tickets.TICKETSRow dr = (Datasets.Tickets.TICKETSRow)r; paramList.Add(repository.DbFactory.getDataParameter("P_IDAFILIADO", DbType.Int32, Int32.Parse(dr[dtable.IDAFILIADOColumn].ToString()))); paramList.Add(repository.DbFactory.getDataParameter("P_IDOPERADOR", DbType.Int32, Int32.Parse(dr[dtable.IDOPERADORColumn].ToString()))); paramList.Add(repository.DbFactory.getDataParameter("P_ID_PAIS_ORIGEN", DbType.Int32, Dataservices.IntNUlleable(Int32.Parse(dr[dtable.IDPAIS_ORIGENColumn].ToString())))); paramList.Add(repository.DbFactory.getDataParameter("P_ID_PROV_ORIGEN", DbType.Int32, Dataservices.IntNUlleable(Int32.Parse(dr[dtable.IDPROVINCIA_ORIGENColumn].ToString())))); paramList.Add(repository.DbFactory.getDataParameter("P_CIUDAD_ORIGEN", DbType.Int32, Dataservices.IntNUlleable(Int32.Parse(dr[dtable.IDCIUDAD_ORIGENColumn].ToString())))); paramList.Add(repository.DbFactory.getDataParameter("P_ID_PAIS_DESTINO", DbType.Int32, Dataservices.IntNUlleable(Int32.Parse(dr[dtable.IDPAIS_DESTINOColumn].ToString())))); paramList.Add(repository.DbFactory.getDataParameter("P_ID_PROV_DEST", DbType.Int32, Dataservices.IntNUlleable((Int32.Parse(dr[dtable.IDPROVINCIA_DESTINOColumn].ToString()))))); paramList.Add(repository.DbFactory.getDataParameter("P_CIUDAD_DEST", DbType.Int32, Dataservices.IntNUlleable((Int32.Parse(dr[dtable.IDCIUDAD_DESTINOColumn].ToString()))))); //paramList.Add(repository.DbFactory.getDataParameter("P_IDPRESTADOR", DbType.Int32, Dataservices.IntNUlleable((Int32.Parse(dr[dtable.IDPRESTADORColumn].ToString()))))); paramList.Add(repository.DbFactory.getDataParameter("P_TELEFONO", DbType.String, dr[dtable.TELEFONOColumn].ToString())); paramList.Add(repository.DbFactory.getDataParameter("P_IDESTADO", DbType.Int32, Int32.Parse(dr[dtable.IDESTADOColumn].ToString()))); paramList.Add(repository.DbFactory.getDataParameter("P_CALLE_ORIGEN", DbType.String, dr[dtable.CALLE_ORIGENColumn].ToString())); paramList.Add(repository.DbFactory.getDataParameter("P_ALTURA_ORIGEN", DbType.String, dr[dtable.ALTURA_ORIGENColumn].ToString())); paramList.Add(repository.DbFactory.getDataParameter("P_CALLE_DESTINO", DbType.String, dr[dtable.CALLE_DESTINOColumn].ToString())); paramList.Add(repository.DbFactory.getDataParameter("P_ALTURA_DESTINO", DbType.String, dr[dtable.ALTURA_DESTINOColumn].ToString())); paramList.Add(repository.DbFactory.getDataParameter("P_IDLOCALIDA_ORIGEN", DbType.Int32, Dataservices.IntNUlleable((Int32.Parse(dr[dtable.IDLOCALIDAD_ORIGENColumn].ToString()))))); paramList.Add(repository.DbFactory.getDataParameter("P_IDLOCALIDA_DESTINO", DbType.Int32, Dataservices.IntNUlleable((Int32.Parse(dr[dtable.IDLOCALIDAD_DESTINOColumn].ToString()))))); paramList.Add(repository.DbFactory.getDataParameter("P_IDPROBLEMA", DbType.Int32, Int32.Parse(dr[dtable.IDPROBLEMAColumn].ToString()))); //paramList.Add(repository.DbFactory.getDataParameter("P_IDTIPOSERVICIO", DbType.Int32, Int32.Parse(dr[dtable.IDTIPOSERVICIOColumn].ToString()))); paramList.Add(repository.DbFactory.getDataParameter("P_TIPO_TICKET", DbType.String, dr[dtable.TIPO_TICKETColumn].ToString())); result = repository.ExecuteCreateProcedure(CONST_CREATE_PROCEDURE_NAME, paramList, dr[dtable.OBJECTHASHColumn].ToString()); DBRepository repositoryObservacion = DBRepository.GetDbRepository(repository); ObservacionDS dsObservaciones = new ObservacionDS(); Datasets.Observaciones.OBSERVACIONESRow obs = (Datasets.Observaciones.OBSERVACIONESRow)observacion; obs.IDTICKET = result; dsObservaciones.Create(obs, repositoryObservacion); // Persiste los prestadores asociados. this.PersistPrestadores(result, Prestadores, repository); repository.CommitTransaction(); } catch (Exception ex) { repository.RollbackTransaction(); throw ex; } return result; }
private void PersistPrestadores(int idTicketAsociado, Datasets.Ticket_Prestador.TICKET_PRESTADORESDataTable Prestadores, DBRepository repository) { foreach (Datasets.Ticket_Prestador.TICKET_PRESTADORESRow r in Prestadores) { if (r.PERSISTOPERATION != (int)Utils.InterAssist.Constants.PersistOperationType.Void) { // Si es distinto de void hace una actualización en la base de datos. if (r.PERSISTOPERATION == (int)Utils.InterAssist.Constants.PersistOperationType.Persist) { if (r.IDTICKETPRESTADOR == NULL_INT) { Insert_Proveedor_Ticket(repository, idTicketAsociado, r.IDPRESTADOR, r.IDTIPOSERVICIO, r.COMENTARIOS, r.KILOMETROS, r.COSTO, "ObjectHash"); } else { Update_Proveedor_Ticket(repository, r.IDTICKETPRESTADOR, idTicketAsociado, r.IDPRESTADOR, r.IDTIPOSERVICIO, r.COMENTARIOS, r.KILOMETROS, r.COSTO, "ObjectHash"); } } else { if (r.PERSISTOPERATION == ((int)Utils.InterAssist.Constants.PersistOperationType.Delete)) { Delete_Proveedor_Ticket(r.IDTICKETPRESTADOR, repository); } } } } }
public bool Update(DataRow r, DataRow observacion, Datasets.Ticket_Prestador.TICKET_PRESTADORESDataTable Prestadores) { bool result = false; DBRepository repository = DBRepository.GetDbRepository(true); repository.BeginTransaction(); try { List<IDbDataParameter> paramList = new List<IDbDataParameter>(); Datasets.Tickets.TICKETSDataTable dtable = (Datasets.Tickets.TICKETSDataTable)r.Table; Datasets.Tickets.TICKETSRow dr = (Datasets.Tickets.TICKETSRow)r; int idTicketToUpdate = Int32.Parse(dr[dtable.IDTICKETColumn].ToString()); paramList.Add(repository.DbFactory.getDataParameter("P_ID", DbType.Int32, Int32.Parse(dr[dtable.IDTICKETColumn].ToString()))); paramList.Add(repository.DbFactory.getDataParameter("P_IDOPERADOR", DbType.Int32, Int32.Parse(dr[dtable.IDOPERADORColumn].ToString()))); paramList.Add(repository.DbFactory.getDataParameter("P_IDAFILIADO", DbType.Int32, Int32.Parse(dr[dtable.IDAFILIADOColumn].ToString()))); paramList.Add(repository.DbFactory.getDataParameter("P_ID_PAIS_ORIGEN", DbType.Int32, Dataservices.IntNUlleable(Int32.Parse(dr[dtable.IDPAIS_ORIGENColumn].ToString())))); paramList.Add(repository.DbFactory.getDataParameter("P_ID_PROV_ORIGEN", DbType.Int32, Dataservices.IntNUlleable(Int32.Parse(dr[dtable.IDPROVINCIA_ORIGENColumn].ToString())))); paramList.Add(repository.DbFactory.getDataParameter("P_CIUDAD_ORIGEN", DbType.Int32, Dataservices.IntNUlleable(Int32.Parse(dr[dtable.IDCIUDAD_ORIGENColumn].ToString())))); paramList.Add(repository.DbFactory.getDataParameter("P_ID_PAIS_DEST", DbType.Int32, Dataservices.IntNUlleable(Int32.Parse(dr[dtable.IDPAIS_DESTINOColumn].ToString())))); paramList.Add(repository.DbFactory.getDataParameter("P_ID_PROV_DEST", DbType.Int32, Dataservices.IntNUlleable(Int32.Parse(dr[dtable.IDPROVINCIA_DESTINOColumn].ToString())))); paramList.Add(repository.DbFactory.getDataParameter("P_CIUDAD_DEST", DbType.Int32, Dataservices.IntNUlleable(Int32.Parse(dr[dtable.IDCIUDAD_DESTINOColumn].ToString())))); paramList.Add(repository.DbFactory.getDataParameter("P_TELEFONO", DbType.String, dr[dtable.TELEFONOColumn].ToString())); paramList.Add(repository.DbFactory.getDataParameter("P_IDESTADO", DbType.Int32, Int32.Parse(dr[dtable.IDESTADOColumn].ToString()))); paramList.Add(repository.DbFactory.getDataParameter("P_CALLE_ORIGEN", DbType.String, dr[dtable.CALLE_ORIGENColumn].ToString())); paramList.Add(repository.DbFactory.getDataParameter("P_ALTURA_ORIGEN", DbType.String, dr[dtable.ALTURA_ORIGENColumn].ToString())); paramList.Add(repository.DbFactory.getDataParameter("P_CALLE_DESTINO", DbType.String, dr[dtable.CALLE_DESTINOColumn].ToString())); paramList.Add(repository.DbFactory.getDataParameter("P_ALTURA_DESTINO", DbType.String, dr[dtable.ALTURA_DESTINOColumn].ToString())); paramList.Add(repository.DbFactory.getDataParameter("P_ID_LOCALIDAD_DESTINO", DbType.Int32, Dataservices.IntNUlleable(Int32.Parse(dr[dtable.IDLOCALIDAD_DESTINOColumn].ToString())))); paramList.Add(repository.DbFactory.getDataParameter("P_ID_LOCALIDAD_ORIGEN", DbType.Int32, Dataservices.IntNUlleable(Int32.Parse(dr[dtable.IDLOCALIDAD_ORIGENColumn].ToString())))); paramList.Add(repository.DbFactory.getDataParameter("P_IDPROBLEMA", DbType.Int32, Int32.Parse(dr[dtable.IDPROBLEMAColumn].ToString()))); paramList.Add(repository.DbFactory.getDataParameter("P_TIPO_TICKET", DbType.String, dr[dtable.TIPO_TICKETColumn].ToString())); result = (repository.ExecuteUpdateProcedure(CONST_UPDATE_PROCEDURE_NAME, paramList, dr[dtable.OBJECTHASHColumn].ToString()) == 1); // Guardar Observaciones. DBRepository repositoryObservacion = DBRepository.GetDbRepository(repository); ObservacionDS dataserviceObservacion = new ObservacionDS(); Datasets.Observaciones.OBSERVACIONESRow obs = (Datasets.Observaciones.OBSERVACIONESRow)observacion; obs.IDTICKET = Int32.Parse(dr[dtable.IDTICKETColumn].ToString()); dataserviceObservacion.Create(obs); this.PersistPrestadores(idTicketToUpdate, Prestadores, repository); if (result) { repository.CommitTransaction(); } else { repository.RollbackTransaction(); } } catch (Exception ex) { repository.RollbackTransaction(); throw ex; } return result; }