public RequestEntityPersistenceImp(RequestEntity entity)
 {
     PersistentId = entity.PersistentId;
     Value = entity.Value;
     Description = entity.Description;
     Date = entity.Date;
     Category = new CategoryEntityStub(entity.Category);
 }
Exemplo n.º 2
0
        internal UserResponse GetUserRequest(RequestEntity objReq)
        {
            UserResponse objResponse = new UserResponse();
            using (var db = new WizzDataContext())
            {
                if (objReq.isTutor.ToLower() == "true")
                {


                }
                else
                {
                    var tutorData = db.tblTutorSchedules.Where(x => x.fkUserId == Convert.ToInt64(objReq.userId)).ToList();

                    TutorScheduleModel objTutor = new TutorScheduleModel();
                    objTutor.userId = objReq.userId;
                    DayTimeModel dtmObj = new DayTimeModel();
                    foreach (var n in tutorData)
                    {
                        dtmObj = new DayTimeModel();
                        dtmObj.dayType = Convert.ToString(n.dayType);
                        dtmObj.fromTime = ReverseTimeConversionMethod(n.fromTime);
                        dtmObj.toTime = ReverseTimeConversionMethod(n.toTime);
                        objTutor.scheduleList.Add(dtmObj);
                    }

                    objResponse.tutorObj = objTutor;
                }
               
                return objResponse;
                //throw new NotImplementedException();
            }
        }
 private RequestViewModel CreateRequestViewModelFromEntity(RequestEntity requestEntity)
 {
     var requestViewModel = new RequestViewModel(Application, requestEntity.PersistentId);
     requestViewModel.Refresh();
     return requestViewModel;
 }
        public Response<SessionResponseTutorModel> GetSessionsForTutor(RequestEntity objReq)
        {
            Response<SessionResponseTutorModel> response = new Response<SessionResponseTutorModel>();
            List<SessionResponseTutorModel> objResp = new List<SessionResponseTutorModel>();
            try
            {
                Session obj = new Session();
                if (CheckRequestIsvalidornot(this.Request))
                {
                    objDbMethodV2 = new Dal.DbMethodsV2();
                    objResp = objDbMethodV2.GetSessionsForTutor(objReq);
                    if (objResp.Count > 0)
                        response.Create(true, Messages.FormatMessage(Messages.Success, "Session List"), Messages.AppVersion, objResp);
                    else
                        response.Create(true, Messages.FormatMessage(Messages.NoRecord), Messages.AppVersion, objResp);
                }
                else
                {

                    response.Create(false, Messages.FormatMessage(Messages.NotAllowedUser), Messages.AppVersion, objResp);
                }
            }
            catch (Exception ex)
            {
                object session = new JavaScriptSerializer().Serialize(objReq);
                LogManager.Error("Error occured while Processing Webservice request :{0}", ex, session, ex.Message);
                response.Create(false, Messages.FormatMessage(Messages.ErrorOccure), Messages.AppVersion, objResp);
            }
            return response;
        }
Exemplo n.º 5
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;
            }
        }
Exemplo n.º 6
0
        internal List<SessionResponseTutorModel> GetSessionsForTutor(RequestEntity objReq)
        {
            using (var db = new WizzDataContext())
            {

                List<SessionResponseTutorModel> studentList = new List<SessionResponseTutorModel>();
                var ListData = db.usp_GetSessionsForTutor(Convert.ToInt32(objReq.userId)).ToList();
                Int32 tutorId = Convert.ToInt32(objReq.userId);
                foreach (var c in ListData)
                {
                    SessionResponseTutorModel obj = new SessionResponseTutorModel();


                    obj.homeWork = c.homeWork;
                    obj.homeWorkDueDate = c.homeWorkDueDate;
                    obj.latitude = Convert.ToString(c.lat);
                    obj.location = c.location;
                    obj.longitude = Convert.ToString(c.longi);
                    obj.profilePic = c.profilePic;
                    obj.sessionEndTime = c.toTime;
                    obj.sessionStartTime = c.fromTime;
                    obj.fromTime = ReverseTimeConversionMethod(c.fromTime);
                    obj.toTime = ReverseTimeConversionMethod(c.toTime);
                    obj.dayType = Convert.ToString(c.dayType);
                    obj.subjectName = c.subjectName.ToString();
                    obj.studentId = c.studentId.ToString();
                    obj.studentName = c.studentName;
                    obj.uniqueRequestId = c.uniqueRequestId;
                    obj.sessionId = c.sessionId.ToString();
                    //var frien
                    // obj.friendsList = (from d in db.usp_GetFriendsOfUser(c.uniqueRequestId)
                    //                    select new FriendsListModel
                    //                    {
                    //                        friendId = Convert.ToString(d.fkFriendId),
                    //                        friendName = d.frienName == "" ? d.userName : d.frienName,
                    //                        amount = "",
                    //                        isConfirm = Convert.ToString(d.isConfirm),
                    //                        profilePic = string.IsNullOrWhiteSpace(d.profilePic) ? "" : d.profilePic.IndexOf("http") >= 0 ? d.profilePic : Constants.imagepath + d.profilePic
                    //                    }).ToList();
                    var friendData = db.usp_GetFriendsOfUser(c.sessionId.ToString()).ToList();
                    foreach (var d in friendData)
                    {

                      
                        if (d.fkFriendId == Convert.ToInt32(objReq.userId) || d.isDelete == true)
                        {

                            continue;
                        }
                        FriendsListModel mod = new FriendsListModel();
                        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
                        {
                            obj.friendsList.Add(mod);

                        }


                    }


                    obj.sessionCost = CalculateSessionCost(fromTime: obj.fromTime, friendsCount: obj.friendsList.Count, db: db, toTime: obj.toTime, tutorId: tutorId);
                    studentList.Add(obj);

                }

                return studentList;
            }
        }
