Example #1
0
 public static List <Nomenclator> RetriveAll()
 {
     using (Health.Entities.HealthLinQDataContext dc = new Health.Entities.HealthLinQDataContext(Common.CnnString))
     {
         return(dc.Nomenclators.OrderBy(p => p.Id).ToList <Nomenclator>());
     }
 }
Example #2
0
 /// <summary>
 /// Retorna lista de sulicitud de registro
 /// </summary>
 /// <param name="isApproved"></param>
 /// <returns></returns>
 public static List <RegistrationRequest> Retrive_All_RegistrationRequest(bool?isApproved)
 {
     using (Health.Entities.HealthLinQDataContext dc = new Health.Entities.HealthLinQDataContext(Common.CnnString))
     {
         return(dc.RegistrationRequests.Where(p => (isApproved.HasValue || p.IsApproved.Equals(isApproved.Value))).ToList <RegistrationRequest>());
     }
 }
Example #3
0
        public static void Process_PMO_Odont()
        {
            using (Health.Entities.HealthLinQDataContext dc = new Health.Entities.HealthLinQDataContext(Common.CnnString))
            {
                string[] auxiliar;
                var      list = dc.Nomenclators.Where(p => p.PMOType.Equals((int)PMOEnum.Odontológicas)).OrderBy(p => p.Id);
                foreach (Nomenclator PMO in list)
                {
                    auxiliar = PMO.Code.Split('.');

                    if (auxiliar.Length == 3)
                    {
                        //PMO.Code = temp.Code.Trim();
                        PMO.ParentCode = string.Concat(auxiliar[0], '.', auxiliar[1]);
                        PMO.HasChilds  = false;
                    }

                    if (auxiliar.Length == 2)
                    {
                        //PMO.Code = temp.Code.Trim();
                        PMO.ParentCode = auxiliar[0].ToString().Trim();
                        PMO.HasChilds  = true;
                    }


                    if (auxiliar.Length == 1)
                    {
                        //PMO.Code = temp.Code.Trim();
                        PMO.ParentCode = string.Empty;
                        PMO.HasChilds  = true;
                    }
                }
                dc.SubmitChanges();
            }
        }
Example #4
0
 public static List <Nomenclator> RetriveByType(int type)
 {
     using (Health.Entities.HealthLinQDataContext dc = new Health.Entities.HealthLinQDataContext(Common.CnnString))
     {
         return(dc.Nomenclators.Where(p => p.PMOType.Equals(type)).ToList <Nomenclator>());
     }
 }
Example #5
0
 /// <summary>
 /// Retorna sulicitud de registro por nombre
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public static RegistrationRequest Get_RegistrationRequest(int id)
 {
     using (Health.Entities.HealthLinQDataContext dc = new Health.Entities.HealthLinQDataContext(Common.CnnString))
     {
         var reg = dc.RegistrationRequests.Where(s => s.Id.Equals(id)).FirstOrDefault <RegistrationRequest>();
         return(reg);
     }
 }
Example #6
0
        /// <summary>
        /// Retorna sulicitud de registro por nombre
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static RegistrationRequest Get_RegistrationRequest(int id)
        {
            using (Health.Entities.HealthLinQDataContext dc = new Health.Entities.HealthLinQDataContext(Common.CnnString))
            {
                var reg = dc.RegistrationRequests.Where(s => s.Id.Equals(id)).FirstOrDefault<RegistrationRequest>();
                return reg;
            }

        }
Example #7
0
        /// <summary>
        /// Retorna lista de sulicitud de registro
        /// </summary>
        /// <param name="isApproved"></param>
        /// <returns></returns>
        public static List<RegistrationRequest> Retrive_All_RegistrationRequest(bool? isApproved)
        {
            using (Health.Entities.HealthLinQDataContext dc = new Health.Entities.HealthLinQDataContext(Common.CnnString))
            {
                return dc.RegistrationRequests.Where(p=> (isApproved.HasValue || p.IsApproved.Equals(isApproved.Value))).ToList < RegistrationRequest>();
                
            }

        }
Example #8
0
        /// <summary>
        /// Crea una solicitud. No establece IsApproved = true
        /// </summary>
        /// <param name="registrationRequest"></param>
        public static void CreateRegistrationRequest(RegistrationRequest registrationRequest)
        {
            using (Health.Entities.HealthLinQDataContext dc = new Health.Entities.HealthLinQDataContext(Common.CnnString))
            {
                registrationRequest.RequetsTime = System.DateTime.Now;

                dc.RegistrationRequests.InsertOnSubmit(registrationRequest);
                dc.SubmitChanges();
            }
        }
