Exemplo n.º 1
0
        public string GetCultivateDetail(dynamic requestData)
        {
            CultivateVisit cuVisit = JsonConvert.DeserializeObject <CultivateVisit>(JsonConvert.SerializeObject(requestData));

            //先增加看过数量

            db.CultivateVisit.Add(cuVisit);

            var sql = string.Format(@"Update CultivateInterflow set VisitCount=VisitCount+1 where CuInterId={0}", cuVisit.CuInterId);

            dataContext.ExecuteNonQuery(CommandType.Text, sql);



            //查询活动基本信息

            var qtest = (from v in db.CultivatePraise
                         where v.OpenId == cuVisit.OpenId
                         select v);

            var q = (from v in db.CultivateInterflow
                     join p in qtest on v.CuInterId equals p.CuInterId into temp
                     from tt in temp.DefaultIfEmpty()
                     where v.CuInterId == cuVisit.CuInterId
                     select new
            {
                CuInterId = v.CuInterId,
                CurriculumType = v.CurriculumType,
                Url = v.Url,
                Introduce = v.Introduce,
                CurriculumName = v.CurriculumName,
                PraiseCount = v.PraiseCount,
                VisitCount = v.VisitCount,
                CreateTime = v.CreateTime,
                IsPraise = tt.Id == null ? "f" : "t"
            }).FirstOrDefault();


            //活动下面带的讲师
            var qLecturer = (from v in db.Lecturer
                             where v.CuInterId == cuVisit.CuInterId
                             select new {
                LecturerId = v.LecturerId,
                HeadPicUrl = v.HeadPicUrl,
                LecturerName = v.LecturerName,
                Post = v.Post,
                HotelName = v.HotelName
            });


            return("{\"Cultivate\":" + JsonConvert.SerializeObject(q, DateTimeConvent.DateTimedd()) + ",\"Lecturer\":" + JsonConvert.SerializeObject(qLecturer) + "}");
        }
Exemplo n.º 2
0
 public string GetMySelfFR()
 {
     try
     {
         string sql = "select MySelfFRId,FRName,FRPicUrl from MySelfFR where BeginTime<GETDATE() and EndTime>GETDATE()  order by CreateTime";
         var    q   = dataContext.ExecuteDataTable(CommandType.Text, sql);
         return(JsonConvert.SerializeObject(q, DateTimeConvent.DateTimehh()));
     }
     catch (Exception)
     {
         return("No");
     }
 }
Exemplo n.º 3
0
        public string GetChefByMBIdCAId(int mbId, int caId)
        {
            var q = (from v in db.Chef
                     join p in db.MatchRegion on v.MatchRegionId equals p.MatchRegionId
                     where v.MemberId == mbId && v.ChefActivityId == caId
                     select new
            {
                ChefId = v.ChefId,
                MemberId = v.MemberId,
                ChefActivityId = v.ChefActivityId,
                MatchRegionId = v.MatchRegionId,
                AreaName = p.AreaName,
                ApplyType = v.ApplyType,
                ReferrerName = v.ReferrerName,
                Birthday = v.Birthday,
                ChefPicUrl = v.ChefPicUrl,
                //ChefHotelName = v.ChefHotelName,
                ChefHotelPicUrl = v.ChefHotelPicUrl
            });

            return(JsonConvert.SerializeObject(q, DateTimeConvent.DateTimedd()));
        }
Exemplo n.º 4
0
 public string GetBannerList(int pageIndex, int pageCount)
 {
     try
     {
         if (pageIndex < 1)
         {
             pageIndex = 1;
         }
         var q = (from v in db.Banner
                  orderby v.BannerId
                  select new
         {
             BannerId = v.BannerId,
             BannerType = v.BannerType,
             PicUrl = v.PicUrl,
             Link = v.Link,
             IsDisplay = v.IsDisplay == 1 ? "是" : "否",
             PriorityId = v.PriorityId,
         });
         var count = q.Count();
         var lastq = q.OrderBy(v => v.BannerId).Skip((pageIndex - 1) * pageCount).Take(pageCount);
         return("{ \"Count\":\"" + count + "\",\"data\":" + JsonConvert.SerializeObject(lastq, DateTimeConvent.DateTimehh()) + "}");
     }
     catch (Exception)
     {
         return("No");
     }
 }
