示例#1
0
 private void bindimg(IList<Scenic> list, Scenic scenic)
 {
     foreach (Scenic item in list)
     {
         if (!string.IsNullOrEmpty(item.Position) && item.Position != "null" && item.Position != "undefined")
         {
             string[] str = scenic.Position.Split(',');
             string[] str2 = item.Position.Split(',');
             double distance = CaculateDistance(double.Parse(str[0]), double.Parse(str[1]), double.Parse(str2[0]), double.Parse(str2[1]));
             if (distance != 0)
             {
                 if (scdiction.Count < 6)
                 {
                         scdiction.Add(item, distance);
                 }
                 else
                 {
                     foreach (KeyValuePair<Scenic, double> kvp in scdiction)
                     {
                         if (distance < kvp.Value)
                         {
                             if (bllscenicimg.GetSiByType(item, 1).Count > 0)
                             {
                                 scdiction.Remove(kvp.Key);
                                 scdiction.Add(item, distance);
                                 break;
                             }
                         }
                     }
                 }
             }
         }
     }
 }
示例#2
0
文件: DALTopic.cs 项目: hzxxx/testttt
 public void SaveScenictopic(IList<string> topicname, Scenic scenic)
 {
     IList<Topic> tlist = GetAllTopics();
     IList<ScenicTopic> stlist = GetStByscid(scenic.Id);
     if (stlist.Count > 0)
     {
         foreach (var item in stlist)
         {
             session.Delete(item);
         }
     }
     ScenicTopic st;
     foreach (string item in topicname)
     {
         var tmp = tlist.Where(x => x.Name == item.Trim()).First();
         st = new ScenicTopic()
         {
             Scenic = scenic,
             Topic = tmp
         };
         using (var t = session.BeginTransaction())
         {
             session.SaveOrUpdate(st);
             t.Commit();
         }
     }
 }
示例#3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string strParamId = Request["Id"];
        if (string.IsNullOrEmpty(strParamId))
        {
            IsNew = true;
            scenic = new Scenic();

        }
        else if (!int.TryParse(strParamId, out scenicId))
        {
            BLL.ErrHandler.Redirect(BLL.ErrType.ParamIllegal);
        }
        else
        {
            IsNew = false;
            scenic = bllScenic.GetScenicById(scenicId);
            if (scenic == null)
            {
                ErrHandler.Redirect(ErrType.ObjectIsNull);
            }

        }
        if (!IsPostBack)
        {
            if (!IsNew)
            {
                LoadForm();
            }
        }
    }
示例#4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string paramScenicId = Request["ScenicId"];
        string paramTicketId = Request["ticketId"];

        if (!int.TryParse(paramScenicId, out scenicId))
        {
            BLL.ErrHandler.Redirect(BLL.ErrType.ParamIllegal);
        }

        Scenic = bllScenic.GetScenicById(scenicId);

        int.TryParse(paramTicketId, out ticketId);
        isNew = ticketId <= 0;

        if (isNew)
        {
            CurrentTicket = new TicketNormal();
        }
        else
        {
            CurrentTicket = bllTicket.GetTicket(ticketId);

        }
        if (!IsPostBack)
        {
            BindTickets();
            LoadForm();
        }
    }
示例#5
0
 public override bool IsBelongTo(Scenic s)
 {
     foreach (Ticket t in TicketList)
     {
         if (t.IsBelongTo(s)) return true;
     }
     return false;
 }
示例#6
0
    List<ScenicImg> sclist = new List<ScenicImg>(); //绑定周边景区

    #endregion Fields

    #region Methods

    //绑定套票所需要的内容
    public void bindpackage(Scenic s)
    {
        List<Scenic> list = new BLLScenicTicket().GetScenicByTicket(s.Tickets[0].Id).ToList();
        bindimglist = "";
        for (int i = 0; i < list.Count; i++)
        {
            if (i == 0)
            {
                scpoint = list[0].Position;
                scmapname = list[0].Name;
            }
            else
                bindimglist += list[i].Position + "," + list[i].Name + ":";
        }
        // bindimglist.Substring(0, bindimglist.Length - 1);
        imgcount = list.Count - 1;
        introordertk.Visible = false;
    }