Example #9
0
        /// <summary>
        /// Crea una solicitud. No establece IsApproved = true
        /// </summary>
        /// <param name="registrationRequest"></param>
        public static void CreateRegistrationRequest(RegistrationRequest registrationRequest)
        {
            using (Health.Entities.HealthLinQDataContext dc = new Health.Entities.HealthLinQDataContext(Common.CnnString))
            {
            
                registrationRequest.RequetsTime = System.DateTime.Now;

                dc.RegistrationRequests.InsertOnSubmit(registrationRequest);
                dc.SubmitChanges();
                
            }
        }
Example #10
0
        //public static Profesional_FullViewBE GetByGuid(Guid id)
        //{

        //    using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
        //    {
        //        var user = dc.Profesional_FullView.Where(s => s.UserId.Equals(id)).FirstOrDefault<Profesional_FullView>();
        //        return new Profesional_FullViewBE(user);

        //    }
        //}

        /// <summary>
        /// Aprueva un registro de solicitud
        /// Establece IsApproved = true y user id a Socios donde  nrsocio coincida
        /// Si viene el nro abonado solo actualizaria un dato
        /// </summary>
        /// <param name="nroSocio">Numero de socio</param>
        /// <param name="userId">Id del usuario web generado</param>
        public static void Approve(int id)
        {
            using (Health.Entities.HealthLinQDataContext dc = new Health.Entities.HealthLinQDataContext(Common.CnnString))
            {
                var r = dc.RegistrationRequests.Where(p => p.Id.Equals(id)).FirstOrDefault <RegistrationRequest>();

                r.IsApproved = true;


                dc.SubmitChanges();
            }
        }
Example #11
0
        public static List<Health.Entities.cei10_view> Retrive_View_All()
        {
            List<Health.Entities.cei10_view> list = new List<Health.Entities.cei10_view>();
            using (Health.Entities.HealthLinQDataContext dc = new Health.Entities.HealthLinQDataContext(Common.CnnString))
            {
                foreach (cei10_view c in dc.cei10_views)
                {
                    list.Add((cei10_view)c);

                }
            }
            return list;
        }
Example #12
0
        public static List <Health.Entities.cei10_view> Retrive_View_All()
        {
            List <Health.Entities.cei10_view> list = new List <Health.Entities.cei10_view>();

            using (Health.Entities.HealthLinQDataContext dc = new Health.Entities.HealthLinQDataContext(Common.CnnString))
            {
                foreach (cei10_view c in dc.cei10_views)
                {
                    list.Add((cei10_view)c);
                }
            }
            return(list);
        }
Example #13
0
        public static void Process_PMO(List <Nomenclator> list, int pmoType)
        {
            Nomenclator wNomenclator;

            using (Health.Entities.HealthLinQDataContext dc = new Health.Entities.HealthLinQDataContext(Common.CnnString))
            {
                string[] auxiliar;
                foreach (Nomenclator temp in list.OrderBy(p => p.Id))
                {
                    wNomenclator = new Nomenclator();

                    auxiliar = temp.Code.Split('.');

                    if (auxiliar.Length == 3)
                    {
                        wNomenclator.Code       = temp.Code.Trim();
                        wNomenclator.ParentCode = string.Concat(auxiliar[0], '.', auxiliar[1]);
                        wNomenclator.HasChilds  = false;
                    }

                    if (auxiliar.Length == 2)
                    {
                        wNomenclator.Code       = temp.Code.Trim();
                        wNomenclator.ParentCode = auxiliar[0].ToString();
                        wNomenclator.HasChilds  = true;
                    }


                    if (auxiliar.Length == 1)
                    {
                        wNomenclator.Code       = temp.Code.Trim();
                        wNomenclator.ParentCode = string.Empty;
                        wNomenclator.HasChilds  = true;
                    }



                    wNomenclator.Description = temp.Description.Trim();
                    wNomenclator.PMOType     = pmoType;
                    //wNomenclator.Id = temp.Id;

                    dc.Nomenclators.InsertOnSubmit(wNomenclator);
                }
                dc.SubmitChanges();
            }
        }