Exemplo n.º 5
0
        public string GetDishChefComment(int dishId, int index, int pageSize)
        {
            var q = (from v in db.DishComment
                     where v.DishId == dishId
                     select v);
            var count = q.Count();
            var lastq = q.OrderByDescending(v => v.CreateTime).Skip((index - 1) * pageSize).Take(pageSize);
            //查找HotelName
            var lastResult = (from v in lastq
                              join p in db.OpenIdAssociated on v.OpenId equals p.OpenId
                              join n in db.RegistMember on p.UserId equals n.MemberId
                              select new
            {
                HeadPicUrl = v.HeadPicUrl,
                MemebName = v.MemberName,
                Comment = v.Comment,
                CreateTime = v.CreateTime,
                HotelName = n.HotelName
            });

            count = lastResult.Count();
            return("{ \"Count\":\"" + count + "\",\"data\":" + JsonConvert.SerializeObject(lastResult, DateTimeConvent.DateTimehh()) + "}");
        }
Exemplo n.º 6
0
        public string AddDishComment(dynamic requestData)
        {
            try
            {
                //增加留言
                string      addDishComment = JsonConvert.SerializeObject(requestData);
                DishComment model          = JsonConvert.DeserializeObject <DishComment>(addDishComment);
                db.DishComment.Add(model);
                db.SaveChanges();


                var q = (from v in db.DishComment
                         where v.DishId == model.DishId
                         select v);
                var count = q.Count();
                var lastq = q.OrderByDescending(v => v.CreateTime).Skip(0).Take(3);
                //查找HotelName
                var lastResult = (from v in lastq
                                  join p in db.OpenIdAssociated on v.OpenId equals p.OpenId
                                  join n in db.RegistMember on p.UserId equals n.MemberId
                                  select new
                {
                    HeadPicUrl = v.HeadPicUrl,
                    MemebName = v.MemberName,
                    Comment = v.Comment,
                    CreateTime = v.CreateTime,
                    HotelName = n.HotelName
                });


                return("{ \"Count\":\"" + count + "\",\"data\":" + JsonConvert.SerializeObject(lastResult, DateTimeConvent.DateTimehh()) + "}");
            }
            catch (Exception)
            {
                return("{\"Count\":0}");
            }
        }