示例#7
0
 /// <summary>
 /// 申请开通某个功能
 /// </summary>
 /// <param name="scenic"></param>
 /// <param name="module"></param>
 public void Apply(Scenic scenic, TourMembership applier, ScenicModule module)
 {
     ScenicCheckProgress scp = new ScenicCheckProgress();
     var cplist = scenic.CheckProgress.ToList();
     if (cplist.Count != 0)
     {
         foreach (ScenicCheckProgress item in cplist)
         {
             if (item.Module == module)
             {
                 scp = item;
                 continue;
             }
         }
     }
     scp.Applier = applier;
     scp.CheckStatus = CheckStatus.Applied;
     scp.CheckTime = DateTime.Now;
     scp.Module = module;
     scp.Scenic = scenic;
     IScenic.SaveCheckProgress(scp);
 }
示例#8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string paramId = Request["id"];
        int scenicId;
        if (!int.TryParse(paramId, out scenicId))
        {
            ErrHandler.Redirect(ErrType.ParamIllegal);
        }
        scenic = bllScenic.GetScenicById(scenicId);
        contractimg = bllScenic.GetContractImg(scenic.Id);
        BindPrice();
        //lblyj.Text = bllticketprice.GetTicketPriceByScenicandtypeid(scenic.Id, 1).Price.ToString("0");
        //lblydj.Text = bllticketprice.GetTicketPriceByScenicandtypeid(scenic.Id, 2).Price.ToString("0");
        //lblyhj.Text = bllticketprice.GetTicketPriceByScenicandtypeid(scenic.Id, 3).Price.ToString("0");
        if (contractimg!=null)
            ContractImg.ImageUrl = "/ScenicImg/" + contractimg.Imgloc;

        if (!IsPostBack)
        {
            LoadOnLineCheck();
        }
    }
示例#9
0
 public override bool IsBelongTo(Scenic s)
 {
     return s.Id == Scenic.Id;
 }
示例#10
0
    protected override void OnInit(EventArgs e)
    {
        MembershipUser mu = Membership.GetUser();
        if (mu == null || mu.UserName == string.Empty || bllMember.GetScenicAdmin((Guid)mu.ProviderUserKey)==null)
        {
            Response.Redirect("/login.aspx");
        }
        ScenicAdmin scenicAdmin = bllMember.GetScenicAdmin((Guid)mu.ProviderUserKey);
        liScenicName.Text = scenicAdmin.Scenic.Name;
        if (scenicAdmin == null)
        {
            BLL.ErrHandler.Redirect(BLL.ErrType.AccessDenied);
        }
        try
        {

            liUserName.Text = mu.UserName;
            Scenic = scenicAdmin.Scenic;
            liScenicName.Text = Scenic.Name;
            IList<ScenicImg> list = bllscenicimg.GetSiByType(Scenic, 1);
            imgScenic.Src ="/"+ System.Web.Configuration.WebConfigurationManager.AppSettings["ScenicImagePath"]+"/mainimg/" + list[0].Name;
            if (!string.IsNullOrEmpty(Scenic.Position))
            {
                HttpCookie httpcookie = new HttpCookie("unitposition", Scenic.Position);
                Response.Cookies.Add(httpcookie);
            }
            else
            {
                HttpCookie httpcookie = new HttpCookie("unitposition", "120.159033,30.28376");
                Response.Cookies.Add(httpcookie);
            }
            //Response.Redirect("/UpdateScenticInfo.aspx");
            switch ((int)scenicAdmin.AdminType)
            {
                case 1:
                    this.adminBlock.Style.Add("display", "block");
                    this.checkBlock.Style.Add("display", "none");
                    this.accountBlock.Style.Add("display", "none");
                    cancelTa.Visible = false;
                    break;
                case 2:
                    this.adminBlock.Style.Add("display", "none");
                    this.checkBlock.Style.Add("display", "block");
                    this.accountBlock.Style.Add("display", "none");
                    cancelTa.Visible = false;
                    break;
                case 4:
                    this.adminBlock.Style.Add("display", "none");
                    this.checkBlock.Style.Add("display", "none");
                    this.accountBlock.Style.Add("display", "block");
                    cancelTa.Visible = false;
                    break;
                case 3:
                    this.adminBlock.Style.Add("display", "block");
                    this.checkBlock.Style.Add("display", "block");
                    this.accountBlock.Style.Add("display", "none");
                    cancelTa.Visible = false;
                    break;
                case 5:
                    this.adminBlock.Style.Add("display", "block");
                    this.checkBlock.Style.Add("display", "none");
                    this.accountBlock.Style.Add("display", "block");
                    cancelTa.Visible = false;
                    break;
                case 6:
                    this.adminBlock.Style.Add("display", "none");
                    this.checkBlock.Style.Add("display", "block");
                    this.accountBlock.Style.Add("display", "block");
                    cancelTa.Visible = false;
                    break;
                case 7:
                    this.adminBlock.Style.Add("display", "block");
                    this.checkBlock.Style.Add("display", "block");
                    this.accountBlock.Style.Add("display", "block");
                    cancelTa.Visible = true;
                    break;
                default:
                    this.adminBlock.Style.Add("display", "none");
                    this.checkBlock.Style.Add("display", "none");
                    this.accountBlock.Style.Add("display", "none");
                    cancelTa.Visible = false;
                    break;
            }
        }
        catch (Exception)
        {

        }
        base.OnInit(e);
    }