Exemplo n.º 7
0
        public async Task <ResponseData <yy_News_Type> > Get(RequestEntity value)
        {
            //查询的表名称
            Type Table = typeof(yy_News_Type);

            var FormData = await Request.Content.ReadAsAsync <Dictionary <String, String> >();

            #region where condition

            //筛选条件
            var Where = String.Empty;

            var WhereBuild = new List <string>();

            #region 新闻标题
            if (!String.IsNullOrEmpty(value.Title))
            {
                WhereBuild.Add("Title like '%" + value.Title + "%'");
            }
            #endregion

            #region 新闻分类
            if (value.TypeID > 0)
            {
                WhereBuild.Add("TypeIDs like '%," + value.TypeID + ",%'");
            }
            #endregion

            #region 根据时间过滤
            #region 大于等于 开始时间 && 小于等于 结束时间
            if (!String.IsNullOrEmpty(value.StartTime) && !String.IsNullOrEmpty(value.EndTime))
            {
                DateTime st, et;

                if (DateTime.TryParse(value.StartTime, out st) && DateTime.TryParse(value.EndTime, out et))
                {
                    WhereBuild.Add(" CreateDate >= '" + st.ToString("yyyy-MM-dd") + " 00:00:00' AND CreateDate <= '" + et.ToString("yyyy-MM-dd") + " 23:59:59'");
                }
            }
            #endregion
            #region 大于等于开始时间
            else if (!String.IsNullOrEmpty(value.StartTime))
            {
                DateTime st;
                if (DateTime.TryParse(value.StartTime, out st))
                {
                    WhereBuild.Add(" CreateDate >= '" + st.ToString("yyyy-MM-dd") + " 00:00:00'");
                }
            }
            #endregion
            #region 小于等于结束时间
            else if (!String.IsNullOrEmpty(value.EndTime))
            {
                DateTime et;
                if (DateTime.TryParse(value.EndTime, out et))
                {
                    WhereBuild.Add(" CreateDate <= '" + et.ToString("yyyy-MM-dd") + " 23:59:59'");
                }
            }
            #endregion
            #endregion

            if (WhereBuild.Count > 0)
            {
                Where = " WHERE " + String.Join(" AND ", WhereBuild);
            }
            #endregion

            #region OrderBy
            //排序规则
            String OrderBy = " ID DESC ";
            if (!String.IsNullOrEmpty(value.OrderBy))
            {
                OrderBy = " " + value.OrderBy + " " + (value.IsDesc ? "DESC" : "ASC");
            }
            #endregion

            #region 拼接sql语句
            String colsStr = " * ";
            #region  查询数据
            String QuertCMD = String.Format(@"SELECT TOP {0} * FROM (
                                SELECT ROW_NUMBER() OVER (ORDER BY {4}) AS RowNumber," + colsStr + @" FROM {2} WITH(NOLOCK) {3} 
                                ) A WHERE RowNumber > {0} * ({1}-1)", value.PageSize, value.PageIndex + 1, "[" + Table.Name + "]", Where, OrderBy);
            #endregion
            #region 查询总数
            String DataCountCMD = @"SELECT COUNT(1) FROM [" + Table.Name + "] WITH(NOLOCK) " + Where;
            #endregion
            #endregion

            #region 执行查询并返回数据
            var DataCount = DB.Database.SqlQuery <int>(DataCountCMD).FirstOrDefault();
            return(new ResponseData <yy_News_Type>(value.PageSize,
                                                   value.PageIndex,
                                                   DataCount,
                                                   (DataCount % value.PageSize == 0 ? DataCount / value.PageSize : DataCount / value.PageSize + 1),
                                                   DB.Database.SqlQuery <yy_News_Type>(QuertCMD).ToList()));

            #endregion
        }
