public List<MODEL.Journals> GetAll(int userId, int journalTypeId)
 {
     List<MODEL.Journals> JournalsList = null;
     try
     {
         using (context = new AdvocateHealthCareEntities())
             JournalsList = context.spGetJournals(userId, journalTypeId).Select(x => new MODEL.Journals
                 {
                     ProfileJournalID=x.ProfileJournalID,
                     ProfileName=x.ProfileName,
                     JournalInfo = x.JournalInfo,
                     JournalTitle = x.JournalTitle,
                     JournalAsset =x.JournalAsset,
                     LMPDate=x.LMPdate,
                    // CreatedDate=x.CreatedDate,
                     CreatedDate = x.Displaydate
                 }).ToList();
         Journals js=new Journals();
         js.JournalInfo = "Ask a new question";
         js.JournalTitle = "Question for my care providor";
        // js.JournalAsset = "http://183.82.48.194:5560/Images-Upload/add_a_journal.jpg";
         js.JournalAsset = "/Images-Upload/add_a_journal_small.png";
         JournalsList.Insert(0, js);
     }
      catch (Exception ex)
     {
         throw ex;
     }
     return JournalsList;
 }
Пример #2
0
       public List<MODEL.Tiles> GetAll(int? SUBCATEGORYID)
       {
           List<MODEL.Tiles> TilesList = null;
           try
           {
               //string path = System.IO.Path.Combine(System.Web.HttpContext.Current.Request.PhysicalApplicationPath, "Image-Upload");
               //System.IO.DirectoryInfo DirInfo = new System.IO.DirectoryInfo(path);
               //System.Security.AccessControl.DirectorySecurity DirPermission = new System.Security.AccessControl.DirectorySecurity();
               //System.Security.AccessControl.FileSystemAccessRule FRule = new System.Security.AccessControl.FileSystemAccessRule
               //    ("Everyone", System.Security.AccessControl.FileSystemRights.ReadAndExecute, System.Security.AccessControl.AccessControlType.Allow);
               //DirPermission.AddAccessRule(FRule);

               //if (DirInfo.Exists == false)
               //{
               //    System.IO.Directory.CreateDirectory(path);
               //}
               using (context = new AdvocateHealthCareEntities())

                   TilesList = context.spGetTiles(SUBCATEGORYID).Select(x => new MODEL.Tiles
                   {
                       TITLE=x.TITLE,
                       CONTENT=x.CONTENT,
                       TITLEIMAGE = x.TILEIMAGE
                   }).ToList();
           }

           catch (Exception ex)
           {
               throw ex;
           }
           return TilesList;
       }
         public int Save(MODEL.WeightEntries weightentries, DBNull t2)
         {
             var result = 0;
             var dbCtx = new AdvocateHealthCareEntities();
             var dtweightentriesType = new DataTable();
             dtweightentriesType.Columns.Add("WeightTrackerID", typeof(int));
             dtweightentriesType.Columns.Add("ProfileID", typeof(int));
             dtweightentriesType.Columns.Add("Weight", typeof(decimal));
             dtweightentriesType.Columns.Add("CreatedDate",typeof(DateTime));
             DateTime stcreateddate =Convert.ToDateTime(weightentries.CreatedDate);
             dtweightentriesType.Rows.Add(weightentries.WeightTrackerID, weightentries.ProfileID, weightentries.Weight, stcreateddate);
        // dtweightentriesType.Rows.Add(null,6,null,"2015-12-30 18:05:54.993");

             var spsaveweightTracker = new SqlParameter();
             spsaveweightTracker.ParameterName = "@WeightTrackerType";
             spsaveweightTracker.Value = dtweightentriesType;
             spsaveweightTracker.SqlDbType = SqlDbType.Structured;
             spsaveweightTracker.TypeName = "WeightTrackerType";

              var caseId = new SqlParameter("@LoggedInUser", SqlDbType.VarChar);
            // caseId.Value = "PTG";
             caseId.Value = weightentries.LoggedInUser;
       

            result = dbCtx.Database.ExecuteSqlCommand("EXEC " + DataAccess.DataAccessConstants.SaveweightTracker + " @WeightTrackerType, @LoggedInUser", new object[] { spsaveweightTracker, caseId });

            if (result == 0)
            {
                return 0;
            }
            else
            {
                return 1;
            }
        }
       public List<MODEL.Notifications> GetAll(int UserId, int HospitalId)
       {
           List<MODEL.Notifications> NotificationsList = null;
           try
           {
               using (context = new AdvocateHealthCareEntities())
                   //assessmentdetailsLst = dbCtx.spGetAssessmentDetails().Select(x => new refModel.AssessmentDetails

                   NotificationsList = context.spGetNotifications(UserId, HospitalId).Select(x => new MODEL.Notifications
                   {
                       HospitalID = x.HospitalID,
                       UserName=x.UserName,
                       NotificationID=x.NotificationID,
                       NotificationText=x.NotificationText,
                       NotificationTitle=x.NotificationTitle,
                       TypeOfNotification=x.TypeOfNotification,
                       IsRead=x.IsRead,
                       NotificationDate=x.NotificationDate,
                       HospitalName = x.HospitalName,
                   }).ToList();
           }

           catch (Exception ex)
           {
               throw ex;
           }
           return NotificationsList;
       }
 /// <summary>
 /// This method is for to update the notification from unread to read
 /// </summary>
 /// <param name="notificationreadstatus"></param>
 public void Save(NotificationReadStatus notificationreadstatus)
 {
     var result = 0;
     var dbCtx = new AdvocateHealthCareEntities();
   
     dbCtx.spSaveNotificationReadStatus(notificationreadstatus.UserID, notificationreadstatus.NotificationID);
        
     //dbCtx.spSaveNotificationReadStatus(3, 1);
    
 }
        public List<MODEL.UserSavedImages> GetAll(int userId)
        {
            List<MODEL.UserSavedImages> ImagesList = null;

            try
            {
                //var image = "text";
                ////string uri = "http://183.82.48.194:5560/api/NotificationReadStatus/" + arun;
                //string uri1 = "http://183.82.48.194:5560/api/NotificationReadStatus/" + image;
                //string userName = WebConfigurationManager.AppSettings["baseurl"];
                ////string uri = userName+"/api/NotificationReadStatus/" + arun;
                //string uri = userName + "" + image;



                //string path = System.IO.Path.Combine(System.Web.HttpContext.Current.Request.PhysicalApplicationPath, "Image-Upload");
                //System.IO.DirectoryInfo DirInfo = new System.IO.DirectoryInfo(path);
                //System.Security.AccessControl.DirectorySecurity DirPermission = new System.Security.AccessControl.DirectorySecurity();
                //System.Security.AccessControl.FileSystemAccessRule FRule = new System.Security.AccessControl.FileSystemAccessRule
                //    ("Everyone", System.Security.AccessControl.FileSystemRights.ReadAndExecute, System.Security.AccessControl.AccessControlType.Allow);
                //DirPermission.AddAccessRule(FRule);

                //if (DirInfo.Exists == false)
                //{
                //    System.IO.Directory.CreateDirectory(path);
                //}

                using (context = new AdvocateHealthCareEntities())
                    ImagesList = context.spGetUserSavedImages(userId).Select(x => new MODEL.UserSavedImages
                        {
                            JournalTitle = x.JournalTitle,
                            JournalAsset = x.JournalAsset,
                            CreatedDate = x.DisplayDate
                        }).ToList();
                UserSavedImages usi = new UserSavedImages();
               // usi.JournalAsset = "http://183.82.48.194:5560/Images-Upload/camera.jpg";
                 usi.JournalAsset ="/Images-Upload/camera.png";
              //usi.JournalAsset = "~/Images-Upload/camera-updated.png";
               
                ImagesList.Insert(0, usi);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return ImagesList;
        }
       public int Save(MODEL.ProfileJournal profilejournal, DBNull t2)
        {
            var result = 0;
            var dbCtx = new AdvocateHealthCareEntities();
            var dtProfileJournalType = new DataTable();
            dtProfileJournalType.Columns.Add("ProfileJournalID", typeof(string));
            dtProfileJournalType.Columns.Add("ProfileID", typeof(int));
            dtProfileJournalType.Columns.Add("JournalTitle", typeof(string));
            dtProfileJournalType.Columns.Add("JournalInfo", typeof(string));
            dtProfileJournalType.Columns.Add("JournalAsset", typeof(string));
            dtProfileJournalType.Columns.Add("JournalTypeID", typeof(int));
            //dtProfileJournalType.Columns.Add("CreatedDate", typeof(string));
            dtProfileJournalType.Columns.Add("CreatedDate", typeof(DateTime));
            //dtProfileJournalType.Columns.Add("CreatedBy", typeof(string));


            dtProfileJournalType.Rows.Add(profilejournal.ProfileJournalID, profilejournal.ProfileID,
                                            profilejournal.JournalTitle, profilejournal.JournalInfo,
                                            profilejournal.JournalAsset, profilejournal.JournalTypeID,
                                            profilejournal.CreatedDate);
                                        
          // dtProfileJournalType.Rows.Add(5, 2, "sirisha", null, "~/Images-Upload/gallery_img1.png", 2);
                                 

             var spSaveProfileJournal = new SqlParameter();
             spSaveProfileJournal.ParameterName = "@ProfileJournalType";
             spSaveProfileJournal.Value = dtProfileJournalType;
             spSaveProfileJournal.SqlDbType = SqlDbType.Structured;
             spSaveProfileJournal.TypeName = "ProfileJournalType";


        var caseId = new SqlParameter("@LoggedInUser", SqlDbType.VarChar);
         // caseId.Value = "PTG";
        caseId.Value = profilejournal.LoggedInUser;

           result = dbCtx.Database.ExecuteSqlCommand("EXEC " + DataAccess.DataAccessConstants.SaveProfileJournal + " @ProfileJournalType, @LoggedInUser", new object[] { spSaveProfileJournal, caseId });

            if (result == 0)
            {
                return 0;
            }
            else
            {
                return 1;
            }
        }
        public int Save(HospitalInfo hospitalinfo, DBNull t2)
        {
           
            var result = 0;
            var dbCtx = new AdvocateHealthCareEntities();
            var dtHospitalInfoType = new DataTable();

            dtHospitalInfoType.Columns.Add("HospitalID", typeof(int));
            dtHospitalInfoType.Columns.Add("HospitalName", typeof(string));
            dtHospitalInfoType.Columns.Add("Description", typeof(string));
            dtHospitalInfoType.Columns.Add("CreatedDate", typeof(DateTime));
            dtHospitalInfoType.Columns.Add("CreatedBy", typeof(string));
            dtHospitalInfoType.Columns.Add("ModifiedDate", typeof(DateTime));
            dtHospitalInfoType.Columns.Add("ModifiedBy", typeof(string));

            //dtHospitalInfoType.Rows.Add(hospitalinfo.HospitalID, hospitalinfo.HospitalName, hospitalinfo.Description,
            //                                hospitalinfo.CreatedDate, hospitalinfo.CreatedBy, hospitalinfo.ModifiedDate,
            //                                hospitalinfo.ModifiedBy);
            dtHospitalInfoType.Rows.Add(7, "dsggcxcf", "dsggfsf",
                                      null, null, null,
                                      null);


            var spSaveHospitalInfo = new SqlParameter();
            spSaveHospitalInfo.ParameterName = "@HospitalType";
            spSaveHospitalInfo.Value = dtHospitalInfoType;
            spSaveHospitalInfo.SqlDbType = SqlDbType.Structured;
            spSaveHospitalInfo.TypeName = "HospitalType";


            var caseId = new SqlParameter("@LoggedInUser", SqlDbType.VarChar);
            //caseId.Value = hospitalinfo.LoggedInUser;
            caseId.Value = "PTG";
            result = dbCtx.Database.ExecuteSqlCommand("EXEC " + DataAccess.DataAccessConstants.SaveHospitalInfo + "@HospitalType, @LoggedInUser", new object[] { spSaveHospitalInfo, caseId });

            if (result == 0)
            {
                return 0;
            }
            else
            {
                return 1;
            }
        }
        public int Save(MODEL.NotificationType notificationtype, DBNull t2)
        {
         
            var result = 0;
            var dbCtx = new AdvocateHealthCareEntities();
            var dtnotificationType = new DataTable();
            dtnotificationType.Columns.Add("NotificationID", typeof(int));
            dtnotificationType.Columns.Add("NotificationTypeID", typeof(int));
            dtnotificationType.Columns.Add("ProfileID", typeof(int));
            dtnotificationType.Columns.Add("Title", typeof(string));
            dtnotificationType.Columns.Add("Comments", typeof(string));
            dtnotificationType.Columns.Add("IsRead", typeof(bool));
            dtnotificationType.Columns.Add("CreatedDate", typeof(DateTime));
            dtnotificationType.Columns.Add("CreatedBy", typeof(string));


            dtnotificationType.Rows.Add(notificationtype.NotificationID, notificationtype.NotificationTypeID, notificationtype.ProfileID,
                                        notificationtype.Title, notificationtype.Comments, notificationtype.IsRead, notificationtype.CreatedDate,
                                        notificationtype.CreatedBy);

            //dtnotificationType.Rows.Add(7,1,3,"Pregnancy",null,null,null,null);


            var spSaveNotifications = new SqlParameter();
            spSaveNotifications.ParameterName = "@NotificationType";
            spSaveNotifications.Value = dtnotificationType;
            spSaveNotifications.SqlDbType = SqlDbType.Structured;
            spSaveNotifications.TypeName = "NotificationType";


            var caseId = new SqlParameter("@LoggedInUser", SqlDbType.VarChar);
            caseId.Value = notificationtype.LoggedInUser;
         // caseId.Value = "PTG";
            result = dbCtx.Database.ExecuteSqlCommand("EXEC " + DataAccess.DataAccessConstants.SaveNotifications + " @NotificationType, @LoggedInUser", new object[] { spSaveNotifications, caseId });

            if (result == 0)
            {
                return 0;
            }
            else
            {
                return 1;
            }
        }
   public List<MODEL.WeightEntries> GetAll(int userId)
 {
     List<MODEL.WeightEntries> WeightEntriesList = null;
     try
     {
         using (context = new AdvocateHealthCareEntities())
             WeightEntriesList = context.spGetWeightEntries(userId).Select(x => new MODEL.WeightEntries
                 {
                     Weight=x.Weight,
                     LMPDATE=x.LMPDATE,
                     CreatedDate=x.DisplayDate
                 }).ToList();
     }
      catch (Exception ex)
     {
         throw ex;
     }
     return WeightEntriesList;
 }
  //public List<MODEL.JournalVideos> GetAll()
 /// <summary>
 /// this method is used to get the videos based on SUBCATEGORYID
 /// </summary>
 /// <param name="SUBCATEGORYID"></param>
 /// <returns></returns>
 public List<MODEL.JournalVideos> GetAll(int? SUBCATEGORYID)
 {
     List<MODEL.JournalVideos> JournalVideosList = null;
     try
     {
         
         using (context = new AdvocateHealthCareEntities())
             JournalVideosList = context.spGetJournalVideos(SUBCATEGORYID).Select(x => new MODEL.JournalVideos
                 {
                     JournalVideoName = x.JournalVideoName,
                     JournalVideoAsset = x.JournalVideoAsset
                 }).ToList();
     }
     catch (Exception ex)
     {
         throw ex;
     }
     return JournalVideosList;
 }
        public List<MODEL.HospitalInfo> GetAll()
        {
            List<MODEL.HospitalInfo> hosipitalDetailsList = null;
            try
            {
                using (context = new AdvocateHealthCareEntities())

                    hosipitalDetailsList = context.spGetHosipitalDetails().Select(x => new MODEL.HospitalInfo
                       {
                           HospitalID = x.HospitalID,
                           HospitalName = x.HospitalName,
                       }).ToList();
            }

            catch (Exception ex)
            {
                throw ex;
            }
            return hosipitalDetailsList;
        }
       public List<MODEL.ContentSearch> GetAll(string String )
       {
           List<MODEL.ContentSearch> ContentSearchList = null;
           try
           {
              
               using (context = new AdvocateHealthCareEntities())
                   ContentSearchList = context.spGetContentSearch(String).Select(x => new MODEL.ContentSearch
                   {
                       Title=x.Title,
                       Content=x.Content,
                       TileImage=x.TileImage
                   }).ToList();
           }

           catch (Exception ex)
           {
               throw ex;
           }
           return ContentSearchList;
       }
       /// <summary>
       /// This method is used to get the images based on Hospital selection
       /// </summary>
       /// <param name="UserID"></param>
       /// <param name="HospitalID"></param>
       /// <param name="AssetPositionID"></param>
       /// <returns></returns>
       public List<MODEL.HospitalImages> GetAll(int UserID, int HospitalID, byte? AssetPositionID)
    
       {
           List<MODEL.HospitalImages> HospitalImagesList = null;
           try
           {
                using (context = new AdvocateHealthCareEntities())
                    HospitalImagesList = context.spGetHosipitalImages(UserID, HospitalID, AssetPositionID).Select(x => new MODEL.HospitalImages
                   {
                       AssetURL=x.AssetURL,
                       AssetText=x.AssetText,
                       AssetImage=x.AssetImage,
                       AssetPositionID = x.AssetPositionID.Value

                   }).ToList();
           }
            catch (Exception ex)
            {
                throw ex;
            }
            return HospitalImagesList;
        }
       /// <summary>
       /// This method is used to save the Hospital Images
       /// </summary>
       /// <param name="hospitalimages"></param>
       /// <param name="t2"></param>
       /// <returns></returns>
       public int Save(MODEL.HospitalImages hospitalimages, DBNull t2)
       {
           var result = 0;
           var dbCtx = new AdvocateHealthCareEntities();
           var dtHospitalImagesType = new DataTable();
           dtHospitalImagesType.Columns.Add("HospitalImagesID", typeof(int));
           dtHospitalImagesType.Columns.Add("HospitalID", typeof(int));
           dtHospitalImagesType.Columns.Add("AssetURL", typeof(string));
           dtHospitalImagesType.Columns.Add("AssetText", typeof(string));
           dtHospitalImagesType.Columns.Add("AssetImage", typeof(string));
           dtHospitalImagesType.Columns.Add("AssetPositionID", typeof(byte));

            dtHospitalImagesType.Rows.Add(hospitalimages.HospitalImagesID, hospitalimages.HospitalID,
                                         hospitalimages.AssetURL, hospitalimages.AssetText, hospitalimages.AssetImage,hospitalimages.AssetPositionID);

         //  dtHospitalImagesType.Rows.Add(null,4,null);

           var spSaveHospitalImages = new SqlParameter();
           spSaveHospitalImages.ParameterName = "@HospitalImagesType";
           spSaveHospitalImages.Value = dtHospitalImagesType;
           spSaveHospitalImages.SqlDbType = SqlDbType.Structured;
           spSaveHospitalImages.TypeName = "HospitalImagesType";

           var caseId = new SqlParameter("@LoggedInUser", SqlDbType.VarChar);
            //caseId.Value = "PTG";
          caseId.Value = hospitalimages.LoggedInUser;

           result = dbCtx.Database.ExecuteSqlCommand("EXEC " + DataAccess.DataAccessConstants.SaveHospitalImages + " @HospitalImagesType, @LoggedInUser", new object[] { spSaveHospitalImages, caseId });

           if (result == 0)
           {
               return 0;
           }
           else
           {
               return 1;
           }
       }
 public MODEL.AuthenticateLogin GetAll(string UserEmailId, string UserPwd)
 {
     MODEL.AuthenticateLogin LoginList = null;
    
     try
     {
         using (context = new AdvocateHealthCareEntities())
         {
             LoginList = context.spAuthenticateLogin(UserEmailId, UserPwd).Select(x => new MODEL.AuthenticateLogin
             {
                 HospitalID = Convert.ToInt32(x.HospitalID),
                 ProfileID = Convert.ToInt32(x.ProfileID),
                 Flag=x.Flag
             }).FirstOrDefault();
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
     
     return LoginList;
 }
        /// <summary>
        /// This Method is for create new Profile .
        /// </summary>
        /// <param name="profileinfo"></param>
        /// <param name="t2"></param>
        /// <returns></returns>
        public int Save(ProfileInfo profileinfo, DBNull t2)
        {

            // byte[] byteArray = profileinfo.picture1;

            // MemoryStream ms = new MemoryStream(byteArray);
            // System.Drawing.Image im = System.Drawing.Image.FromStream(ms);

            //// im.Save("~/images/1111.jpg");
            // System.Web.Hosting.HostingEnvironment.MapPath("~/Images-Upload/1111.jpg");

            var result = 0;
            var dbCtx = new AdvocateHealthCareEntities();
            var dtProfileInfoType = new DataTable();
            dtProfileInfoType.Columns.Add("ProfileID", typeof(int));
            dtProfileInfoType.Columns.Add("FirstName", typeof(string));
            dtProfileInfoType.Columns.Add("LastName", typeof(string));
            dtProfileInfoType.Columns.Add("Email", typeof(string));
            dtProfileInfoType.Columns.Add("Password", typeof(string));
            dtProfileInfoType.Columns.Add("LMPdate", typeof(DateTime));
            dtProfileInfoType.Columns.Add("Picture", typeof(string));
            dtProfileInfoType.Columns.Add("HospitalID", typeof(int));
            dtProfileInfoType.Columns.Add("CreatedDate", typeof(DateTime));

            dtProfileInfoType.Rows.Add(profileinfo.ProfileID, profileinfo.FirstName, profileinfo.LastName,
                                       profileinfo.Email, profileinfo.Password, profileinfo.LMPdate,
                                       profileinfo.Picture, profileinfo.HospitalID, profileinfo.CreatedDate);

            //dtProfileInfoType.Rows.Add(null, "dsggcxcf", "dsggfsf", "*****@*****.**", 123, null, null, 1,

            //                            DateTime.Now);

            var spSaveProfileInfo1 = new SqlParameter();
            spSaveProfileInfo1.ParameterName = "@ProfileType";
            spSaveProfileInfo1.Value = dtProfileInfoType;
            spSaveProfileInfo1.SqlDbType = SqlDbType.Structured;
            spSaveProfileInfo1.TypeName = "ProfileType";

            var caseId = new SqlParameter("@LoggedInUser", SqlDbType.VarChar);
            // caseId.Value = "PTG";
           caseId.Value = profileinfo.LoggedInUser;


            //This code is for Return the Output value

             var spReturn = new SqlParameter("RetVal", SqlDbType.Int, 100);
             spReturn.Direction = ParameterDirection.Output;



            //result = dbCtx.Database.ExecuteSqlCommand("EXEC " + DataAccess.DataAccessConstants.SaveProfileInfo + " @ProfileType, @LoggedInUser", new object[] { spSaveProfileInfo1, caseId });

             result = dbCtx.Database.ExecuteSqlCommand("EXEC " + DataAccess.DataAccessConstants.SaveProfileInfo1 + " @ProfileType, @LoggedInUser,@RetVal OUTPUT", new object[] { spSaveProfileInfo1, caseId, spReturn });

           return (int)spReturn.Value == 0 ? 0 : 1;

            //if (result >1)
            //{
            //    return 1;
            //}
            //else
            //{
            //    return 0;
            //}
        }