示例#11
0
        /// <summary>
        /// 将 source的门票 移至 target
        /// </summary>
        /// <param name="source"></param>
        /// <param name="target"></param>
        public void Move(Scenic source, Scenic target)
        {
            //删除目标景区下的所有门票先!
            IList<Ticket> tobeRemoved = new List<Ticket>();
            //foreach (Ticket st in target.Tickets)
            //{

            //    Iticket.Delete(st);
            //}

            //foreach (Ticket removedT in tobeRemoved)
            //{
            //    Iticket.Delete(removedT);
            //}
            if (target.Tickets.Count == 0) return;
            target.Tickets.Clear();
            foreach (Ticket t in source.Tickets)
            {
                t.Scenic = target;
                target.Tickets.Add(t);
            }
             //   target.Tickets = source.Tickets;
            bllScenic.Save(target);
              //  target.Tickets.Clear();
        }
示例#12
0
 double CaculateDistance(double lat1, double lng1, double lat2, double lng2)
 {
     double EARTH_RADIUS = 6378.137;   // 地球半径
     double radLat1 = lat1 * PI / 180;     // 转化为弧度值
     double radLat2 = lat2 * PI / 180;
     double a = radLat1 - radLat2;
     double b = (lng1 - lng2) * PI / 180;
     double s = 2 * Math.Asin(Math.Sqrt(Math.Pow(Math.Sin(a / 2), 2) + Math.Cos(radLat1) * Math.Cos(radLat2) * Math.Pow(Math.Sin(b / 2), 2)));
     s = s * EARTH_RADIUS;
     return s;
 }