Example #14
0
        public static void Process_PMO_AnalisisClinicos()
        {
            using (Health.Entities.HealthLinQDataContext dc = new Health.Entities.HealthLinQDataContext(Common.CnnString))
            {
                string auxiliar = string.Empty;
                var    list     = dc.Nomenclators.Where(p => p.PMOType.Equals((int)PMOEnum.Diagnostico_Analisis_Clinico)).OrderBy(p => p.Id);
                foreach (Nomenclator PMO in list)
                {
                    if (!string.IsNullOrEmpty(PMO.Code.Trim()))
                    {
                        auxiliar = PMO.Code.Trim();
                        PMO.Code = auxiliar;
                    }

                    PMO.Code = auxiliar;
                }
                dc.SubmitChanges();
            }
        }
        internal static void Remove_SubscriptionReq(Guid pHealthInstitutionId, int pIdProfesional_To)
        {
            HealthInstitutions_SuscriptionRequestsList wProfesionalsBEList = new HealthInstitutions_SuscriptionRequestsList();
            using (HealthLinQDataContext dc = new HealthLinQDataContext(Common.CnnString))
            {
                var wSuscription = dc.HealthInstitutions_SuscriptionRequests.Where(p => p.Profesional_To.Equals(pIdProfesional_To)
                                          && p.HealthInstitutionId.Equals(p.HealthInstitutionId)).FirstOrDefault();



                dc.HealthInstitutions_SuscriptionRequests.DeleteOnSubmit(wSuscription);
                dc.SubmitChanges();
            }
        }
 /// <summary>
 /// Crea un pedido de subscripcion 
 /// </summary>
 /// <param name="pProfesionalId_From"></param>
 /// <param name="pProfesionalId_To"></param>
 /// <param name="pHealthInstitutionId"></param>
 /// <param name="rolname"></param>
 /// <param name="msg"></param>
 public static void CreateSubscription_Req(int pProfesionalId_From, int pProfesionalId_To, Guid pHealthInstitutionId, string pRolName, string pMessage)
 {
     using (HealthLinQDataContext dc = new HealthLinQDataContext(Common.CnnString))
     {
         HealthInstitutions_SuscriptionRequest req = new HealthInstitutions_SuscriptionRequest();
         req.HealthInstitutionId = pHealthInstitutionId;
         req.Profesional_To = pProfesionalId_To;
         req.ProfesionalId_From = pProfesionalId_From;
         req.RequestSend = DateTime.Now;
         if (!string.IsNullOrEmpty(pMessage))
             req.Message = pMessage;
         if (!string.IsNullOrEmpty(pRolName))
             req.RoleName = pRolName;
         dc.HealthInstitutions_SuscriptionRequests.InsertOnSubmit(req);
         dc.SubmitChanges();
     }
 }
        /// <summary>
        ///  Retorna lista  <see cref="HealthInstitutions_SuscriptionRequestsList"/> con solo id , nombre + datos de la subscripción 
        /// </summary>
        /// <param name="healthInstituteId"></param>
        /// <returns></returns>
        internal static HealthInstitutions_SuscriptionRequestsList Retrive_Subscriptions_SimpleList(Guid healthInstituteId)
        {
            HealthInstitutions_SuscriptionRequestsList wProfesionalsBEList = new HealthInstitutions_SuscriptionRequestsList();
            using (HealthLinQDataContext dc = new HealthLinQDataContext(Common.CnnString))
            {
                var AllProfesionals = from p in dc.HealthInstitutions_SuscriptionRequests
                                      from prof in dc.Profesionals
                                      where

                                          p.HealthInstitutionId.Equals(healthInstituteId)
                                          && prof.IdProfesional.Equals(p.Profesional_To)
                                      select new HealthInstitutions_SuscriptionRequestsBE
                                      {
                                          Profesional_To = prof.IdProfesional,
                                          Nombre_To = prof.Persona.Nombre,
                                          Apellido_To = prof.Persona.Apellido,
                                          RequestSend = p.RequestSend,
                                          Status = p.State,
                                          Message = p.Message
                                      };


                wProfesionalsBEList.AddRange(AllProfesionals.ToList<HealthInstitutions_SuscriptionRequestsBE>());
            }
            return wProfesionalsBEList;
        }
