public ActionResult ExistingPatient()
        {
            WallEntities wb = new WallEntities();
            //users from usersinrole patient....
            IEnumerable <aspnet_UsersInRoles> users = wb.aspnet_UsersInRoles.Where(p => p.aspnet_Roles.RoleName == "Patient");
            var musers = new List <MembershipUser>();

            foreach (var u in users)
            {
                MembershipUser pat = Membership.GetUser(u.UserId);
                musers.Add(pat);
            }
            List <ExistingPatient> patients = new List <ExistingPatient>();

            foreach (var u in musers)
            {
                if (u != null)
                {
                    var userId = u.ProviderUserKey.ToString();
                    patients.Add(new ExistingPatient()
                    {
                        UserId      = userId,
                        PatientName = u.UserName,
                        EmailId     = u.Email
                    });
                }
            }
            return(View(patients));
        }
示例#2
0
        public IEnumerable <AppointmentNew> Get(string PatientId)
        {
            WallEntities db = new WallEntities();
            IEnumerable <Appointment> app     = _appointments.GetByUserId(PatientId);
            List <AppointmentNew>     appoint = new List <AppointmentNew>();

            foreach (var a in app)
            {
                Guid           userid = new Guid(a.UserId);
                MembershipUser pat    = Membership.GetUser(userid);
                AppointmentNew appnew = new AppointmentNew();
                appnew._id            = a._id;
                appnew.Address        = a.Address;
                appnew.AppointmentsID = a.AppointmentsID;
                appnew.CenterName     = a.CenterName;
                appnew.Reason         = a.Reason;
                appnew.Date           = a.Date;
                appnew.Time           = a.Time;
                appnew.EncounterType  = a.EncounterType;
                appnew.Physician      = a.Physician;
                appnew.Patient        = pat.UserName;
                appnew.UserId         = a.UserId;
                appoint.Add(appnew);
            }

            //return appoint.AsEnumerable();
            IEnumerable <AppointmentNew> appointnew = appoint.AsEnumerable();

            return(appointnew);
        }
示例#3
0
 // GET api/WallPost
 public void GetPosts()
 {
     using (WallEntities db = new WallEntities())
     {
         var ret = (from post in db.Posts.ToList()
                    orderby post.PostedDate descending
                    select new
         {
             Message = post.Message,
             PostedBy = post.PostedBy,
             PostedByName = post.UserProfile.UserName,
             PostedByAvatar = imgFolder + (String.IsNullOrEmpty(post.UserProfile.AvatarExt) ? defaultAvatar : post.PostedBy + "." + post.UserProfile.AvatarExt),
             PostedDate = post.PostedDate,
             PostId = post.PostId,
             PostComments = from comment in post.PostComments.ToList()
                            orderby comment.CommentedDate
                            select new
             {
                 CommentedBy = comment.CommentedBy,
                 CommentedByName = comment.UserProfile.UserName,
                 CommentedByAvatar = imgFolder + (String.IsNullOrEmpty(comment.UserProfile.AvatarExt) ? defaultAvatar : comment.CommentedBy + "." + comment.UserProfile.AvatarExt),
                 CommentedDate = comment.CommentedDate,
                 CommentId = comment.CommentId,
                 Message = comment.Message,
                 PostId = comment.PostId
             }
         }).ToArray();
         Clients.All.loadPosts(ret);
     }
 }
        //
        // GET: /Verification/

        public ActionResult Verify(string useradminid, string Useraccess)
        {
            if (Useraccess != null)
            {
                using (WallEntities db = new WallEntities())
                {
                    AuthenticationUser authuser = db.AuthenticationUsers.Where(a => a.UserAccess == Useraccess && a.UserAdmin == useradminid).FirstOrDefault();
                    authuser.Verification = "Verify";
                    db.SaveChanges();
                }
            }

            return(View());
        }
示例#5
0
        // POST api/WallPost
        public HttpResponseMessage PostPost(Post post)
        {
            using (var db = new WallEntities())
            {
                post.PostedBy   = WebSecurity.CurrentUserId;
                post.PostedDate = DateTime.UtcNow;
                ModelState.Remove("post.PostedBy");
                ModelState.Remove("post.PostedDate");

                if (ModelState.IsValid)
                {
                    try
                    {
                        db.Database.Connection.Open();
                        db.Posts.Add(post);
                        db.SaveChanges();
                    }
                    catch (Exception e)
                    {
                        string err = e.Message;
                    }

                    var usr = db.UserProfiles.FirstOrDefault(x => x.UserId == post.PostedBy);
                    var ret = new
                    {
                        Message        = post.Message,
                        PostedBy       = post.PostedBy,
                        PostedByName   = usr.UserName,
                        PostedByAvatar = imgFolder + (String.IsNullOrEmpty(usr.AvatarExt) ? defaultAvatar : post.PostedBy + "." + post.UserProfile.AvatarExt),
                        PostedDate     = post.PostedDate,
                        PostId         = post.PostId
                    };
                    HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.Created, ret);
                    response.Headers.Location = new Uri(Url.Link("DefaultApi", new { id = post.PostId }));
                    return(response);
                }
                else
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
                }
            }
        }
示例#6
0
 public dynamic AddComment(PostComment postcomment)
 {
     postcomment.CommentedBy   = WebSecurity.CurrentUserId;
     postcomment.CommentedDate = DateTime.UtcNow;
     using (WallEntities db = new WallEntities())
     {
         db.PostComments.Add(postcomment);
         db.SaveChanges();
         var usr = db.UserProfiles.FirstOrDefault(x => x.UserId == postcomment.CommentedBy);
         var ret = new
         {
             CommentedBy       = postcomment.CommentedBy,
             CommentedByName   = usr.UserName,
             CommentedByAvatar = imgFolder + (String.IsNullOrEmpty(usr.AvatarExt) ? defaultAvatar : postcomment.CommentedBy + "." + postcomment.UserProfile.AvatarExt),
             CommentedDate     = postcomment.CommentedDate,
             CommentId         = postcomment.CommentId,
             Message           = postcomment.Message,
             PostId            = postcomment.PostId
         };
         Clients.Others.newComment(ret, postcomment.PostId);
         return(ret);
     }
 }
示例#7
0
        public void AddPost(Post post)
        {
            post.PostedBy   = WebSecurity.CurrentUserId;
            post.PostedDate = DateTime.UtcNow;
            using (WallEntities db = new WallEntities())
            {
                db.Posts.Add(post);
                db.SaveChanges();
                var usr = db.UserProfiles.FirstOrDefault(x => x.UserId == post.PostedBy);
                var ret = new
                {
                    Message        = post.Message,
                    PostedBy       = post.PostedBy,
                    PostedByName   = usr.UserName,
                    PostedByAvatar = imgFolder + (String.IsNullOrEmpty(usr.AvatarExt) ? defaultAvatar : post.PostedBy + "." + post.UserProfile.AvatarExt),
                    PostedDate     = post.PostedDate,
                    PostId         = post.PostId
                };

                Clients.Caller.addPost(ret);
                Clients.Others.newPost(ret);
            }
        }