示例#13
0
    private void bind(Scenic scenic)
    {
        maintitlett.InnerHtml = scenic.Name;

        hfposition.Value = scenic.Position;
        scbindname = scenic.Name;
        hfscname.Value = scenic.Name;
        scid = scenic.Id;
        Area parentarea = new BLLArea().GetAreaByCode(scenic.Area.Code.Substring(0, 4) + "00");
        Area childarea = scenic.Area;
        areaname.HRef = "/Tickets/" + parentarea.SeoName;
        areaname.InnerHtml = parentarea.Name.Substring(3, parentarea.Name.Length - 3) + "&nbsp;>";
        if (parentarea.Id != childarea.Id)
        {
            county.Visible = true;
            string childname = childarea.Name.Substring(3);
            if (childname.Length >= 6)
                childname = childname.Substring(3);
            county.InnerHtml = childname + "&nbsp;>";
            county.HRef = "/Tickets/" + parentarea.SeoName + "_" + childarea.SeoName;
        }
        else
        {
            county.Visible = false;
        }
        //导航链接 隐藏套票的所属单位
        string owerName = scenic.Name;
        IList<Ticket> tickets = s.Tickets;
        foreach (Ticket t in tickets)
        {
            if (t.As<Ticket>() is TicketUnion)
            {
                owerName = t.DisplayNameOfOwner;
                break;
            }

        }
        scenicname.HRef = "/Tickets/" + parentarea.SeoName + "_" + scenic.Area.SeoName + "/" + scenic.SeoName + ".html";
        scenicname.InnerHtml = owerName;
        scaddress = scenic.Address;
        booknote = scenic.BookNote;
        sclevel = scenic.Level;
        scdesc = scenic.ScenicDetail;
        transguid = scenic.Trafficintro;
        if (!string.IsNullOrEmpty(scenic.Desec))
        {
            if (scenic.Desec.Length > 30)
                scshortdesc = scenic.Desec.Substring(0, 30) + "...";
            else
                scshortdesc = scenic.Desec + "...";
        }
        IList<ScenicImg> listsi = bllscenicimg.GetSiByType(scenic, 1);
        if (listsi.Count > 0)
            ImgMainScenic.Src = "/ScenicImg/mainimg/" + listsi[0].Name;
        //判断是否是联票,如果是的话则使用新的样式'
        if (scenic.Tickets != null && scenic.Tickets.Count > 0)
        {
            var t = scenic.Tickets[0].As<Ticket>();
            if (t is TicketUnion)
            {
                rptBookNote.DataSource = ((TicketUnion)t).TicketList;
                rptBookNote.DataBind();
                rptscInfo.DataSource = ((TicketUnion)t).TicketList;
                rptscInfo.DataBind();
                rptJt.DataSource = ((TicketUnion)t).TicketList;
                rptJt.DataBind();
            }
            else
            {
                List<Ticket> listTicket = new List<Ticket>();
                listTicket.Add(t);
                rptBookNote.DataSource = listTicket;
                rptBookNote.DataBind();
                rptscInfo.DataSource = listTicket;
                rptscInfo.DataBind();
                rptJt.DataSource = listTicket;
                rptJt.DataBind();
            }
        }
        else
        {
            Ticket t = new TicketNormal();
            t.Scenic = scenic;
            List<Ticket> listTicket = new List<Ticket>();
            listTicket.Add(t);
            rptBookNote.DataSource = listTicket;
            rptBookNote.DataBind();
            rptscInfo.DataSource = listTicket;
            rptscInfo.DataBind();
            rptJt.DataSource = listTicket;
            rptJt.DataBind();
        }

        IList<Scenic> list = bllscenic.GetScenic();
        Dictionary<Scenic, double> places = new Dictionary<Scenic, double>();
        List<double> listdistance = new List<double>();
        if (!string.IsNullOrEmpty(scenic.Position))
        {
            //bindimg(list, scenic);
            //foreach (ScenicImg item in scdiction.Keys)
            //{
            bindimglist += scenic.Position + ":";
            // }
        }

        //绑定主题
        rpttopic.DataSource = blltopic.GetStByscid(scenic.Id);
        rpttopic.DataBind();

        //绑定普通票
        IList<Ticket> listticket = bllticket.GetTp(scenic.Id);

        //衢州新春门票,的主门票productCode
        if (listticket.Count > 0)
        {
            maintitlett.InnerHtml = listticket[0].DisplayNameOfOwner;
            IList<Ticket> listTicket = listticket.Where(x => x.IsMain).Where(x => x.TourActivity != null).ToList();
            if (listTicket.Count() > 0)
            {
                hfProductCode.Value = listTicket[0].ProductCode;
                //判断门票是否已经过期
                TourActivity act = listTicket[0].TourActivity;
                if (DateTime.Now.Date >= act.BeginDate && DateTime.Now.Date <= act.EndDate)
                {

                    var ticketAsign = listTicket[0].TourActivity
                         .GetActivityAssignForPartnerTicketDate(SiteConfig.PartnerCodeOfTourOL, listTicket[0].ProductCode, DateTime.Now.Date);

                    hfSyCount.Value = (ticketAsign.AssignedAmount - ticketAsign.SoldAmount).ToString();
                }
            }
            else
            {
                qzTicketCount.Visible = false;
            }
        }
        else
        {
            qzTicketCount.Visible = false;
        }

        rpttp.DataSource = listticket.Where(x => x.Enabled).ToList();
        rpttp.DataBind();
        //编辑
        EditRole();
        //sc_dp.scname = scenic.Name;
        //sc_dp.BaseData = booknote;

        //plate2.scname = scenic.Name;
        //plate2.BaseData = scenic.ScenicDetail;
        //sc_jtzn.scname = scenic.Name;
        //sc_jtzn.BaseData = scenic.Trafficintro;
    }
示例#14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string paramSname = Request["sname"];

        if (!string.IsNullOrEmpty(paramSname))
        {
            s = new BLLScenic().GetScenicBySeoName(paramSname);
            if (s == null)
            {
                ErrHandler.Redirect(ErrType.UnknownError, "从seoname获取景区失败");
            }
            bind(s);
            if (IsPackageScenic(s))
            {
                bindpackage(s);
            }

        }
        else
        {
            ErrHandler.Redirect(ErrType.ParamIllegal, "传入参数是空");
        }
        var ticket = s.Tickets.FirstOrDefault(x => x.IsMain == true);
        decimal onlineprice = ticket == null ? 0 : ticket.GetPrice(PriceType.PayOnline);
        SetSeoTitle(s.Name, onlineprice);
    }
示例#15
0
 //判断是否为套票景区
 public bool IsPackageScenic(Scenic s)
 {
     BLLScenicTicket bllscenicticket = new BLLScenicTicket();
     if (s.Tickets.Count > 0 && bllscenicticket.GetScenicByTicket(s.Tickets[0].Id).Count > 0)
         return true;
     return false;
 }