Example #18
0
        //public static Profesional_FullViewBE GetByGuid(Guid id)
        //{

        //    using (Health.Back.BE.HealthEntities dc = new Health.Back.BE.HealthEntities(Common.CnnString_Entities))
        //    {
        //        var user = dc.Profesional_FullView.Where(s => s.UserId.Equals(id)).FirstOrDefault<Profesional_FullView>();
        //        return new Profesional_FullViewBE(user);
                
        //    }
        //}

        /// <summary>
        /// Aprueva un registro de solicitud
        /// Establece IsApproved = true y user id a Socios donde  nrsocio coincida
        /// Si viene el nro abonado solo actualizaria un dato
        /// </summary>
        /// <param name="nroSocio">Numero de socio</param>
        /// <param name="userId">Id del usuario web generado</param>
        public static void Approve(int id)
        {
            using (Health.Entities.HealthLinQDataContext dc = new Health.Entities.HealthLinQDataContext(Common.CnnString))
            {
               var r =  dc.RegistrationRequests.Where    (p=> p.Id.Equals(id)).FirstOrDefault<RegistrationRequest>();

               r.IsApproved = true;
                

                dc.SubmitChanges();
            }
        }
        /// <summary>
        /// Lista usada para ver las solicitudes al Profesional 
        /// Retorna lista  <see cref="HealthInstitutions_SuscriptionRequestsList"/> con solo id , nombre + datos de la subscripción 
        /// Se retorna Nombre y apellido es del usuario que solicita
        /// </summary>
        /// <param name="pIdProfesional">Id del profesional que desea ver sus solicitudes pendientes</param>
        /// <returns></returns>
        internal static HealthInstitutions_SuscriptionRequestsList Retrive_PendingSubscriptions_SimpleList(int pIdProfesional)
        {
            HealthInstitutions_SuscriptionRequestsList wProfesionalsBEList = new HealthInstitutions_SuscriptionRequestsList();
            using (HealthLinQDataContext dc = new HealthLinQDataContext(Common.CnnString))
            {
                var AllProfesionals = from p in dc.HealthInstitutions_SuscriptionRequests
                                      from h in dc.HealthInstitutions
                                      from prof_from in dc.Profesionals
                                  
                                      where

                                          p.Profesional_To.Equals(pIdProfesional)
                                                && h.HealthInstitutionId.Equals(p.HealthInstitutionId)
                                          && prof_from.IdProfesional.Equals(p.ProfesionalId_From)
                                    
                                          && !p.State.Equals(SubscriptionRequestStatus.Rechazado)
                                          && !p.State.Equals(SubscriptionRequestStatus.Expirado)
                                      select new HealthInstitutions_SuscriptionRequestsBE
                                      {
                                          Profesional_To = p.Profesional_To,
                                          Profesional_From = p.ProfesionalId_From,
                                          Nombre_From = prof_from.Persona.Nombre,
                                          Apellido_From = prof_from.Persona.Apellido,
                                          RequestSend = p.RequestSend,
                                          Status = p.State,
                                          HealthInsId = h.HealthInstitutionId,
                                          HealthInstName = h.RazonSocial,
                                          SenderIsOwner = p.SenderIsOwner,
                                          Message = p.Message
                                      };


                wProfesionalsBEList.AddRange(AllProfesionals.ToList<HealthInstitutions_SuscriptionRequestsBE>());
            }
            return wProfesionalsBEList;
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pHealthInstitutionId"></param>
        /// <param name="pIdProfesional_To"></param>
        /// <param name="status"></param>
        public static void Update_Subscriptions_Status(Guid pHealthInstitutionId, int pIdProfesional_To, SubscriptionRequestStatus status)
        {
            HealthInstitutions_SuscriptionRequestsList wProfesionalsBEList = new HealthInstitutions_SuscriptionRequestsList();
            using (HealthLinQDataContext dc = new HealthLinQDataContext(Common.CnnString))
            {
                var wSuscription = dc.HealthInstitutions_SuscriptionRequests.Where(p => p.Profesional_To.Equals(pIdProfesional_To)
                                   && p.HealthInstitutionId.Equals(p.HealthInstitutionId)).FirstOrDefault();

                wSuscription.State = (int)status;
                dc.SubmitChanges();
            }

        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="pHealthInstitutionId"></param>
        /// <param name="pIdProfesional_To"></param>
        /// <param name="status"></param>
        public static void Acept_Subscriptions_Req(Guid pHealthInstitutionId, int pIdProfesional_To, Guid user_guid)
        {
            HealthInstitutions_SuscriptionRequestsList wProfesionalsBEList = new HealthInstitutions_SuscriptionRequestsList();
            using (HealthLinQDataContext dc = new HealthLinQDataContext(Common.CnnString))
            {
                var wSuscription = dc.HealthInstitutions_SuscriptionRequests.Where(p => p.Profesional_To.Equals(pIdProfesional_To)
                                          && p.HealthInstitutionId.Equals(p.HealthInstitutionId)).FirstOrDefault();



                //Asociar el Profesional
                Profesional_Associate_As_AdminOwner(pHealthInstitutionId, pIdProfesional_To, user_guid, wSuscription.RoleName);


                //Elimina la subscripcion
                dc.HealthInstitutions_SuscriptionRequests.DeleteOnSubmit(wSuscription);
                dc.SubmitChanges();



            }

        }