Exemplo n.º 7
0
        public string GetChefStarAll(dynamic requestData)
        {
            try
            {
                //var d = ImgHandle.DNS;
                string name = JsonConvert.DeserializeObject <string>(JsonConvert.SerializeObject(requestData.Name));
                string city = JsonConvert.DeserializeObject <string>(JsonConvert.SerializeObject(requestData.City));

                int pageIndex = JsonConvert.DeserializeObject <int>(JsonConvert.SerializeObject(requestData.pageIndex));

                int chefActivityId = JsonConvert.DeserializeObject <int>(JsonConvert.SerializeObject(requestData.ChefActivityId));

                //获取当前活动ID
                var qcaID = (from v in db.ChefActivity
                             where v.IsEnable == 1
                             select v
                             ).FirstOrDefault();

                chefActivityId = qcaID.ChefActivityId;


                //获取赛区下城市列表
                var sql          = string.Format("select AreaName from MatchRegion where ChefActivityId={0} group by AreaName", chefActivityId);
                var CityNameList = dataContext.ExecuteDataTable(CommandType.Text, sql);



                if (pageIndex == null || pageIndex <= 0)
                {
                    pageIndex = 1;
                }
                var q = (from v in db.ChefStar
                         where v.ChefActivityId == chefActivityId
                         orderby v.PriorityId
                         select new
                {
                    ChefStarId = v.ChefStarId,
                    HeadPicUrl = v.HeadPicUrl,
                    ChefStarName = v.ChefStarName,
                    ChefStarPosition = v.ChefStarPosition,
                    ChefActivityId = v.ChefActivityId,
                    HotelName = v.HotelName,
                    CityName = v.CityName
                });

                if (name != null && !string.IsNullOrWhiteSpace(name))
                {
                    q = q.Where(v => v.ChefStarName.Contains(name) || v.HotelName.Contains(name));
                    //q = q.Where(v => v.HotelName.Contains(name));
                }
                if (city != null && !string.IsNullOrWhiteSpace(city))
                {
                    q = q.Where(v => v.CityName == city);
                }

                var count = q.Count();

                q = q.Skip((pageIndex - 1) * 6).Take(6);

                return("{ \"Count\":\"" + count + "\",\"data\":" + JsonConvert.SerializeObject(q, DateTimeConvent.DateTimehh()) + ",\"CityNameList\":" + JsonConvert.SerializeObject(CityNameList) + "}");
            }
            catch (Exception)
            {
                return("No");
            }
        }
        public string FootPirntMember(dynamic requestData)
        {
            try
            {
                string openId    = JsonConvert.DeserializeObject <string>(JsonConvert.SerializeObject(requestData.OpenId));
                int    pageIndex = JsonConvert.DeserializeObject <int>(JsonConvert.SerializeObject(requestData.PageIndex));
                int    userType  = JsonConvert.DeserializeObject <int>(JsonConvert.SerializeObject(requestData.UserType));
                string name      = JsonConvert.DeserializeObject <string>(JsonConvert.SerializeObject(requestData.Name));
                string sql       = "";
                //会员
                if (userType == 2)
                {
                    sql = string.Format(@"select  ECD.PageShort,ECD.PageDetail,ECD.CreateTime,ECD.OpenId,RM.MemberName,RM.MemberId from ECBrowseDetails  as ECD 
left join OpenIdAssociated as OI on  ECD.OpenId=OI.OpenId
left join RegistMember as RM on RM.MemberId=OI.UserId
where ECD.PageType=1 and ECD.OpenId='{0}' 

", openId);
                }
                //队员
                else
                {
                    sql = string.Format(@"select  ECD.PageShort,ECD.PageDetail,ECD.CreateTime,ECD.OpenId,RM.MemberName,RM.MemberId from ECBrowseDetails  as ECD 
left join OpenIdAssociated as OI on  ECD.OpenId=OI.OpenId
left join RegistMember as RM on RM.MemberId=OI.UserId
where ECD.PageType=1 
and ECD.OpenId in ( select OpenIdAssociated.OpenId from OpenIdAssociated  join ( select  MemberId from OpenIdAssociated
left join RegistCode on OpenIdAssociated.UserId=RegistCode.SalemanId
where OpenIdAssociated.OpenId='{0}')A on OpenIdAssociated.UserId=A.MemberId)


", openId);
                }
                //   order by ECD.CreateTime desc
                if (!string.IsNullOrEmpty(name))
                {
                    //会员
                    if (userType == 2)
                    {
                        sql = sql + "and ( ECD.PageShort like '%" + name + "%' or ECD.PageDetail like '%" + name + "%'   )  order by ECD.CreateTime desc";
                    }

                    //队员
                    if (userType == 1)
                    {
                        sql = sql + "and ( ECD.PageShort like '%" + name + "%' or ECD.PageDetail like '%" + name + "%'  or RM.MemberName  like  '%" + name + "%' )  order by ECD.CreateTime desc";
                    }
                }
                else
                {
                    sql += "    order by ECD.CreateTime desc";
                }
                var q     = dataContext.ExecuteDataTable(CommandType.Text, sql);
                var lastq = q;
                if (pageIndex > 0)
                {
                    lastq = imgHandle.GetPagedTable(q, pageIndex, 10);
                }

                return(JsonConvert.SerializeObject(lastq, DateTimeConvent.DateTimehh()));
            }
            catch (Exception)
            {
                return("No");
            }
        }
        public string GetSignin(dynamic requestData)
        {
            #region 最近7天签到情况
            int MemberId = JsonConvert.DeserializeObject <int>(JsonConvert.SerializeObject(requestData.MemberId));
            var datatime = DateTime.Today;
            List <SigninCreditLog> listSCLog = new List <SigninCreditLog>();
            for (int i = 0; i < 7; i++)
            {
                var list = (from v in db.SigninCreditLog
                            where v.MemberId == MemberId && v.SigninData == datatime
                            select v).FirstOrDefault();
                if (list == null)
                {
                    SigninCreditLog sclog = new SigninCreditLog();
                    sclog.Id         = 0;
                    sclog.IsDraw     = 2;
                    sclog.SigninData = datatime;
                    sclog.MemberId   = MemberId;
                    listSCLog.Add(sclog);
                }
                else
                {
                    listSCLog.Add(list);
                }
                datatime = datatime.AddDays(-1);
            }
            var d = (from v in listSCLog
                     select new
            {
                MemberId = v.MemberId,
                SigninData = v.SigninData,
                IsDraw = v.IsDraw
            });
            #endregion


            #region 计算连续签到天数

            int continuousDay = 0;

            for (int i = 0; i < 7; i++)
            {
                if (i == 0 && listSCLog[i].SigninData == DateTime.Today && listSCLog[i].IsDraw == 2)
                {
                    continue;
                }
                if (listSCLog[i].IsDraw == 0)
                {
                    continuousDay = continuousDay + 1;
                }
                else
                {
                    break;
                }
            }



            #endregion



            #region 当天是否签到

            datatime = DateTime.Today;
            var isSigninData = "f";
            var scl          = (from v in db.SigninCreditLog
                                where v.MemberId == MemberId && v.SigninData == datatime
                                select v).FirstOrDefault();
            if (scl == null)
            {
                isSigninData = "f";
            }
            else
            {
                isSigninData = "t";
            }
            #endregion
            //return JsonConvert.SerializeObject(d, DateTimeConvent.DateTimedd());
            return("{\"SigninCredit\":" + JsonConvert.SerializeObject(d, DateTimeConvent.DateTimedd()) + ",\"IsSiginCredit\":\"" + isSigninData + "\",\"ContinuousDay\":" + continuousDay + "}");
        }
Exemplo n.º 10
0
        public string GetCultivateInterflowList(dynamic requestData)
        {
            try
            {
                // var orderBy = requestData.OrderBy;

                string orderBy = JsonConvert.DeserializeObject <string>(JsonConvert.SerializeObject(requestData.OrderBy));

                if (orderBy != "time" && orderBy != "count")
                {
                    orderBy = "time";
                }

                string isDesc = JsonConvert.DeserializeObject <string>(JsonConvert.SerializeObject(requestData.IsDesc));

                if (isDesc != "f" && isDesc != "t")
                {
                    isDesc = "f";
                }

                string openId = JsonConvert.DeserializeObject <string>(JsonConvert.SerializeObject(requestData.OpenId));

                int pageIndex = JsonConvert.DeserializeObject <int>(JsonConvert.SerializeObject(requestData.PageIndex));
                if (pageIndex <= 0)
                {
                    pageIndex = 1;
                }
                //            var sql = string.Format(@"select C.CuInterId,C.CurriculumType,C.Url,C.CurriculumName,C.VisitCount,C.PraiseCount,C.CreateTime,case when CP.Id is null then 'f' else 't' end  as isPraise from  CultivateInterflow  C left join( select * from  CultivatePraise where OpenId={0}) as  CP  on C.CuInterId=CP.CuInterId
                //where C.IsDisplay=1
                //order By C.Priority ",openId);


                var qtest = (from v in db.CultivatePraise
                             where v.OpenId == openId
                             select v);


                var q = (from v in db.CultivateInterflow
                         join p in qtest on v.CuInterId equals p.CuInterId into temp
                         from tt in temp.DefaultIfEmpty()
                         where v.IsDisplay == 1
                         select new
                {
                    CuInterId = v.CuInterId,
                    CurriculumType = v.CurriculumType,
                    Url = v.Url,
                    CurriculumName = v.CurriculumName,
                    PraiseCount = v.PraiseCount,
                    VisitCount = v.VisitCount,
                    CreateTime = v.CreateTime,
                    IsPraise = tt.Id == null ? "f" : "t"
                });

                var count = q.Count();



                //if (isDesc == "f")
                //{
                //    var lastq = q.OrderBy(v => orderBy).Skip((pageIndex - 1) * 4).Take(4);
                //    return "{ \"Count\":\"" + count + "\",\"data\":" + JsonConvert.SerializeObject(lastq) + "}";
                //}
                //else
                //{
                //    var lastq = q.OrderByDescending(v => orderBy).Skip((pageIndex - 1) * 4).Take(4);
                //    return "{ \"Count\":\"" + count + "\",\"data\":" + JsonConvert.SerializeObject(lastq) + "}";
                //}

                if (orderBy == "time")
                {
                    if (isDesc == "t")
                    {
                        q = q.OrderByDescending(v => v.CreateTime);
                    }
                    if (isDesc == "f")
                    {
                        q = q.OrderBy(v => v.CreateTime);
                    }
                }
                if (orderBy == "count")
                {
                    if (isDesc == "t")
                    {
                        q = q.OrderByDescending(v => v.VisitCount);
                    }
                    if (isDesc == "f")
                    {
                        q = q.OrderBy(v => v.VisitCount);
                    }
                }

                q = q.Skip((pageIndex - 1) * 4).Take(4);


                return("{ \"Count\":\"" + count + "\",\"data\":" + JsonConvert.SerializeObject(q, DateTimeConvent.DateTimedd()) + "}");
            }
            catch (Exception)
            {
                return("No");
            }
        }
Exemplo n.º 11
0
 public string GetDishComment(int dishId, int index, int pageSize)
 {
     try
     {
         var q = (from v in db.DishComment
                  where v.DishId == dishId
                  select new
         {
             MemberName = v.MemberName,
             HeadPicUrl = v.HeadPicUrl,
             CreateTime = v.CreateTime,
             Comment = v.Comment
         });
         var count = q.Count();
         var lastq = q.OrderByDescending(v => v.CreateTime).Skip((index - 1) * pageSize).Take(pageSize);
         return("{ \"Count\":\"" + count + "\",\"data\":" + JsonConvert.SerializeObject(lastq, DateTimeConvent.DateTimehh()) + "}");
     }
     catch (Exception)
     {
         return("No");
     }
 }
Exemplo n.º 12
0
        public string GetMyCollect(dynamic requestData)
        {
            try
            {
                string openId    = JsonConvert.DeserializeObject <string>(JsonConvert.SerializeObject(requestData.OpenId));
                int    memberId  = JsonConvert.DeserializeObject <int>(JsonConvert.SerializeObject(requestData.MemberId));
                int    pageIndex = JsonConvert.DeserializeObject <int>(JsonConvert.SerializeObject(requestData.PageIndex));
                string sql       = string.Format(@"select * from 
(
select DCL.DishId,DCL.OpenId,DCL.DishType,DCL.CreateTime,DT.DishName,DT.DishPicUrl,DT.VisitCount,T.TutorName as PeopleName,T.TutorHotel as HotelName,1 as PeopleType from DishCollectLog as DCL
left join DishTutor as DT on DCL.DishId=DT.TutorDishId
left join Tutor as T on DT.TutorId=T.TutorId
where 1=1 and DCL.DishId between 200000 and 500000-1
 
 and DCL.OpenId='{0}'
 union all
---收藏厨师菜品
select DCL.DishId,DCL.OpenId,DCL.DishType,DCL.CreateTime,DC.DishName,DC.DishPicUrl,DC.VisitCount,RM.MemberName as PeopleName,RM.HotelName as HotelName, 2 as PeopleType from DishCollectLog as DCL
left join DishChef as DC on DCL.DishId=DC.DishChefId
left join Chef as C  on DC.ChefId=C.ChefId
left join RegistMember as RM on C.MemberId=RM.MemberId
where 1=1 and DCL.DishId between 500000 and 1000000
and DCL.OpenId='{0}'
 union all
---收藏星厨菜品

select DCL.DishId,DCL.OpenId,DCL.DishType,DCL.CreateTime,DCS.DishName,DCS.DishPicUrl,DCS.VisitCount,CS.ChefStarName as PeopleName,CS.HotelName as HotelName,  3 as PeopleType from DishCollectLog as DCL 
left join DishChefStar as DCS on DCL.DishId=DCS.DishChefStarId
left join ChefStar as CS on DCS.ChefStarId=CS.ChefStarId
where 1=1 and DCL.DishId between 80000 and 150000
and DCL.OpenId='{0}'
) as Collect
order by Collect.CreateTime desc", openId);

                var q = dataContext.ExecuteDataTable(CommandType.Text, sql);

                int totalCount = q.Rows.Count;

                if (pageIndex > 0)
                {
                    q = imgHandle.GetPagedTable(q, pageIndex, 10);
                }

                return("{\"totalCount\":" + totalCount + ",\"Info\":" + JsonConvert.SerializeObject(q, DateTimeConvent.DateTimehh()) + "}");
            }
            catch (Exception)
            {
                return("No");
            }
            //return null;
        }
Exemplo n.º 13
0
        public string GetMy(dynamic requestData)
        {
            try
            {
                string openId    = JsonConvert.DeserializeObject <string>(JsonConvert.SerializeObject(requestData.OpenId));
                int    memberId  = JsonConvert.DeserializeObject <int>(JsonConvert.SerializeObject(requestData.MemberId));
                int    pageIndex = JsonConvert.DeserializeObject <int>(JsonConvert.SerializeObject(requestData.PageIndex));
                string sql       = string.Format(@"select * from(
select DC.DishChefId as DishId, C.MemberId,DC.DishType,DC.ApplyTime ,DC.DishName,DC.DishPicUrl,DC.VisitCount ,2 as PeopleType ,case when  DCL.DishId is not null then 't' else 'f' end as IsCollect 
from DishChef as DC 
left join Chef as C on DC.ChefId=C.ChefId
left join 
(select * from DishCollectLog where OpenId='{0}')as DCL on DC.DishChefId=DCL.DishId
where C.MemberId={1} and DC.IsApply=1
union all
select MS.MySelfDishId as DishId,MS.MemberId,MS.DishType,MS.ApplyTime,MS.DishName,MS.DishPicUrl,MS.VisitCount,4 as PeopleType ,case when  DCL.DishId is not null then 't' else 'f' end as IsCollect from MySelfDishKu as MS
left join 
(select * from DishCollectLog where OpenId='{0}')as DCL on MS.MySelfDishId=DCL.DishId
where MS.MemberId={1} and MS.IsApply=1
) as my order by my.ApplyTime desc", openId, memberId);

                var q = dataContext.ExecuteDataTable(CommandType.Text, sql);

                int totalCount = q.Rows.Count;

                if (pageIndex > 0)
                {
                    q = imgHandle.GetPagedTable(q, pageIndex, 10);
                }

                return("{\"totalCount\":" + totalCount + ",\"Info\":" + JsonConvert.SerializeObject(q, DateTimeConvent.DateTimehh()) + "}");
            }
            catch (Exception)
            {
                return("No");
            }
        }
Exemplo n.º 14
0
        public string GetCultivateComment(dynamic requestData)
        {
            try
            {
                int cuId      = JsonConvert.DeserializeObject <int>(JsonConvert.SerializeObject(requestData.CuInterId));
                int pageIndex = JsonConvert.DeserializeObject <int>(JsonConvert.SerializeObject(requestData.PageIndex));
                if (pageIndex <= 0)
                {
                    pageIndex = 1;
                }

                var q = (from v in db.CultivateComment
                         where v.CuInterId == cuId
                         select new
                {
                    HeadPicUrl = v.HeadPicUrl,
                    NickName = v.NickName,
                    Comment = v.Comment,
                    CreateTime = v.CreateTime
                });
                var count = q.Count();
                q = q.OrderByDescending(v => v.CreateTime).Skip((pageIndex - 1) * 3).Take(3);
                return("{ \"Count\":\"" + count + "\",\"data\":" + JsonConvert.SerializeObject(q, DateTimeConvent.DateTimehh()) + "}");
            }
            catch (Exception)
            {
                return("No");
            }
        }
Exemplo n.º 15
0
        public string GetMyTrack(dynamic requestData)
        {
            string openId    = JsonConvert.DeserializeObject <string>(JsonConvert.SerializeObject(requestData.OpenId));
            int    memeberId = JsonConvert.DeserializeObject <int>(JsonConvert.SerializeObject(requestData.MemberId));
            int    pageIndex = JsonConvert.DeserializeObject <int>(JsonConvert.SerializeObject(requestData.pageIndex));

            string keyword = JsonConvert.DeserializeObject <string>(JsonConvert.SerializeObject(requestData.KeyWord));



            string sql = string.Format(@"select * from 
 (
 select '知味报名' as module,c.CreateTime as CreateTime,CA.ChefActivityName  as Name from Chef as c join ChefActivity as CA on c.ChefActivityId=CA.ChefActivityId  where MemberId={0}

 union all
 select '菜品投票' as   module ,DSL.CreateTime as CreateTime , CA.ChefActivityName as Name from  DishSelectedLog as DSL join ChefActivity as CA on DSL.ChefActivityId=CA.ChefActivityId where OpenId='{1}'

 ) as a where  1=1 ", memeberId, openId);

            if (!string.IsNullOrEmpty(keyword))
            {
                sql += "and a.module like '%" + keyword + "%' or a.Name like '%" + keyword + "%' ";
            }


            var q     = dataContext.ExecuteDataTable(CommandType.Text, sql);
            var count = q.Rows.Count;

            if (pageIndex <= 0 || string.IsNullOrEmpty(keyword))
            {
                pageIndex = 1;
            }

            var lastq = imgHandle.GetPagedTable(q, pageIndex, 10);

            return("{ \"Count\":\"" + count + "\",\"data\":" + JsonConvert.SerializeObject(lastq, DateTimeConvent.DateTimedd()) + "}");
        }
Exemplo n.º 16
0
        public string GetMySelfDishKu(dynamic requestData)
        {
            try
            {
                //审核状态,-1,表示全部,0、待审核   1、审核通过   2、审核不通过
                int isApply = JsonConvert.DeserializeObject <int>(JsonConvert.SerializeObject(requestData.IsApply));

                //上传时间
                string beginTime = JsonConvert.DeserializeObject <string>(JsonConvert.SerializeObject(requestData.BeginTime));
                string endTime   = JsonConvert.DeserializeObject <string>(JsonConvert.SerializeObject(requestData.EndTime));

                //会员姓名,菜品名,产品名称
                string name = JsonConvert.DeserializeObject <string>(JsonConvert.SerializeObject(requestData.Name));

                //页数

                int pageIndex = JsonConvert.DeserializeObject <int>(JsonConvert.SerializeObject(requestData.PageIndex));

                string sql = string.Format(@"select MyDK.MemberId,RM.MemberName,MyDK.MySelfDishId,MyDK.DishName,FR.FRName,MyDK.CreateTime,MyDK.IsApply  ,MyDK.PhoneNum  from MySelfDishKu as MyDK 
	left join RegistMember as RM on MyDK.MemberId=RM.MemberId
	left join ( select B.MySelfDishKuId , FRName=(stuff( (select ' '+A.FRName from (select role.*,FR.FRName  from MySelfFRRole as role left join MySelfFR as FR on role.MySelfFRId=FR.MySelfFRId)as A  where B.MySelfDishKuId=A .MySelfDishKuId for xml path('')),1, 1, ''))
 from ( select role.*,FR.FRName  from MySelfFRRole as role left join MySelfFR as FR on role.MySelfFRId=FR.MySelfFRId) as B group by B.MySelfDishKuId) As FR on MyDK.MySelfDishId=FR.MySelfDishKuId  where 1=1");

                if (isApply > -1)
                {
                    sql = sql + " and MyDK.IsApply= " + isApply;
                }
                if (!string.IsNullOrEmpty(beginTime))
                {
                    sql = sql + "  and MyDK.CreateTime>='" + beginTime + "'  ";
                }
                if (!string.IsNullOrEmpty(endTime))
                {
                    sql = sql + "  and MyDK.CreateTime<='" + endTime + "'  ";
                }

                if (!string.IsNullOrEmpty(name))
                {
                    sql = sql + "  and (RM.MemberName  like '%" + name + "%'  or  MyDK.DishName    like '%" + name + "%'  or    FR.FRName  like '%" + name + "%')  ";
                }
                sql = sql + "    order by MyDK.CreateTime desc";


                var q = dataContext.ExecuteDataTable(CommandType.Text, sql);

                int totalCount = q.Rows.Count;

                if (pageIndex > 0)
                {
                    q = imgHandle.GetPagedTable(q, pageIndex, 10);
                }

                return("{\"totalCount\":" + totalCount + ",\"Info\":" + JsonConvert.SerializeObject(q, DateTimeConvent.DateTimehh()) + "}");
            }
            catch (Exception)
            {
                return("No");
            }
        }
Exemplo n.º 17
0
 public string UpdateIsDel(dynamic requestData)
 {
     try
     {
         int bannerId = JsonConvert.DeserializeObject <int>(JsonConvert.SerializeObject(requestData.BannerId));
         //先查询
         var banner = (from v in db.Banner
                       where v.BannerId == bannerId
                       select v).Single();
         db.Banner.Remove(banner);
         var count = db.SaveChanges();
         if (count > 0)
         {
             var q = (from v in db.Banner
                      orderby v.BannerId
                      select new
             {
                 BannerId = v.BannerId,
                 BannerType = v.BannerType,
                 PicUrl = v.PicUrl,
                 Link = v.Link,
                 IsDisplay = v.IsDisplay == 1 ? "是" : "否",
                 PriorityId = v.PriorityId
             });
             var count1 = q.Count();
             var lastq  = q.Skip(0).Take(10);
             return("{ \"Count\":\"" + count1 + "\",\"data\":" + JsonConvert.SerializeObject(lastq, DateTimeConvent.DateTimehh()) + "}");
         }
         else
         {
             return("No");
         }
     }
     catch (Exception)
     {
         return("No");
     }
 }
Exemplo n.º 18
0
        public string GetCultivateList(dynamic requestData)
        {
            try
            {
                string sql = "select * from (select c.CuInterId,c.CurriculumName,c.CreateTime, STUFF((SELECT ' '+LecturerName FROM  Lecturer where CuInterId=c.CuInterId  FOR XML PATH('')), 1, 1, '') lecturer,c.CurriculumType,c.IsDisplay,c.Priority  from CultivateInterflow c  ) as d where 1=1";

                var StarTime = JsonConvert.DeserializeObject <string>(JsonConvert.SerializeObject(requestData.StarTime));


                var EndTime = JsonConvert.DeserializeObject <string>(JsonConvert.SerializeObject(requestData.EndTime));

                var Name = JsonConvert.DeserializeObject <string>(JsonConvert.SerializeObject(requestData.Name));



                var pageIndex = JsonConvert.DeserializeObject <int>(JsonConvert.SerializeObject(requestData.PageIndex));


                if (!string.IsNullOrEmpty(StarTime))
                {
                    sql += " and d.CreateTime>'" + StarTime + "'";
                }
                if (!string.IsNullOrEmpty(EndTime))
                {
                    sql += " and d.CreateTime<'" + EndTime + "'";
                }
                if (!string.IsNullOrEmpty(Name))
                {
                    sql += " and (d.CurriculumName like '%" + Name + "%' or  d.lecturer like '%" + Name + "%')";
                }
                sql = sql + "  Order by d.Priority";
                var q     = dataContext.ExecuteDataTable(CommandType.Text, sql);
                var count = q.Rows.Count;

                if (pageIndex <= 0)
                {
                    pageIndex = 1;
                }
                var lastq = imgHandel.GetPagedTable(q, pageIndex, 10);

                return("{ \"Count\":\"" + count + "\",\"data\":" + JsonConvert.SerializeObject(lastq, DateTimeConvent.DateTimedd()) + "}");
            }
            catch (Exception)
            {
                return("No");
            }
        }