public string GetFestivalList(HttpContext context)
        {
            BCtrl_Festival        bll  = new BCtrl_Festival();
            List <FestivalEntity> list = bll.GetFestivalList("", 3);

            if (list == null)
            {
                return(string.Empty);
            }

            var groupYear = list.OrderByDescending(o => o.StartTime).GroupBy(o => o.StartTime.ToString("yyyy年"));
            List <FestivalEntity> resultlist = new List <FestivalEntity>();

            foreach (var year  in groupYear)
            {
                FestivalEntity entity = new FestivalEntity {
                    FestivalName = year.Key, FestivalList = year.Select(o => o).ToList()
                };
                resultlist.Add(entity);
            }

            string result = StringUti.ToUnicode(JsonObj <object> .ToJsonString(resultlist));

            return(result);
        }
        public string GetFestivalListByGroup(HttpContext context)
        {
            BCtrl_Festival bll = new BCtrl_Festival();

            string qvalue = context.Request.QueryString["query"];

            List <FestivalEntity> list = bll.GetFestivalList(qvalue, 3);

            if (list != null)
            {
                dynamic result = new { query = "Unit", suggestions = list.Select(o => new { value = o.FestivalName, data = new { category = o.StartTime.ToString("yyyy年"), text = o.FestivalID } }) };

                string temp = StringUti.ToUnicode(JsonObj <object> .ToJsonString(result));
                return(temp);
            }

            return(string.Empty);
        }
 private void InitData()
 {
     if (!string.IsNullOrEmpty(id))
     {
         FestivalEntity entity = new FestivalEntity();
         entity.FestivalID = new Guid(id);
         BCtrl_Festival bll = new BCtrl_Festival();
         DataTable      db  = bll.GetFestival(entity);
         if (db.Rows.Count > 0)
         {
             this.FestivalName.Value      = db.Rows[0]["FestivalName"].ToString();
             this.FestivalShortName.Value = db.Rows[0]["FestivalShortName"].ToString();
             starttime = Convert.ToDateTime(db.Rows[0]["StartTime"].ToString()).ToString("yyyy-MM-dd");
             Endtime   = Convert.ToDateTime(db.Rows[0]["EndTime"].ToString()).ToString("yyyy-MM-dd");
             this.FestivalType.Value   = db.Rows[0]["FestivalType"].ToString();
             this.FestivalWeight.Value = db.Rows[0]["FestivalWeight"].ToString();
             this.txtid.Value          = db.Rows[0]["FestivalID"].ToString();
         }
     }
 }
        public string delFestival(HttpContext context)
        {
            string         stat   = "{\"status\":0}";
            string         id     = context.Request.Form["Festivalid"];
            FestivalEntity entity = new FestivalEntity();

            entity.FestivalID = new Guid(id);
            BCtrl_Festival bll = new BCtrl_Festival();
            string         flg = bll.deleteFestival(entity);

            if (flg == "1")
            {
                stat = "{\"status\":1}";
            }
            else
            {
                stat = "{\"status\":0}";
            }
            return(stat);
        }
        public string UpdateFestival(HttpContext context)
        {
            string         str    = "{\"status\":0}";
            FestivalEntity entity = new FestivalEntity();

            if (!string.IsNullOrEmpty(context.Request.Form["id"]))
            {
                entity.FestivalID        = new Guid(context.Request.Form["id"]);
                entity.FestivalName      = context.Request.Form["name"];
                entity.FestivalShortName = context.Request.Form["shortname"];
                int type = 0; int Weight = 0;
                int.TryParse(context.Request.Form["type"], out type);
                int.TryParse(context.Request.Form["Weight"], out Weight);
                entity.FestivalType   = type;
                entity.FestivalWeight = Weight;

                if (!string.IsNullOrEmpty(context.Request.Form["txtStartTime"]))
                {
                    entity.StartTime = DateTime.Parse(context.Request.Form["txtStartTime"]).Date;
                }
                if (!string.IsNullOrEmpty(context.Request.Form["txtEndTime"]))
                {
                    entity.EndTime = DateTime.Parse(context.Request.Form["txtEndTime"]).Date.AddDays(1).AddSeconds(-1);
                }
                BCtrl_Festival bll = new BCtrl_Festival();
                string         flg = bll.UpdateFestival(entity);
                if (flg == "0")
                {
                    str = "{\"status\":0}";
                }
                else if (flg == "1")
                {
                    str = "{\"status\":1}";
                }
                else if (flg == "2")
                {
                    str = "{\"status\":2}";
                }
            }
            return(str);
        }
        private DataTable GetQueryData(bool isDownload)
        {
            int                  totalcnt = 0;
            BCtrl_Festival       bll      = new BCtrl_Festival();
            searchFestivalEntity entity   = new searchFestivalEntity();

            if (!string.IsNullOrEmpty(txtStartTime))
            {
                entity.StartTime = txtStartTime;
            }
            if (!string.IsNullOrEmpty(txtEndTime))
            {
                entity.EndTime = txtEndTime;
            }
            entity.PageSize        = base.PageSize;
            entity.PageIndex       = base.PageIndex;
            entity.UseDBPagination = !isDownload;
            entity.OrderfieldType  = OrderFieldType.Desc;
            DataTable db = bll.GetFestivalList(entity, out totalcnt);

            base.TotalRecords = totalcnt;
            return(db);
        }