示例#16
0
 public void UpdateScenicInfo(Scenic scenic)
 {
     using (var t = session.BeginTransaction())
     {
         foreach (var item in scenic.Tickets)
         {
             session.SaveOrUpdate(item);
         }
         session.SaveOrUpdate(scenic);
         t.Commit();
     }
 }
示例#17
0
 //判断该页面是否是景区详情页面,同时选出该景区
 private void ChooseScenic()
 {
     string url = Request.RawUrl;
     string[] keys = url.Split('/');
     string key1 = keys[keys.Length - 2];
     if (key1.Split('_').Length > 1)
         key1 = key1.Split('_')[1];
     string key2 = keys[keys.Length - 1].Split('.')[0];
     scenic= bllscenic.GetScenicBySeoName(key1, key2);
 }
示例#18
0
 /// <summary>
 /// 批准某个功能的申请.
 /// </summary>
 /// <param name="scenic"></param>
 /// <param name="checker"></param>
 /// <param name="module"></param>
 public void ChangeCheckStatus(Scenic scenic, TourMembership checker, ScenicModule module, CheckStatus cs)
 {
     ScenicCheckProgress scp = GetStatus(scenic.Id, module);
     if (scp.CheckStatus != CheckStatus.Applied)
     {
         ErrHandler.Redirect(ErrType.UnknownError,"187行");
     }
     scp.CheckStatus = cs;
     IScenic.SaveCheckProgress(scp);
     if (module == ScenicModule.SellOnLine)
     {
         IList<Ticket> tickets = ITicket.GetTicketByscId(scenic.Id);
         foreach (var item in tickets)
         {
             item.Lock = false;
         }
         ITicket.SaveOrUpdateTicket(tickets);
     }
 }
示例#19
0
 /// <summary>
 /// 创建后台管理员
 /// </summary>
 /// <param name="realname"></param>
 /// <param name="phone"></param>
 /// <param name="address"></param>
 /// <param name="idcard"></param>
 /// <param name="loginname"></param>
 /// <param name="password"></param>
 public void CreateUser(string realname, string phone, string address,
      string loginname, string password, Scenic scenic)
 {
     //string encryptedPwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(password, "MD5");
     //Model.ScenicAdmin backuser = new ScenicAdmin()
     //{
     //    Address = address,
     //    Id = Guid.NewGuid(),
     //    Name = loginname,
     //    Password = encryptedPwd,
     //    Phone = phone,
     //    RealName = realname,
     //    Scenic = scenic,
     //};
     //CreateUpdateMember(backuser);
 }
示例#20
0
 protected override void OnLoad(EventArgs e)
 {
     CurrentUser = Membership.GetUser();
     CurrentScenic = new BLLMembership().GetScenicAdmin((Guid)CurrentUser.ProviderUserKey).Scenic;
     base.OnLoad(e);
 }
示例#21
0
 public void UpdateScenicInfo(Scenic scenic)
 {
     IScenic.UpdateScenicInfo(scenic);
 }
示例#22
0
        private Scenic ParseTicket(tourism_item item)
        {
            Scenic s = new Scenic();
            s.Name = item.title;
            s.MipangId = item.mipang_id;
            s.Phone = item.photo;
            s.Type = EnterpriseType.景点;
            s.IsHide = true;
            s.Area = new BLLArea().GetAreaByCode("330000");

            ///构造景点的area对象
            ///现有数据: 浙江/江苏/All/杭州/建德
            ///目标数据:浙江省杭州市
            s.Desec = item.city;

            foreach (ticket ticket in item.tickets)
            {
                Ticket t = new TicketNormal();
                t.IsMain = true;
                t.Name = ticket.ticket_name;

                TicketPrice tp1 = new TicketPrice();
                TicketPrice tp2= new TicketPrice();
                TicketPrice tp3 = new TicketPrice();
                tp1.Price = ticket.ticket_price;
                tp1.PriceType = PriceType.Normal;
                tp1.Ticket = t;

                tp2.Price = ticket.ticket_price;
                tp2.PriceType = PriceType.PreOrder;
                tp2.Ticket = t;

                tp3.Price = ticket.ticket_price;
                tp3.PriceType = PriceType.PayOnline;
                tp3.Ticket = t;

                t.TicketPrice.Add(tp1);
                t.TicketPrice.Add(tp2);
                t.TicketPrice.Add(tp3);

              //  t.TicketPrice = tps;
                t.Scenic = s;
                s.Tickets.Add(t);
            }

            return s;
        }