public ObservableCollection<UnidadMedidaModel> GetUnidadMedida(long LastModifiedDate, long ServerLastModifiedDate)
        {
            ObservableCollection<UnidadMedidaModel> unidades = new ObservableCollection<UnidadMedidaModel>();
            using (var entity = new db_SeguimientoProtocolo_r2Entities())
            {
                try
                {
                    ( from res in entity.CAT_UNIDAD_MEDIDA
                      where res.LastModifiedDate >= LastModifiedDate || res.ServerLastModifiedDate >= ServerLastModifiedDate
                      select res ).ToList().ForEach(row =>
                      {
                          unidades.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)
                {

                }
            }
            return unidades;
        }
        public ObservableCollection<AppSettingsModel> GetSettings(long LastModifiedDate, long ServerLastModifiedDate)
        {
            ObservableCollection<AppSettingsModel> result = new ObservableCollection<AppSettingsModel>();
            try
            {
                using(var entity=new db_SeguimientoProtocolo_r2Entities())
                {
                    (from item in entity.APP_SETTINGS
                     where item.LastModifiedDate >= LastModifiedDate || item.ServerLastModifiedDate >= ServerLastModifiedDate
                     select item).ToList().ForEach(row => {
                         result.Add(new AppSettingsModel() {
                             IdSettings = row.IdSettings,
                             SettingName=row.SettingName,
                             Value=row.Value,
                             LastModifiedDate=row.LastModifiedDate,
                             ServerLastModifiedDate=row.ServerLastModifiedDate
                         });
                     });
                }
            }
            catch (Exception)
            {

            }
            return result;
        }
        public ObservableCollection<EstructuraDependenciaModel> GetRelEstructuraDependencia(long LastModifiedDate, long ServerLastModifiedDate)
        {
            ObservableCollection<EstructuraDependenciaModel> result = new ObservableCollection<EstructuraDependenciaModel>();
            try
            {
                using (var entity = new db_SeguimientoProtocolo_r2Entities())
                {
                    (from res in entity.REL_ESTRUCTURA_DEPENDENCIA
                     where res.LastModifiedDate >= LastModifiedDate || res.ServerLastModifiedDate >= ServerLastModifiedDate
                     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)
            {

            }
            return result;
        }
        public string GetJsonEstPuntoMed(long? Last_Modified_Date)
        {
            string res = null;
            ObservableCollection<Model.EstPuntoMedModel> EstPuntoMed = new ObservableCollection<EstPuntoMedModel>();

            using (var entity = new db_SeguimientoProtocolo_r2Entities())
            {
                try
                {
                    (from o in entity.REL_EST_PUNTOMED
                     where o.LastModifiedDate > Last_Modified_Date
                     select o).ToList().ForEach(p =>
                     {
                         EstPuntoMed.Add(new Model.EstPuntoMedModel()
                         {
                             IdEstPuntoMed=p.IdEstPuntoMed,
                             IdEstructura=p.IdEstructura,
                             IdPuntoMedicion=p.IdEstPuntoMed,
                             IsActive = p.IsActive,
                             IsModified = p.IsModified,
                             LastModifiedDate = p.LastModifiedDate
                         });
                     });

                    if (EstPuntoMed.Count > 0)
                        res = SerializerJson.SerializeParametros(EstPuntoMed);
                }
                catch (Exception)
                {
                    return res;
                }
                return res;
            }
        }
        public bool UndadMedida_Update(string KeySesion, long IdUnidadMedida, string UnidadMedidaName, string UnidadMedidaShort)
        {
            bool res = true;
            ObservableCollection<WAPP_USUARIO_SESION> Key = new ObservableCollection<WAPP_USUARIO_SESION>();

            try
            {
                using (var entity_ = new db_SeguimientoProtocolo_r2Entities())
                {
                    (from s in entity_.WAPP_USUARIO_SESION
                     where s.IdSesion == KeySesion
                     select s).ToList().ForEach(row =>
                     {
                         Key.Add(new WAPP_USUARIO_SESION()
                         {
                             IdUsuario = row.IdUsuario,
                             IdSesion = row.IdSesion
                         });
                     });
                    if (Key[0].IdSesion == KeySesion.ToString())
                    {
                        using (var entity = new db_SeguimientoProtocolo_r2Entities())
                        {
                            entity.SP_UnidadMedidaUpdate(IdUnidadMedida, UnidadMedidaName, UnidadMedidaShort);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                var errr = ex.Message;
            }
            return res;
        }
        public ObservableCollection<AppUsuarioRolModel> GetAppUsuarioRol(long LastModifiedDate, long ServerLastModifiedDate)
        {
            ObservableCollection<AppUsuarioRolModel> appUsuarioRol = new ObservableCollection<AppUsuarioRolModel>();
            try
            {
                using (var entity = new db_SeguimientoProtocolo_r2Entities())
                {
                    (from res in entity.APP_USUARIO_ROL
                     where res.LastModifiedDate >= LastModifiedDate || res.ServerLastModifiedDate >= ServerLastModifiedDate
                     select res).ToList().ForEach(row =>
                     {
                         appUsuarioRol.Add(new AppUsuarioRolModel()
                         {
                             IdUsuario = row.IdUsuario,
                             IdRol = row.IdRol,
                             IsActive = row.IsActive,
                             LastModifiedDate = row.LastModifiedDate,
                             IsModified = row.IsModified,
                             ServerLastModifiedDate = row.ServerLastModifiedDate
                         });
                     });
                }
            }
            catch (Exception)
            {

            }
            return appUsuarioRol;
        }
 public ObservableCollection<WAPP_RECOVERY_PASS> Get_WAPP_RECOVERY_PASS(string Key)
 {
     ObservableCollection<WAPP_RECOVERY_PASS> res = new ObservableCollection<WAPP_RECOVERY_PASS>();
     try
     {
         using (var entity = new db_SeguimientoProtocolo_r2Entities())
         {
             (from item in entity.WAPP_RECOVERY_PASS
              where item.IdSesion == Key
              select item).ToList().ForEach(row =>
              {
                  res.Add(new WAPP_RECOVERY_PASS()
                  {
                      IdSesion = row.IdSesion,
                      IdUsuario = row.IdUsuario
                  });
              });
         }
     }
     catch (Exception ex)
     {
         var err = ex.Message;
     }
     return res;
 }
        public ObservableCollection<OperacionEstructuraModel> GetCatOperacionEstructura(long LastModifiedDate, long ServerLastModifiedDate)
        {
            ObservableCollection<OperacionEstructuraModel> result = new ObservableCollection<OperacionEstructuraModel>();
            try
            {
                using (var entity = new db_SeguimientoProtocolo_r2Entities())
                {
                    (from res in entity.CAT_OPERACION_ESTRUCTURA
                     where res.LastModifiedDate >= LastModifiedDate || res.ServerLastModifiedDate >= ServerLastModifiedDate
                     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)
            {

            }
            return result;
        }
        public ObservableCollection<ProtocoloModel> GetProtocolo(long LastModifiedDate, long ServerLastModifiedDate)
        {
            ObservableCollection<ProtocoloModel> result = new ObservableCollection<ProtocoloModel>();
            try
            {
                using(var entity= new db_SeguimientoProtocolo_r2Entities())
                {
                    (from items in entity.CAT_PROTOCOLO
                     where items.LastModifiedDate >= LastModifiedDate || items.ServerLastModifiedDate >= ServerLastModifiedDate
                     select items).ToList().ForEach(row =>
                     {
                         result.Add(new ProtocoloModel()
                         {
                             IdProtocolo = row.IdProtocolo,
                             IdPuntoMedicion = (long)row.IdPuntoMedicion,
                             LastModifiedDate = row.LastModifiedDate,
                             ServerLastModifiedDate = row.ServerLastModifiedDate
                         });
                     });
                }
            }
            catch (Exception)
            {

            }
            return result;
        }
        public ObservableCollection<AccionActualModel> GetAccionActual(long LastModifiedDate, long ServerLastModifiedDate)
        {
            ObservableCollection<AccionActualModel> result = new ObservableCollection<AccionActualModel>();
            try
            {
                using (var entity = new db_SeguimientoProtocolo_r2Entities())
                {
                    (from item in entity.CAT_ACCION_ACTUAL
                     where item.LastModifiedDate >= LastModifiedDate || item.ServerLastModifiedDate >= ServerLastModifiedDate
                     select item).ToList().ForEach(row =>
                     {
                         result.Add(new AccionActualModel()
                         {
                             IdAccionActual=row.IdAccionActual,
                             AccionAcualName=row.AccionAcualName,
                             IsModified=row.IsModified,
                             IsActive=row.IsActive,
                             LastModifiedDate = row.LastModifiedDate,
                             ServerLastModifiedDate = row.ServerLastModifiedDate
                         });
                     });
                }
            }
            catch (Exception)
            {

            }
            return result;
        }
        public ObservableCollection<EstPuntoMedModel> GetRelEstPuntoMed(long LastModifiedDate, long ServerLastModifiedDate)
        {
            ObservableCollection<EstPuntoMedModel> result = new ObservableCollection<EstPuntoMedModel>();
            try
            {
                using (var entity = new db_SeguimientoProtocolo_r2Entities())
                {
                    (from res in entity.REL_EST_PUNTOMED
                     where res.LastModifiedDate >= LastModifiedDate || res.ServerLastModifiedDate >= ServerLastModifiedDate
                     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)
            {

            }
            return result;
        }
        public string GetJsonTipoPuntoMedicion(long? Last_Modified_Date)
        {
            string res = null;
            ObservableCollection<Model.TipoPuntoMedicionModel> TipoPuntoMedicion = new ObservableCollection<Model.TipoPuntoMedicionModel>();

            using (var entity = new db_SeguimientoProtocolo_r2Entities())
            {
                try
                {
                    (from o in entity.CAT_TIPO_PUNTO_MEDICION
                     where o.LastModifiedDate > Last_Modified_Date
                     select o).ToList().ForEach(p =>
                     {
                         TipoPuntoMedicion.Add(new Model.TipoPuntoMedicionModel()
                         {
                             IdTipoPuntoMedicion=p.IdTipoPuntoMedicion,
                             TipoPuntoMedicionName=p.TipoPuntoMedicionName,
                             IsActive = p.IsActive,
                             IsModified = p.IsModified,
                             LastModifiedDate = p.LastModifiedDate
                         });
                     });

                    if (TipoPuntoMedicion.Count > 0)
                        res = SerializerJson.SerializeParametros(TipoPuntoMedicion);
                }
                catch (Exception)
                {
                    return res;
                }
                return res;
            }
        }
 public AjaxDictionary<string, object> GetNivelLluvia()
 {
     AjaxDictionary<string, object> res = new AjaxDictionary<string, object>();
     try
     {
         using (var entity=new db_SeguimientoProtocolo_r2Entities())
         {
             (from s in entity.CAT_NIVEL_LLUVIA
              where s.IsActive == true
              select s).ToList().ForEach(i =>
              {
                  AjaxDictionary<string, object> tmp = new AjaxDictionary<string, object>();
                  tmp.Add("idNivel", i.IdNivelLluvia);
                  tmp.Add("rangoMax", i.RangMax);
                  tmp.Add("rangoMin", i.RangoMin);
                  tmp.Add("intensidadName", i.IntensidadName);
                  tmp.Add("imagen", i.Imagen);
                  res.Add("N" + i.RangoMin + "_" + i.RangMax, tmp);
              });
         }
     }
     catch (Exception ex)
     {
     }
     return res;
 }
        public ObservableCollection<CatPuntosMedicionShortNameModel> GetItems(long LastModifiedDate, long ServerLastModifiedDate)
        {
            ObservableCollection<CatPuntosMedicionShortNameModel> items = new ObservableCollection<CatPuntosMedicionShortNameModel>();

            try
            {
                using (var entity = new db_SeguimientoProtocolo_r2Entities())
                {
                    (from res in entity.CAT_PUNTOS_MEDICION_SHORTNAME
                     where res.LastModifiedDate >= LastModifiedDate || res.ServerLastModifiedDate >= ServerLastModifiedDate
                     select res).ToList().ForEach(row =>
                     {
                         items.Add(new CatPuntosMedicionShortNameModel()
                         {
                             IdShortName = row.IdShortName,
                             IdPuntoMedicion = (long)row.IdPuntoMedicion,
                             ShortName = row.ShortName,
                             IsModified = row.IsModified,
                             LastModifiedDate = row.LastModifiedDate,
                             ServerLastModifiedDate = row.ServerLastModifiedDate,
                         });
                     });
                }
            }
            catch (Exception)
            {

            }
            return items;
        }
        public string GetJsonDependencia(long? Last_Modified_Date)
        {
            string res = null;
            ObservableCollection<Model.DependenciaModel> dependencia = new ObservableCollection<Model.DependenciaModel>();

            using (var entity = new db_SeguimientoProtocolo_r2Entities())
            {
                try
                {
                    (from o in entity.CAT_DEPENDENCIA
                     where o.LastModifiedDate > Last_Modified_Date
                     select o).ToList().ForEach(p =>
                     {
                         dependencia.Add(new Model.DependenciaModel()
                         {
                             IdDependencia = p.IdDependencia,
                             DependenciaName = p.DependenciaName,
                             IsActive = p.IsActive,
                             IsModified = p.IsModified,
                             LastModifiedDate = p.LastModifiedDate
                         });
                     });

                    if (dependencia.Count > 0)
                        res = SerializerJson.SerializeParametros(dependencia);
                }
                catch (Exception)
                {
                    return res;
                }
                return res;
            }
        }
        public string GetJsonCondPro(long? Last_Modified_Date)
        {
            string res = null;
            ObservableCollection<Model.CondProModel> CondPro = new ObservableCollection<Model.CondProModel>();

            using (var entity = new db_SeguimientoProtocolo_r2Entities())
            {
                try
                {
                    (from o in entity.CAT_CONDPRO
                     where o.LastModifiedDate > Last_Modified_Date
                     select o).ToList().ForEach(p =>
                     {
                         CondPro.Add(new Model.CondProModel()
                         {
                             IdCondicion = p.IdCondicion,
                             CondicionName = p.CondicionName,
                             PathCodicion = p.PathCodicion,
                             IsActive = p.IsActive,
                             IsModified = p.IsModified,
                             LastModifiedDate = p.LastModifiedDate
                         });
                     });

                    if (CondPro.Count > 0)
                        res = SerializerJson.SerializeParametros(CondPro);
                }
                catch (Exception)
                {
                    return res;
                }
                return res;
            }
        }
        public ObservableCollection<ModifiedDataModel> getModifiedDate()
        {
            ObservableCollection<ModifiedDataModel> modifiedDate = new ObservableCollection<ModifiedDataModel>();
            using(var entity=new db_SeguimientoProtocolo_r2Entities())
            {
                try
                {
                    ( from res in entity.MODIFIEDDATAs
                      select res ).ToList().ForEach(row => {
                          modifiedDate.Add(new ModifiedDataModel()
                          {
                              IdModifiedData=row.IdModifiedData,
                              IdSyncTable=row.IdSyncTable,
                              IsModified=row.IsModified,
                              ServerModifiedDate=row.ServerModifiedDate
                          });
                      });
                }
                catch (Exception)
                {

                }
            }
            return modifiedDate;
        }
        public IEnumerable<Model.GdDatosEstructurasModel> GetData()
        {
            ObservableCollection<Model.GdDatosEstructurasModel> oc=new ObservableCollection<Model.GdDatosEstructurasModel>();

            using (var entity = new db_SeguimientoProtocolo_r2Entities())
            {
                (from o in entity.SpGdGetDatosEstructuras2()
                           select o).ToList().ForEach(r =>
                           {
                               oc.Add(
                                   new Model.GdDatosEstructurasModel()
                                   {
                                       NombreColumna = r.NombreColumna
                                       ,
                                       NumeroColumna = (int)r.NumeroColumna
                                       ,
                                       NumeroFila = (int)r.RowNum
                                       ,
                                       Valor = r.Valor
                                   }
                            );
                });
            }

            return oc;
        }
        public string GetJsonUnidadMedida(long? Last_Modified_Date)
        {
            string res = null;
            ObservableCollection<Model.UnidadMedidaModel> UnidadMedida = new ObservableCollection<Model.UnidadMedidaModel>();

            using (var entity = new db_SeguimientoProtocolo_r2Entities())
            {
                try
                {
                    (from o in entity.CAT_UNIDAD_MEDIDA
                     where o.LastModifiedDate > Last_Modified_Date
                     select o).ToList().ForEach(p =>
                     {
                         UnidadMedida.Add(new Model.UnidadMedidaModel()
                         {
                             IdUnidadMedida=p.IdUnidadMedida,
                             UnidadMedidaName=p.UnidadMedidaName,
                             UnidadMedidaShort=p.UnidadMedidaShort,
                             IsActive = p.IsActive,
                             IsModified = p.IsModified,
                             LastModifiedDate = p.LastModifiedDate
                         });
                     });

                    if (UnidadMedida.Count > 0)
                        res = SerializerJson.SerializeParametros(UnidadMedida);
                }
                catch (Exception)
                {
                    return res;
                }
                return res;
            }
        }
        public ObservableCollection<AgrupadorIsiyetasModel> GetCatAgrupadorIsoyetas(long LastModifiedDate, long ServerLastModifiedDate)
        {
            ObservableCollection<AgrupadorIsiyetasModel> result = new ObservableCollection<AgrupadorIsiyetasModel>();
            try
            {
                using (var entity = new db_SeguimientoProtocolo_r2Entities())
                {
                    (from res in entity.CAT_AGRUPADOR_ISOYETA
                     where res.LastModifiedDate >= LastModifiedDate || res.ServerLastModifiedDate >= ServerLastModifiedDate
                     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)
            {

            }
            return result;
        }
Exemplo n.º 21
0
        public ObservableCollection<LinksModel> GetCatLinks(long LastModifiedDate, long ServerLastModifiedDate)
        {
            ObservableCollection<LinksModel> result = new ObservableCollection<LinksModel>();
            try
            {
                using (var entity = new db_SeguimientoProtocolo_r2Entities())
                {
                    (from res in entity.CAT_LINKS
                     where res.LastModifiedDate >= LastModifiedDate || res.ServerLastModifiedDate >= ServerLastModifiedDate
                     select res).ToList().ForEach(row =>
                     {
                         result.Add(new LinksModel()
                         {
                             IdLink = row.IdLink,
                             LinkUrl = row.LinkUrl,
                             LinkName = row.LinkName,
                             IsActive = row.IsActive,
                             IsModified = row.IsModified,
                             LastModifiedDate = row.LastModifiedDate,
                             ServerLastModifiedDate = row.ServerLastModifiedDate
                         });
                     });
                }
            }
            catch (Exception)
            {

            }
            return result;
        }
        public List<CiRegistroUploadConfirmationModel> CommitBulkUpsertUploaded(long session)
        {
            List<CiRegistroUploadConfirmationModel> confirmation = new List<CiRegistroUploadConfirmationModel>();
            try
            {
                using (var entity = new db_SeguimientoProtocolo_r2Entities())
                {
                    List<spCommitBulkUpsertCiRegistroUploaded_Result> res = entity.spCommitBulkUpsertCiRegistroUploaded(session).ToList();
                    if (res != null && res.Count > 0)
                    {
                        res.ForEach(o =>
                        {
                            confirmation.Add(new CiRegistroUploadConfirmationModel()
                            {
                                IdRegistro=Int64.Parse( o.FechaNumerica.ToString()+o.IdPuntoMedicion.ToString() ),
                                IdPuntoMedicion = o.IdPuntoMedicion,
                                FechaNumerica = (long)o.FechaNumerica,
                                LMD = o.LastModifiedDate,
                                SLMD = (long)o.ServerLastModifiedDate
                            });
                        });
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }

            return confirmation;
        }
        public ObservableCollection<PuntoMedicionMaxMinModel> GetCatPuntoMedicionMaxMin(long LastModifiedDate, long ServerLastModifiedDate)
        {
            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.LastModifiedDate >= LastModifiedDate || res.ServerLastModifiedDate >= ServerLastModifiedDate
                     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)
            {

            }
            return result;
        }
        public bool OperationEstruct_Update(string KeySesion, string IdOperacionEstructura, long IdCondicion, long IdEstructura, string OperacionEstrucuturaName)
        {
            bool res = true;
            ObservableCollection<WAPP_USUARIO_SESION> Key = new ObservableCollection<WAPP_USUARIO_SESION>();

            try
            {
                using (var entity_ = new db_SeguimientoProtocolo_r2Entities())
                {
                    (from s in entity_.WAPP_USUARIO_SESION
                     where s.IdSesion == KeySesion
                     select s).ToList().ForEach(row =>
                     {
                         Key.Add(new WAPP_USUARIO_SESION()
                         {
                             IdUsuario = row.IdUsuario,
                             IdSesion = row.IdSesion
                         });
                     });
                    if (Key[0].IdSesion == KeySesion.ToString())
                    {
                        using (var entity = new db_SeguimientoProtocolo_r2Entities())
                        {
                            entity.SP_OperEstructurasUpdate(IdOperacionEstructura, IdCondicion, IdEstructura, OperacionEstrucuturaName);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                var errr = ex.Message;
            }
            return res;
        }
        public Model.UploadLogModel InsertUploadLogServer(Model.UploadLogModel uploadLog)
        {
            Model.UploadLogModel res;
            using (var entity = new db_SeguimientoProtocolo_r2Entities())
            {
                CAT_UPLOAD_LOG ull = new CAT_UPLOAD_LOG()
                {
                    IdUploadLog = new UNID().getNewUNID(),
                    IdUsuario = uploadLog.IdUsuario,
                    IpDir = uploadLog.IpDir,
                    Msg = uploadLog.Msg,
                    PcName = uploadLog.PcName
                };
                entity.CAT_UPLOAD_LOG.AddObject(ull);
                entity.SaveChanges();

                res = new Model.UploadLogModel()
                {
                    IdUploadLog = ull.IdUploadLog,
                    IdUsuario = ull.IdUsuario,
                    IpDir = ull.IpDir,
                    Msg = ull.Msg,
                    PcName = ull.PcName
                };
                return res;

            }
        }
        // Servidor
        public string GetJsonSistema(long? Last_Modified_Date)
        {
            string res = null;
            ObservableCollection<Model.SistemaModel> Sistemas = new ObservableCollection<Model.SistemaModel>();

            using (var entity = new db_SeguimientoProtocolo_r2Entities())
            {
                try
                {
                    (from o in entity.CAT_SISTEMA
                     where o.LastModifiedDate > Last_Modified_Date
                     select o).ToList().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;
            }
        }
        public ObservableCollection<CondProModel> GetCondicion(long LastModifiedDate, long ServerLastModifiedDate)
        {
            ObservableCollection<CondProModel> condiciones = new ObservableCollection<CondProModel>();
            using (var entity = new db_SeguimientoProtocolo_r2Entities())
            {
                try
                {
                    ( from res in entity.CAT_CONDPRO
                      where res.LastModifiedDate>=LastModifiedDate || res.ServerLastModifiedDate>=ServerLastModifiedDate
                      select res ).ToList().ForEach(row => {
                          condiciones.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)
                {

                }
            }
            return condiciones;
        }
 public ObservableCollection<CAT_OPERACION_ESTRUCTURA_V2_Model> Get_CatOperacionSobreEstructuras()
 {
     ObservableCollection<CAT_OPERACION_ESTRUCTURA_V2_Model> res = new ObservableCollection<CAT_OPERACION_ESTRUCTURA_V2_Model>();
     try
     {
         using (var entity = new db_SeguimientoProtocolo_r2Entities())
         {
             (from item in entity.CAT_OPERACION_ESTRUCTURA_V2
              select item).ToList().ForEach(row =>
              {
                  res.Add(new CAT_OPERACION_ESTRUCTURA_V2_Model()
                  {
                      IdCondicion = row.IdCondicion,
                      IdEstructura = row.IdEstructura,
                      OperacionEstrucuturaName = row.OperacionEstrucuturaName
                  });
              });
         }
     }
     catch (Exception ex)
     {
         var err = ex.Message;
     }
     return res;
 }
        public bool Dependencia_Insert(string KeySesion, string DependenciaName)
        {
            bool res = true;
            ObservableCollection<WAPP_USUARIO_SESION> Key = new ObservableCollection<WAPP_USUARIO_SESION>();

            try
            {
                using (var entity_ = new db_SeguimientoProtocolo_r2Entities())
                {
                    (from s in entity_.WAPP_USUARIO_SESION
                     where s.IdSesion == KeySesion
                     select s).ToList().ForEach(row =>
                     {
                         Key.Add(new WAPP_USUARIO_SESION()
                         {
                             IdUsuario = row.IdUsuario,
                             IdSesion = row.IdSesion
                         });
                     });
                    if (Key[0].IdSesion == KeySesion.ToString())
                    {
                        using (var entity = new db_SeguimientoProtocolo_r2Entities())
                        {
                            entity.SP_DependenciaInsert(DependenciaName);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                var errr = ex.Message;
            }
            return res;
        }
Exemplo n.º 30
0
        public AjaxDictionary<string, object> Get_CatUrl()
        {
            AjaxDictionary<string, object> result = new AjaxDictionary<string, object>();
            try
            {
                using (var entity = new db_SeguimientoProtocolo_r2Entities())
                {
                    //entity.wappSpAttemptLogUser("", "", true).ToList();
                    List<spGetHashablePuntoMedicion_Result> res = entity.spGetHashablePuntoMedicion().ToList();

                    int i = 0;
                    (from s in entity.CAT_LINKS
                     where s.IsActive == true
                     select s).ToList().ForEach(row =>
                     {
                         AjaxDictionary<string, object> item = new AjaxDictionary<string, object>();
                         item.Add("idUrl", row.IdLink);
                         item.Add("Url", row.LinkUrl);
                         item.Add("IsActive", row.IsActive);
                         item.Add("DescriptionUrl", row.LinkName);
                         result.Add("Result" + i.ToString(),item);
                         i++;
                     });
                }
            }
            catch (Exception ex)
            {
                var err = ex.Message;
            }
            return result;
        }