Ejemplo n.º 1
0
    protected void btnOutput3_Click(object sender, EventArgs e)
    {
        //整理后数据Gov3
        if (string.IsNullOrEmpty(txt_name3djs.Text))
        {
            return;
        }
        IList<Model.DJ_GroupConsumRecord> gcrlist = bllCustomRecord.GetGCR8Multi(null, null, null, null, null);
        #region 筛选省市
        if (CurrentDpt.Area.Level == Model.AreaLevel.省)
        {
            gcrlist = gcrlist.Where(x => x.Route.DJ_TourGroup.DJ_DijiesheInfo.Area.Code.StartsWith(CurrentDpt.Area.Code.Substring(0, 2))).ToList();
        }
        else if (CurrentDpt.Area.Level == Model.AreaLevel.市)
        {
            gcrlist = gcrlist.Where(x => x.Route.DJ_TourGroup.DJ_DijiesheInfo.Area.Code.StartsWith(CurrentDpt.Area.Code.Substring(0, 4))).ToList();
        }
        else if (CurrentDpt.Area.Level == Model.AreaLevel.区县)
        {
            gcrlist = gcrlist.Where(x => x.Route.DJ_TourGroup.DJ_DijiesheInfo.Area.Code.StartsWith(CurrentDpt.Area.Code.Substring(0, 6))).ToList();
        }
        #endregion
        #region 筛选时间
        string[] tempdate = txt_yijiedai3.Text.Split(new char[] { '年', '月' });
        if (tempdate.Length >= 2)
        {
            var begin_date = new DateTime(int.Parse(tempdate[0]), int.Parse(tempdate[1]), 1);
            var end_date = begin_date.AddMonths(1);
            gcrlist = gcrlist
                .Where(x => x.ConsumeTime >= begin_date && x.ConsumeTime < end_date)
                .ToList();
            //筛选企业
            if (!string.IsNullOrEmpty(txt_name2.Text))
            {
                gcrlist = gcrlist.Where(x => x.Enterprise.Name == txt_name3djs.Text).ToList();
            }
        }
        else
        {
            return;
        }
        #endregion
        #region 整理数据
        IList<statics_Gov3> sm3 = new List<statics_Gov3>();
        foreach (var item3 in gcrlist.Where(x => x.Route.DJ_TourGroup.DJ_DijiesheInfo != null))
        {
            var temp = new statics_Gov3();
            temp.Name = item3.Route.DJ_TourGroup.DJ_DijiesheInfo.Name;
            temp.Gname = item3.Route.DJ_TourGroup.Name;
            temp.GId = item3.Route.DJ_TourGroup.Id.ToString();
            temp.Bedate = item3.Route.DJ_TourGroup.BeginDate.ToShortDateString() + "~" + item3.Route.DJ_TourGroup.EndDate.ToShortDateString();

            #region 昨日住宿
            var temp_y_hotel = item3.Route.DJ_TourGroup.Routes
                .Where(x => x.Enterprise.Type == Model.EnterpriseType.宾馆)
                .Where(x => x.DayNo == ((DateTime.Parse(txt_yijiedai3.Text) - item3.Route.DJ_TourGroup.BeginDate).Days));
            if (temp_y_hotel.Count() > 0)
            {
                foreach (var item in temp_y_hotel)
                {
                    temp.y_hotel += item.Enterprise.Name + " ";
                }
            }
            else
            {
                temp.y_hotel = "无";
            }
            #endregion

            #region 今日住宿
            var temp_t_hotel = item3.Route.DJ_TourGroup.Routes
                .Where(x => x.Enterprise.Type == Model.EnterpriseType.宾馆)
                .Where(x => x.DayNo == ((DateTime.Parse(txt_yijiedai3.Text) - item3.Route.DJ_TourGroup.BeginDate).Days + 1));
            if (temp_t_hotel.Count() > 0)
            {
                foreach (var item in temp_t_hotel)
                {
                    temp.t_hotel += item.Enterprise.Name + " ";
                }
            }
            else
            {
                temp.t_hotel = "无";
            }
            #endregion

            #region 今日景区
            var temp_t_scenic = item3.Route.DJ_TourGroup.Routes
                .Where(x => x.Enterprise.Type == Model.EnterpriseType.景点)
                .Where(x => x.DayNo == ((DateTime.Parse(txt_yijiedai3.Text) - item3.Route.DJ_TourGroup.BeginDate).Days + 1));
            if (temp_t_scenic.Count() > 0)
            {
                foreach (var item in temp_t_hotel)
                {
                    temp.t_scenic += item.Enterprise.Name + " ";
                }
            }
            else
            {
                temp.t_scenic = "无";
            }
            #endregion
            sm3.Add(temp);
        }
        #endregion
        //创建datatable
        DataTable tblDatas = new DataTable("Datas");
        tblDatas.Columns.Add("id", Type.GetType("System.String"));
        tblDatas.Columns.Add("djsname", Type.GetType("System.String"));
        tblDatas.Columns.Add("gname", Type.GetType("System.String"));
        tblDatas.Columns.Add("datetime", Type.GetType("System.String"));
        tblDatas.Columns.Add("situation", Type.GetType("System.String"));
        int i = 1;
        foreach (var item in sm3)
        {
            tblDatas.Rows.Add(new object[] { i++, item.Name, item.Gname, item.Bedate,
                "上一日住宿:"+item.y_hotel+",准备入住:"+item.t_hotel+"今日游览:"+item.t_scenic });
        }
        new ExcelOplib.ExcelOutput().Download2Excel(tblDatas, this.Page, new List<string>() {
            "序号","地接社名称","团队名称","时间","游览情况"
        }, CurrentDpt.Name + "[" + DateTime.Today.ToString("yyyy-MM-dd") + "]" + "团队旅游情况表");
    }