Exemplo n.º 8
0
 void OpenRequestEditForm(RequestEntity request)
 {
     _mainController.OpenRequestEditForm(request, false);
     _requestIdentCash.Add(request.CloneKey);
 }
Exemplo n.º 9
0
 public async Task <IResponseEntity> GetList(RequestEntity <ApiFilterRequest> req)
 {
     return(await _sysApiService.GetListAsync(req));
 }
Exemplo n.º 10
0
        public async Task <ResponseData <FansNewsItem> > News(RequestEntity value)
        {
            //查询的表名称
            Type Table = typeof(yy_News);

            var FormData = await Request.Content.ReadAsAsync <Dictionary <String, String> >();

            #region where condition
            //筛选条件
            var Where = String.Empty;

            var WhereBuild = new List <string>();

            #region 新闻标题
            if (!String.IsNullOrEmpty(value.Title))
            {
                WhereBuild.Add("Title like '%" + value.Title + "%'");
            }
            #endregion

            #region 新闻分类
            if (value.TypeID > 0)
            {
                WhereBuild.Add("TypeIDs like '%," + value.TypeID + ",%'");
            }
            #endregion

            if (WhereBuild.Count > 0)
            {
                Where = " WHERE " + String.Join(" AND ", WhereBuild);
            }
            #endregion

            #region OrderBy
            //排序规则
            String OrderBy = " ID DESC ";
            if (!String.IsNullOrEmpty(value.OrderBy))
            {
                OrderBy = " " + value.OrderBy + " " + (value.IsDesc ? "DESC" : "ASC");
            }
            #endregion

            #region 拼接sql语句
            String colsStr = " ID,Title,Summary,LookCount,WechatNewsUrl,DefaultImg,CreateDate ";
            #region  查询数据
            String QuertCMD = String.Format(@"SELECT TOP {0} * FROM (
                                SELECT ROW_NUMBER() OVER (ORDER BY {4}) AS RowNumber," + colsStr + @" FROM {2} WITH(NOLOCK) {3} 
                                ) A WHERE RowNumber > {0} * ({1}-1)", value.PageSize, value.PageIndex + 1, "[" + Table.Name + "]", Where, OrderBy);
            #endregion
            #region 查询总数
            String DataCountCMD = @"SELECT COUNT(1) FROM [" + Table.Name + "] WITH(NOLOCK) " + Where;
            #endregion
            #endregion

            #region 执行查询并返回数据
            var DataCount = DB.Database.SqlQuery <int>(DataCountCMD).FirstOrDefault();
            return(new ResponseData <FansNewsItem>(value.PageSize,
                                                   value.PageIndex,
                                                   DataCount,
                                                   (DataCount % value.PageSize == 0 ? DataCount / value.PageSize : DataCount / value.PageSize + 1),
                                                   DB.Database.SqlQuery <FansNewsItem>(QuertCMD).ToList()));

            #endregion
        }
Exemplo n.º 11
0
 /// <summary>
 /// 各自处理
 /// </summary>
 /// <param name="requestEntity"></param>
 /// <param name="responseEntity"></param>
 protected virtual void DoExecute(RequestEntity requestEntity, ResponseEntity responseEntity)
 {
 }
Exemplo n.º 12
0
 private bool Equals(RequestEntity other)
 {
     return(Id == other.Id && string.Equals(Json, other.Json));
 }
        /// <summary>
        /// Gets the current astronomy information.
        /// </summary>
        /// <param name="request">The request configuration.</param>
        public override async Task <TAstronomyResponseEntity> GetAstronomyAsync <TAstronomyResponseEntity>(RequestEntity request, CancellationToken cancellationToken = default)
        {
            var astronomyResponseEntity = await base.GetAstronomyAsync <TAstronomyResponseEntity>(request, cancellationToken);

            // Do something custom, if the entity allows it.
            if (astronomyResponseEntity is CustomAstronomyResponseEntity customAstronomyEntity)
            {
                customAstronomyEntity.DoSomethingCustom();
            }

            return(astronomyResponseEntity);
        }
Exemplo n.º 14
0
 public object DefaultHeader(BaseHttpClient client, RequestEntity request, MetaModel meta)
 {
     return(null);
 }