public bool ConfirmationUpload(List<CiTrackingUploadConfirmationModel> items) { bool x = false; using (var entity=new db_SeguimientoProtocolo_r2Entities()) { foreach (var row in items) { try { CI_TRACKING result = null; result = (from i in entity.CI_TRACKING where i.IdTracking == row.IdTracking select i).First(); if (result != null) { result.IsModified = false; result.ServerLastModifiedDate = row.SLMD; } } catch (Exception ex) { AppBitacoraRepository.Insert(new AppBitacoraModel() { Fecha = DateTime.Now, Metodo = ex.StackTrace, Mensaje = ex.Message }); } } entity.SaveChanges(); } return x; }
// Delete. public void DeleteCondPro(IEnumerable<Model.CondProModel> condpros) { using (var entity = new db_SeguimientoProtocolo_r2Entities()) { foreach (Model.CondProModel p in condpros) { CAT_CONDPRO result = null; try { result = (from o in entity.CAT_CONDPRO where o.IdCondicion == p.IdCondicion select o).First(); } catch (Exception) { throw; } if (result != null) { result.IsActive = false; result.IsModified = true; result.LastModifiedDate = new UNID().getNewUNID(); } } entity.SaveChanges(); _SyncRepository.UpdateSyn(entity); } }
// Delete. public void DeletePuntoMedicion(IEnumerable<Model.PuntoMedicionModel> puntomedicions) { using (var entity = new db_SeguimientoProtocolo_r2Entities()) { foreach (Model.PuntoMedicionModel p in puntomedicions) { CAT_PUNTO_MEDICION result = null; try { result = (from o in entity.CAT_PUNTO_MEDICION where o.IdPuntoMedicion == p.IdPuntoMedicion select o).First(); } catch (Exception) { throw; } if (result != null) { result.IsActive = false; result.IsModified = true; result.LastModifiedDate = new UNID().getNewUNID(); } } entity.SaveChanges(); _SyncRepository.UpdateSyn(entity); } }
public bool InsertTracking(TrackingModel tracking) { bool x = false; using (var entity =new db_SeguimientoProtocolo_r2Entities()) { try { entity.CI_TRACKING.AddObject(new CI_TRACKING() { IdTracking=tracking.IdTracking, Accion=tracking.Accion, Valor=tracking.Valor, Ip=tracking.Ip, Equipo=tracking.Equipo, Ubicacion=tracking.Ubicacion, IdUsuario=tracking.IdUsuario , IsModified=tracking.IsModified, LastModifiedDate=tracking.LastModifiedDate, ServerLastModifiedDate=tracking.ServerLastModifiedDate, IdPuntoMedicion=tracking.IdPuntoMedicion, FechaNumerica=tracking.FechaNumerica }); entity.SaveChanges(); _SyncRepository.UpdateIsModifiedData(ID_SYNCTABLE); } catch (Exception) { x = false; } } return x; }
// Delete. public void DeleteEstPuntoMed(IEnumerable<Model.EstPuntoMedModel> estpuntomeds) { using (var entity = new db_SeguimientoProtocolo_r2Entities()) { foreach (Model.EstPuntoMedModel p in estpuntomeds) { REL_EST_PUNTOMED result = null; try { result = (from o in entity.REL_EST_PUNTOMED where o.IdEstPuntoMed == p.IdEstPuntoMed select o).First(); } catch (Exception) { throw; } if (result != null) { result.IsActive = false; result.IsModified = true; result.LastModifiedDate = new UNID().getNewUNID(); } } entity.SaveChanges(); _SyncRepository.UpdateSyn(entity); } }
public ObservableCollection<PuntoMedicionMaxMinModel> GetIsModified() { ObservableCollection<PuntoMedicionMaxMinModel> result = new ObservableCollection<PuntoMedicionMaxMinModel>(); try { using (var entity = new db_SeguimientoProtocolo_r2Entities()) (from res in entity.CAT_PUNTO_MEDICION_MAX_MIN where res.IsModified == true select res).ToList().ForEach(row => { result.Add(new PuntoMedicionMaxMinModel() { IdPuntoMedicionMaxMin = row.IdPuntoMedicionMaxMin, IdPuntoMedicion = row.IdPuntoMedicion, Max = row.Max, Min = row.Min, ServerLastModifiedDate = row.ServerLastModifiedDate, LastModifiedDate = row.LastModifiedDate, }); }); } catch (Exception) { result = null; } return result; }
// Read ADD. public Model.EstructuraDependenciaModel GetEstructuraDependenciaADD(Model.EstructuraDependenciaModel estructuradependencia) { using (var entity = new db_SeguimientoProtocolo_r2Entities()) { if (estructuradependencia != null) { //Validar si el elemento ya existe REL_ESTRUCTURA_DEPENDENCIA result = null; try { result = (from o in entity.REL_ESTRUCTURA_DEPENDENCIA where o.CAT_DEPENDENCIA.IdDependencia == estructuradependencia.DEPENDENCIA.IdDependencia && o.IsActive == true && o.CAT_ESTRUCTURA.IdEstructura == estructuradependencia.ESTRUCTURA.IdEstructura && o.IsActive == true select o).First(); } catch (Exception ex) { ; } if (result == null) { estructuradependencia = null; } } } return estructuradependencia; }
public ObservableCollection<EstPuntoMedModel> GetIsModified() { ObservableCollection<EstPuntoMedModel> result = new ObservableCollection<EstPuntoMedModel>(); try { using (var entity = new db_SeguimientoProtocolo_r2Entities()) (from res in entity.REL_EST_PUNTOMED where res.IsModified == true select res).ToList().ForEach(row => { result.Add(new EstPuntoMedModel() { IdEstPuntoMed = row.IdEstPuntoMed, IdEstructura = row.IdEstructura, IdPuntoMedicion = row.IdPuntoMedicion, IsActive = row.IsActive, IsModified = row.IsModified, LastModifiedDate = row.LastModifiedDate, ServerLastModifiedDate = row.ServerLastModifiedDate }); }); } catch (Exception) { result = null; } return result; }
public ObservableCollection<UnidadMedidaModel> GetIsModified() { ObservableCollection<UnidadMedidaModel> result = new ObservableCollection<UnidadMedidaModel>(); try { using (var entity = new db_SeguimientoProtocolo_r2Entities()) (from res in entity.CAT_UNIDAD_MEDIDA where res.IsModified == true select res).ToList().ForEach(row => { result.Add(new UnidadMedidaModel() { IdUnidadMedida = row.IdUnidadMedida, UnidadMedidaName = row.UnidadMedidaName, UnidadMedidaShort = row.UnidadMedidaShort, IsActive = row.IsActive, IsModified = row.IsModified, LastModifiedDate = row.LastModifiedDate, ServerLastModifiedDate = row.ServerLastModifiedDate }); }); } catch (Exception) { result = null; } return result; }
// Read All. public IEnumerable<Model.ConsideracionModel> GetConsideracions(Model.CondProModel CondPro) { ObservableCollection<Model.ConsideracionModel> Consideracions = new ObservableCollection<Model.ConsideracionModel>(); using (var entity = new db_SeguimientoProtocolo_r2Entities()) { try { (from o in entity.CAT_CONSIDERACION where o.IdCondicion == CondPro.IdCondicion && o.IsActive == true select o).ToList().ForEach(p => { Consideracions.Add(new Model.ConsideracionModel() { IdConsideracion = p.IdConsideracion, ConsideracionName = p.ConsideracionName, ConsideracionDesc = p.ConsideracionDesc, IsActive = p.IsActive, IsModified = p.IsModified, LastModifiedDate = p.LastModifiedDate }); }); } catch (Exception) { ; } } return Consideracions; }
// Read ADD. public Model.DependenciaModel GetDependenciaADD(Model.DependenciaModel dependencia) { using (var entity = new db_SeguimientoProtocolo_r2Entities()) { if (dependencia != null) { //Validar si el elemento ya existe CAT_DEPENDENCIA result = null; try { result = (from o in entity.CAT_DEPENDENCIA where o.IdDependencia == dependencia.IdDependencia && o.IsActive == true || o.DependenciaName == dependencia.DependenciaName && o.IsActive == true select o).First(); } catch (Exception ex) { ; } if (result == null) { dependencia = null; } } } return dependencia; }
public ObservableCollection<SistemaModel> GetIsModified() { ObservableCollection<SistemaModel> result = new ObservableCollection<SistemaModel>(); try { using (var entity = new db_SeguimientoProtocolo_r2Entities()) (from res in entity.CAT_SISTEMA where res.IsModified == true select res).ToList().ForEach(row => { result.Add(new SistemaModel() { IdSistema = row.IdSistema, SistemaName = row.SistemaName, IsActive = row.IsActive, IsModified = row.IsModified, LastModifiedDate = row.LastModifiedDate, ServerLastModifiedDate = row.ServerLastModifiedDate }); }); } catch (Exception) { result = null; } return result; }
public ObservableCollection<TipoPuntoMedicionModel> GetIsModified() { ObservableCollection<TipoPuntoMedicionModel> result = new ObservableCollection<TipoPuntoMedicionModel>(); try { using (var entity = new db_SeguimientoProtocolo_r2Entities()) (from res in entity.CAT_TIPO_PUNTO_MEDICION where res.IsModified == true select res).ToList().ForEach(row => { result.Add(new TipoPuntoMedicionModel() { IdTipoPuntoMedicion = row.IdTipoPuntoMedicion, TipoPuntoMedicionName = row.TipoPuntoMedicionName, IsActive = row.IsActive, IsModified = row.IsModified, LastModifiedDate = row.LastModifiedDate, ServerLastModifiedDate = row.ServerLastModifiedDate }); }); } catch (Exception) { result = null; } return result; }
public List<TrackingModel> GetIsModified() { List<TrackingModel> result = new List<TrackingModel>(); try { using (var entity = new db_SeguimientoProtocolo_r2Entities()) (from res in entity.CI_TRACKING where res.IsModified == true select res).ToList().ForEach(row => { result.Add(new TrackingModel() { IdTracking = row.IdTracking, Accion = row.Accion, Valor = row.Valor, Ip = row.Ip, Equipo = row.Equipo, Ubicacion = row.Ubicacion, IdUsuario = row.IdUsuario, ServerLastModifiedDate = row.ServerLastModifiedDate, LastModifiedDate = row.LastModifiedDate, IsModified = row.IsModified, IdPuntoMedicion=row.IdPuntoMedicion, FechaNumerica=row.FechaNumerica }); }); } catch (Exception) { result = null; } return result; }
public ObservableCollection<CondProModel> GetCondicions() { ObservableCollection<CondProModel> items = new ObservableCollection<CondProModel>(); try { using(var entity=new db_SeguimientoProtocolo_r2Entities()) { (from res in entity.CAT_CONDPRO where res.IsActive == true select res).ToList().ForEach(row => { items.Add(new CondProModel() { IdCondicion = row.IdCondicion, CondicionName = row.CondicionName, PathCodicion = row.PathCodicion }); }); } } catch (Exception ex) { } return items; }
public IEnumerable<Model.PuntoMedicionMaxMinModel> GetPuntoMedicionsMaxMin() { ObservableCollection<Model.PuntoMedicionMaxMinModel> PuntoMedicionMaxMin = new ObservableCollection<Model.PuntoMedicionMaxMinModel>(); using (var entity = new db_SeguimientoProtocolo_r2Entities()) { try { (from o in entity.CAT_PUNTO_MEDICION_MAX_MIN select o).ToList().ForEach(p => { PuntoMedicionMaxMin.Add(new Model.PuntoMedicionMaxMinModel() { IdPuntoMedicion = p.IdPuntoMedicion, IdPuntoMedicionMaxMin =p.IdPuntoMedicionMaxMin, Max =p.Max, Min=p.Min }); }); } catch (Exception) { ; } } return PuntoMedicionMaxMin; }
public ObservableCollection<CondProModel> GetIsModified() { ObservableCollection<CondProModel> result = new ObservableCollection<CondProModel>(); try { using (var entity = new db_SeguimientoProtocolo_r2Entities()) (from res in entity.CAT_CONDPRO where res.IsModified == true select res).ToList().ForEach(row => { result.Add(new CondProModel() { IdCondicion = row.IdCondicion, CondicionName = row.CondicionName, PathCodicion = row.PathCodicion, IsActive = row.IsActive, IsModified = row.IsModified, LastModifiedDate = row.LastModifiedDate, ServerLastModifiedDate = row.ServerLastModifiedDate }); }); } catch (Exception) { result = null; } return result; }
public ObservableCollection<OperacionEstructuraModel> GetIsModified() { ObservableCollection<OperacionEstructuraModel> result = new ObservableCollection<OperacionEstructuraModel>(); try { using (var entity = new db_SeguimientoProtocolo_r2Entities()) (from res in entity.CAT_OPERACION_ESTRUCTURA where res.IsModified == true select res).ToList().ForEach(row => { result.Add(new OperacionEstructuraModel() { IdOperacionEstructura = row.IdOperacionEstructura, IdCondicion = row.IdCondicion, IdEstructura = row.IdEstructura, OperacionEstrucuturaName = row.OperacionEstrucuturaName, IsActive = row.IsActive, IsModified = row.IsModified, LastModifiedDate = row.LastModifiedDate, ServerLastModifiedDate = row.ServerLastModifiedDate }); }); } catch (Exception) { result = null; } return result; }
// Delete. public void DeleteEstructuraDependencia(IEnumerable<Model.EstructuraDependenciaModel> estructuradependencias) { using (var entity = new db_SeguimientoProtocolo_r2Entities()) { foreach (Model.EstructuraDependenciaModel p in estructuradependencias) { REL_ESTRUCTURA_DEPENDENCIA result = null; try { result = (from o in entity.REL_ESTRUCTURA_DEPENDENCIA where o.IdEstructuraDependencia == p.IdEstructuraDependencia select o).First(); } catch (Exception) { throw; } if (result != null) { result.IsActive = false; result.IsModified = true; result.LastModifiedDate = new UNID().getNewUNID(); } } entity.SaveChanges(); _SyncRepository.UpdateSyn(entity); } }
public IEnumerable<Model.MenuModel> GetMenu() { ObservableCollection<Model.MenuModel> Menu = new ObservableCollection<Model.MenuModel>(); using (var entity = new db_SeguimientoProtocolo_r2Entities()) { try { (from o in entity.APP_MENU where o.IsActive == true select o).ToList().ForEach(p => { Menu.Add(new Model.MenuModel() { IdMenu = p.IdMenu, MenuName = p.MenuName, IsLeaf = p.IsLeaf, IsActive = p.IsActive, IsModified = p.IsModified, LastModifiedDate = p.LastModifiedDate }); }); } catch (Exception) { ; } } return Menu; }
public void InsertAppUsuario(Model.AppUsuarioModel usuario) { using (var entity = new db_SeguimientoProtocolo_r2Entities()) { if (usuario != null) { //Validar si el elemento ya existe APP_USUARIO result = null; try { result = (from o in entity.APP_USUARIO where o.IdUsuario == usuario.IdUsuario select o).First(); } catch (Exception ex) { ; } if (result == null) { entity.APP_USUARIO.AddObject( new APP_USUARIO() { IdUsuario = usuario.IdUsuario, Nombre = usuario.Nombre, IsActive = usuario.IsActive } ); entity.SaveChanges(); } } } }
// Delete. public void DeleteSistema(IEnumerable<Model.SistemaModel> sistemas) { using (var entity = new db_SeguimientoProtocolo_r2Entities()) { foreach (Model.SistemaModel p in sistemas) { CAT_SISTEMA result = null; try { result = (from o in entity.CAT_SISTEMA where o.IdSistema == p.IdSistema select o).First(); } catch (Exception) { throw; } if (result != null) { result.IsActive = false; result.IsModified = true; result.LastModifiedDate = new UNID().getNewUNID(); } } entity.SaveChanges(); _SyncRepository.UpdateSyn(entity); } }
// Read ADD. public Model.EstructuraModel GetEstructuraADD(Model.EstructuraModel estructura) { using (var entity = new db_SeguimientoProtocolo_r2Entities()) { if (estructura != null) { //Validar si el elemento ya existe CAT_ESTRUCTURA result = null; try { result = (from o in entity.CAT_ESTRUCTURA where o.IdEstructura == estructura.IdEstructura && o.IsActive == true || o.EstructuraName == estructura.EstructuraName && o.IsActive == true select o).First(); } catch (Exception ex) { ; } if (result == null) { estructura = null; } } } return estructura; }
// Local public string GetJsonSistema() { string res = null; ObservableCollection<Model.SistemaModel> Sistemas = new ObservableCollection<Model.SistemaModel>(); using (db_SeguimientoProtocolo_r2Entities entity = new db_SeguimientoProtocolo_r2Entities()) { try { (from o in entity.CAT_SISTEMA where o.IsModified select o).ToList<Protell.DAL.CAT_SISTEMA>().ForEach(p => { Sistemas.Add(new Model.SistemaModel() { IdSistema = p.IdSistema, SistemaName = p.SistemaName, IsActive = p.IsActive, IsModified = p.IsModified, LastModifiedDate = p.LastModifiedDate }); }); if (Sistemas.Count > 0) res = SerializerJson.SerializeParametros(Sistemas); } catch (Exception) { return res; } return res; } }
// Read ADD. public Model.EstPuntoMedModel GetEstPuntoMedADD(Model.EstPuntoMedModel estpuntomed) { using (var entity = new db_SeguimientoProtocolo_r2Entities()) { if (estpuntomed != null) { //Validar si el elemento ya existe REL_EST_PUNTOMED result = null; try { result = (from o in entity.REL_EST_PUNTOMED where o.IdEstPuntoMed == estpuntomed.IdEstPuntoMed && o.IsActive == true select o).First(); } catch (Exception ex) { ; } if (result == null) { estpuntomed = null; } } } return estpuntomed; }
public ObservableCollection<AgrupadorIsiyetasModel> GetIsModified() { ObservableCollection<AgrupadorIsiyetasModel> result = new ObservableCollection<AgrupadorIsiyetasModel>(); try { using (var entity = new db_SeguimientoProtocolo_r2Entities()) (from res in entity.CAT_AGRUPADOR_ISOYETA where res.IsModified == true select res).ToList().ForEach(row => { result.Add(new AgrupadorIsiyetasModel() { IdAgrupadorIsoyeta = row.IdAgrupadorIsoyeta, AgrupadorIsoyetaName = row.AgrupadorIsoyetaName, IsActive = row.IsActive, IsModified = row.IsModified, LastModifiedDate = row.LastModifiedDate, ServerLastModifiedDate = row.ServerLastModifiedDate }); }); } catch (Exception) { result = null; } return result; }
// Read ADD. public Model.CondProModel GetCondProADD(Model.CondProModel condpro) { using (var entity = new db_SeguimientoProtocolo_r2Entities()) { if (condpro != null) { //Validar si el elemento ya existe CAT_CONDPRO result = null; try { result = (from o in entity.CAT_CONDPRO where o.IdCondicion == condpro.IdCondicion && o.IsActive == true || o.CondicionName == condpro.CondicionName && o.IsActive == true select o).First(); } catch (Exception ex) { ; } if (result == null) { condpro = null; } } } return condpro; }
public ObservableCollection<AppUsuarioRolModel> GetIsModified() { ObservableCollection<AppUsuarioRolModel> result = new ObservableCollection<AppUsuarioRolModel>(); try { using (var entity = new db_SeguimientoProtocolo_r2Entities()) (from res in entity.APP_USUARIO_ROL where res.IsModified == true select res).ToList().ForEach(row => { result.Add(new AppUsuarioRolModel() { IdUsuario = row.IdUsuario, IdRol = row.IdRol, IsActive = row.IsActive, LastModifiedDate = row.LastModifiedDate, IsModified = row.IsModified, ServerLastModifiedDate = row.ServerLastModifiedDate }); }); } catch (Exception) { result = null; } return result; }
public ObservableCollection<EstructuraDependenciaModel> GetIsModified() { ObservableCollection<EstructuraDependenciaModel> result = new ObservableCollection<EstructuraDependenciaModel>(); try { using (var entity = new db_SeguimientoProtocolo_r2Entities()) (from res in entity.REL_ESTRUCTURA_DEPENDENCIA where res.IsModified == true select res).ToList().ForEach(row => { result.Add(new EstructuraDependenciaModel() { IdEstructuraDependencia = row.IdEstructuraDependencia, IdDependencia = row.IdDependencia, IdEstructura = row.IdEstructura, IsActive = row.IsActive, IsModified = row.IsModified, LastModifiedDate = row.LastModifiedDate, ServerLastModifiedDate = row.ServerLastModifiedDate, }); }); } catch (Exception) { result = null; } return result; }
public Model.AppRolModel GetAppRolADD(Model.AppRolModel rol) { using (var entity = new db_SeguimientoProtocolo_r2Entities()) { if (rol != null) { //Validar si el elemento ya existe APP_ROL result = null; try { result = (from o in entity.APP_ROL where o.IdRol == rol.IdRol && o.IsActive == true || o.RolName == rol.RolName && o.IsActive == true select o).First(); } catch (Exception ex) { ; } if (result == null) { rol = null; } } } return rol; }