Ejemplo n.º 2
0
    //protected void BindGov3()
    //{
    ////整理后数据Gov3
    //IList<Model.DJ_TourGroup> tglist = blltg.();
    //#region 筛选省市
    //if (CurrentDpt.Area.Level == Model.AreaLevel.省)
    //{
    //    tglist = tglist
    //        .Where(x => x.DJ_DijiesheInfo.Area.Code.StartsWith(CurrentDpt.Area.Code.Substring(0, 2)))
    //        .ToList();
    //}
    //if (CurrentDpt.Area.Level == Model.AreaLevel.市)
    //{
    //    tglist = tglist
    //        .Where(x => x.DJ_DijiesheInfo.Area.Code.StartsWith(CurrentDpt.Area.Code.Substring(0, 4)))
    //        .ToList();
    //}
    //if (CurrentDpt.Area.Level == Model.AreaLevel.区县)
    //{
    //    tglist = tglist
    //        .Where(x => x.DJ_DijiesheInfo.Area.Code.StartsWith(CurrentDpt.Area.Code.Substring(0, 6)))
    //        .ToList();
    //}
    //#endregion
    ////筛选企业
    //if (!string.IsNullOrEmpty(txt_name3djs.Text))
    //{
    //    tglist = tglist.Where(x => x.Routes.Where(y => y.Enterprise.Name == txt_name3djs.Text.Trim()).Count() > 0).ToList();
    //}
    ////筛选日期
    //string[] temp = txt_yijiedai3.Text.Split(new char[] { '年', '月' });
    //if (!string.IsNullOrEmpty(txt_yijiedai3.Text) && temp.Length >= 2)
    //{
    //    var begin_date = new DateTime(int.Parse(temp[0]), int.Parse(temp[1]), 1);
    //    var end_date = begin_date.AddMonths(1);
    //    tglist = tglist.Where(x => x.BeginDate >= begin_date && x.EndDate.AddDays(x.DaysAmount) < end_date).ToList();
    //}
    //IList<statics_Gov3> sm3 = new List<statics_Gov3>();
    //foreach (var item3 in tglist.Where(x => x.DJ_DijiesheInfo != null))
    //{
    //    var temp = new statics_Gov3();
    //    temp.Name = item3.DJ_DijiesheInfo.Name;
    //    temp.Gname = item3.Name;
    //    temp.GId = item3.Id.ToString();
    //    temp.Bedate = item3.BeginDate.ToShortDateString() + "~" + item3.EndDate.ToShortDateString();
    //    var temp_y_hotel = item3.Routes
    //        .Where(x => x.Enterprise.Type == Model.EnterpriseType.宾馆)
    //        .Where(x => x.DayNo == ((DateTime.Parse(txt_yijiedai3.Text) - item3.BeginDate).Days));
    //    if (temp_y_hotel.Count() > 0)
    //    {
    //        foreach (var item in temp_y_hotel)
    //        {
    //            temp.y_hotel += item.Enterprise.Name + " ";
    //        }
    //    }
    //    else
    //    {
    //        temp.y_hotel = "无";
    //    }
    //    var temp_t_hotel = item3.Routes
    //        .Where(x => x.Enterprise.Type == Model.EnterpriseType.宾馆)
    //        .Where(x => x.DayNo == ((DateTime.Parse(txt_yijiedai3.Text) - item3.BeginDate).Days + 1));
    //    if (temp_t_hotel.Count() > 0)
    //    {
    //        foreach (var item in temp_t_hotel)
    //        {
    //            temp.t_hotel += item.Enterprise.Name + " ";
    //        }
    //    }
    //    else
    //    {
    //        temp.t_hotel = "无";
    //    }
    //    var temp_t_scenic = item3.Routes
    //        .Where(x => x.Enterprise.Type == Model.EnterpriseType.景点)
    //        .Where(x => x.DayNo == ((DateTime.Parse(txt_yijiedai3.Text) - item3.BeginDate).Days + 1));
    //    if (temp_t_scenic.Count() > 0)
    //    {
    //        foreach (var item in temp_t_hotel)
    //        {
    //            temp.t_scenic += item.Enterprise.Name + " ";
    //        }
    //    }
    //    else
    //    {
    //        temp.t_scenic = "无";
    //    }
    //    sm3.Add(temp);
    //}
    //////V.2012.10.27
    //////团队名字非空
    ////if (!string.IsNullOrEmpty(txt_name3.Text))
    ////{
    ////    //地接社名字非空
    ////    if (!string.IsNullOrEmpty(txt_name3djs.Text))
    ////    {
    ////        sm3 = sm3.Where(x => x.Name.Split(new string[] { txt_name3djs.Text }, StringSplitOptions.None).Count() > 1).ToList();
    ////        rptGov3.DataSource = sm3.Where(x => x.Name.Split(new string[] { txt_name3.Text }, StringSplitOptions.None).Count() > 1);
    ////    }
    ////    else
    ////    {
    ////        rptGov3.DataSource = sm3.Where(x => x.Name.Split(new string[] { txt_name3.Text }, StringSplitOptions.None).Count() > 1);
    ////    }
    ////}
    //////团队名字空
    ////else
    ////{
    ////if (!string.IsNullOrEmpty(txt_name3djs.Text))
    ////{
    ////    rptGov3.DataSource = sm3.Where(x => x.Name.Split(new string[] { txt_name3djs.Text }, StringSplitOptions.None).Count() > 1);
    ////}
    ////else
    ////{
    ////V.20120.10.30
    //rptGov3.DataSource = sm3;
    ////}
    ////}
    //rptGov3.DataBind();
    //}
    protected void BindGov3()
    {
        if (string.IsNullOrEmpty(txt_name3djs.Text))
        {
            return;
        }
        IList<Model.DJ_GroupConsumRecord> gcrlist = bllCustomRecord.GetGCR8Multi(null, null, null, null, null);
        #region 筛选省市
        if (CurrentDpt.Area.Level == Model.AreaLevel.省)
        {
            gcrlist = gcrlist.Where(x => x.Route.DJ_TourGroup.DJ_DijiesheInfo.Area.Code.StartsWith(CurrentDpt.Area.Code.Substring(0, 2))).ToList();
        }
        else if (CurrentDpt.Area.Level == Model.AreaLevel.市)
        {
            gcrlist = gcrlist.Where(x => x.Route.DJ_TourGroup.DJ_DijiesheInfo.Area.Code.StartsWith(CurrentDpt.Area.Code.Substring(0, 4))).ToList();
        }
        else if (CurrentDpt.Area.Level == Model.AreaLevel.区县)
        {
            gcrlist = gcrlist.Where(x => x.Route.DJ_TourGroup.DJ_DijiesheInfo.Area.Code.StartsWith(CurrentDpt.Area.Code.Substring(0, 6))).ToList();
        }
        #endregion
        #region 筛选时间
        string[] tempdate = txt_yijiedai3.Text.Split(new char[] { '年', '月' });
        if (tempdate.Length >= 2)
        {
            var begin_date = new DateTime(int.Parse(tempdate[0]), int.Parse(tempdate[1]), 1);
            var end_date = begin_date.AddMonths(1);
            gcrlist = gcrlist
                .Where(x => x.ConsumeTime >= begin_date && x.ConsumeTime < end_date)
                .ToList();
            //筛选企业
            if (!string.IsNullOrEmpty(txt_name3djs.Text))
            {
                gcrlist = gcrlist.Where(x => x.Enterprise.Name == txt_name3djs.Text).ToList();
            }
        }
        else
        {
            return;
        }
        #endregion
        #region 整理数据
        IList<statics_Gov3> sm3 = new List<statics_Gov3>();
        foreach (var item3 in gcrlist.Where(x => x.Route.DJ_TourGroup.DJ_DijiesheInfo != null))
        {
            var temp = new statics_Gov3();
            temp.Name = item3.Route.DJ_TourGroup.DJ_DijiesheInfo.Name;
            temp.Gname = item3.Route.DJ_TourGroup.Name;
            temp.GId = item3.Route.DJ_TourGroup.Id.ToString();
            temp.Bedate = item3.Route.DJ_TourGroup.BeginDate.ToShortDateString() + "~" + item3.Route.DJ_TourGroup.EndDate.ToShortDateString();

            #region 昨日住宿
            var temp_y_hotel = item3.Route.DJ_TourGroup.Routes
                .Where(x => x.Enterprise.Type == Model.EnterpriseType.宾馆)
                .Where(x => x.DayNo == ((DateTime.Parse(txt_yijiedai3.Text) - item3.Route.DJ_TourGroup.BeginDate).Days));
            if (temp_y_hotel.Count() > 0)
            {
                foreach (var item in temp_y_hotel)
                {
                    temp.y_hotel += item.Enterprise.Name + " ";
                }
            }
            else
            {
                temp.y_hotel = "无";
            }
            #endregion

            #region 今日住宿
            var temp_t_hotel = item3.Route.DJ_TourGroup.Routes
                .Where(x => x.Enterprise.Type == Model.EnterpriseType.宾馆)
                .Where(x => x.DayNo == ((DateTime.Parse(txt_yijiedai3.Text) - item3.Route.DJ_TourGroup.BeginDate).Days + 1));
            if (temp_t_hotel.Count() > 0)
            {
                foreach (var item in temp_t_hotel)
                {
                    temp.t_hotel += item.Enterprise.Name + " ";
                }
            }
            else
            {
                temp.t_hotel = "无";
            }
            #endregion

            #region 今日景区
            var temp_t_scenic = item3.Route.DJ_TourGroup.Routes
                .Where(x => x.Enterprise.Type == Model.EnterpriseType.景点)
                .Where(x => x.DayNo == ((DateTime.Parse(txt_yijiedai3.Text) - item3.Route.DJ_TourGroup.BeginDate).Days + 1));
            if (temp_t_scenic.Count() > 0)
            {
                foreach (var item in temp_t_hotel)
                {
                    temp.t_scenic += item.Enterprise.Name + " ";
                }
            }
            else
            {
                temp.t_scenic = "无";
            }
            #endregion
            sm3.Add(temp);
        }
        #endregion
        rptGov3.DataSource = sm3;
        rptGov3.DataBind();
    }