예제 #1
0
        internal SessionResponseStudentModel GetSessionInfoForStudent(UniqueRequestModel objReq)
        {
            using (var db = new WizzDataContext())
            {
                SessionResponseStudentModel sessObj = new SessionResponseStudentModel();
                List<SessionResponseStudentModel> tutorList = new List<SessionResponseStudentModel>();
                int userId = Convert.ToInt32(objReq.userId);
                tblInviteFriend friendsData = new tblInviteFriend();
                friendsData = db.tblInviteFriends.Where(x => x.fkFriendId == userId).FirstOrDefault();
                if (friendsData != null)
                {

                    objReq.userId = Convert.ToString(friendsData.fkUserId);
                }
                var sessionList = db.usp_GetSessions(Convert.ToInt32(objReq.userId)).ToList();


                foreach (var c in sessionList)
                {
                    SessionResponseStudentModel model = new SessionResponseStudentModel();

                    if (db.tblInviteFriends.Any(x => x.fkUserId == Convert.ToInt32(objReq.userId) && x.isDelete == true))
                        continue;
                    model.homeWork = c.homeWork;
                    model.homeWorkDueDate = c.homeWorkDueDate;
                    model.latitude = Convert.ToString(c.lat);
                    model.location = c.location;
                    model.longitude = Convert.ToString(c.longi);
                    model.profilePic = c.profilePic;
                    //model.sessionEndTime = c.;
                    model.sessionStartTime = c.sessionStartTime;
                    model.fromTime = ReverseTimeConversionMethod(c.fromTime);
                    model.toTime = ReverseTimeConversionMethod(c.toTime);
                    model.dayType = Convert.ToString(c.dayType);
                    model.subjectName = c.subjectName.ToString();
                    model.tutorId = c.tutorId.ToString();
                    model.tutorName = c.tutorName;
                    model.sessionId = c.uniqueRequestId;
                    var friendData = db.usp_GetFriendsOfUser(c.uniqueRequestId).ToList();
                    foreach (var d in friendData)
                    {

                        FriendsListModel mod = new FriendsListModel();
                        if (d.fkFriendId == Convert.ToInt32(objReq.userId) || d.isDelete == false)
                            continue;
                        //  pkId=Convert.ToString(d.fId),
                        mod.friendId = Convert.ToString(d.fkFriendId);
                        mod.friendName = d.frienName == "" ? d.userName : d.frienName;
                        mod.amount = "";
                        //  friendphoneNumber = d.friendPhone == "" ? d.phoneNum : d.friendPhone,
                        mod.isConfirm = Convert.ToString(d.isConfirm);
                        mod.profilePic = string.IsNullOrWhiteSpace(d.profilePic) ? "" : d.profilePic.IndexOf("http") >= 0 ? d.profilePic : Constants.imagepath + d.profilePic;
                        model.friendsList.Add(mod);
                    }

                    //model.friendsList = (from d in db.usp_GetFriendsOfUser(c.uniqueRequestId)
                    //                 select new 
                    //                 {

                    //                 }).ToList();

                    tutorList.Add(model);
                }
                sessObj = tutorList.Where(x => x.sessionId == objReq.uniqueRequestId).FirstOrDefault();
                return sessObj;
            }
        }
예제 #2
0
        internal List<SessionResponseStudentModel> GetSessionsForStudent(RequestEntity objReq)
        {
            using (var db = new WizzDataContext())
            {

                List<SessionResponseStudentModel> tutorList = new List<SessionResponseStudentModel>();
                int userId = Convert.ToInt32(objReq.userId);
                tblInviteFriend friendsData = new tblInviteFriend();
                friendsData = db.tblInviteFriends.Where(x => x.fkFriendId == userId).FirstOrDefault();
                if (friendsData != null)
                {

                    objReq.userId = Convert.ToString(friendsData.fkUserId);
                }
                var sessionList = db.usp_GetSessions(Convert.ToInt32(objReq.userId)).ToList();


                foreach (var c in sessionList)
                {
                    SessionResponseStudentModel model = new SessionResponseStudentModel();


                    model.homeWork = c.homeWork;
                    model.homeWorkDueDate = c.homeWorkDueDate;
                    model.latitude = Convert.ToString(c.lat);
                    model.location = c.location;
                    model.longitude = Convert.ToString(c.longi);
                    model.profilePic = c.profilePic;
                    model.sessionEndTime = c.toTime;
                    model.sessionStartTime = c.fromTime;
                    model.fromTime = ReverseTimeConversionMethod(c.fromTime);
                    model.toTime = ReverseTimeConversionMethod(c.toTime);
                    model.dayType = Convert.ToString(c.dayType);
                    model.subjectName = c.subjectName.ToString();
                    model.tutorId = c.tutorId.ToString();
                    model.tutorName = c.tutorName;
                    model.sessionId = c.sessionId.ToString();
                    model.uniqueRequestId = c.uniqueRequestId;
                    var friendData = db.usp_GetFriendsOfUser(c.sessionId.ToString()).ToList();
                    if (friendData.Count > 0)
                    {
                        foreach (var d in friendData)
                        {

                            FriendsListModel mod = new FriendsListModel();
                            if (d.fkFriendId == Convert.ToInt32(objReq.userId) || d.isDelete == true)
                            {

                                continue;
                            }


                            mod.friendId = Convert.ToString(d.fkFriendId);
                            mod.friendName = d.frienName == "" ? d.userName : d.frienName;
                            mod.amount = "";

                            mod.isConfirm = Convert.ToString(d.isConfirm);
                            mod.profilePic = string.IsNullOrWhiteSpace(d.profilePic) ? "" : d.profilePic.IndexOf("http") >= 0 ? d.profilePic : Constants.imagepath + d.profilePic;
                            if (mod.friendId == null)
                            {


                            }
                            else
                            {
                                model.friendsList.Add(mod);

                            }


                        }
                    }



                    tutorList.Add(model);
                }

                return tutorList;
            }
        }