Пример #1
0
 public OutDoorViewModel GetOutDoorViewModel(int MediaID)
 {
     OutDoorViewModel odv = new OutDoorViewModel();
     int MemberID = Convert.ToInt32(CookieHelper.UID);
     OutDoor od = new OutDoor();
     od = IncludeFind(MediaID);
     odv.MediaID = od.MediaID;
     odv.AreaAtt = String.Join(",", od.AreaAtt.Select(x => x.ID));
     odv.CityCode = od.CityCode;
     odv.CredentialsImg = od.CredentialsImg.ImgUrls;
     odv.Deadline = od.Deadline;
     odv.Description = od.Description;
     //odv.EndTime = DateTime.Now;
     //odv.StartTime = DateTime.Now;
     odv.TrafficAuto = od.TrafficAuto;
     odv.TrafficPerson = od.TrafficPerson;
     odv.FormatCode = od.FormatCode;
     odv.Location = od.Location;
     odv.MediaImg = od.MediaImg.ImgUrls;
     odv.VideoUrl = od.VideoUrl;
     odv.MeidaCode = od.MeidaCode;
     odv.Name = od.Name;
     odv.OwnerCode = od.OwnerCode;
     odv.PeriodCode = od.PeriodCode;
     odv.Position = od.Lat + "|" + od.Lng;
     odv.Price = od.Price;
     odv.PriceExten = od.PriceExten;
     odv.Area = od.Wdith + "|" + od.Height + "|" + od.TotalFaces;
     odv.HasLight = od.HasLight;
     if (od.HasLight)
     {
         odv.LightTime = od.LightStrat + "|" + od.LightEnd;
     }
     return odv;
 }
Пример #2
0
        public OutDoor Create(OutDoorViewModel model)
        {
            int MemberID = Convert.ToInt32(CookieHelper.UID);
            OutDoor od = new OutDoor();
            od.AddIP = HttpHelper.IP;
            od.AddTime = DateTime.Now;
            od.CityCode = model.CityCode;
            od.Description = model.Description;
            od.FormatCode = model.FormatCode;
            od.HasLight = model.HasLight;
            od.LastIP = HttpHelper.IP;
            od.LastTime = DateTime.Now;
            od.Lat = Convert.ToDouble(model.Position.Split('|')[0]);
            od.Lng = Convert.ToDouble(model.Position.Split('|')[1]);
            od.Location = model.Location;
            od.MemberID = MemberID;
            od.MeidaCode = model.MeidaCode;
            od.Name = model.Name;
            od.PeriodCode = model.PeriodCode;
            od.Price = model.Price;
            od.PriceExten = model.PriceExten;
            od.SeoDes = model.Description.Length > 250 ? model.Description.Substring(0, 249) : model.Description;

            od.SeoTitle = model.Name;

            od.Seokeywords = model.Name;

            od.TrafficAuto = model.TrafficAuto;
            od.TrafficPerson = model.TrafficPerson;
            od.VideoUrl = model.VideoUrl;
            od.Unapprovedlog = string.Empty;

            //Area参数设置
            if (!string.IsNullOrEmpty(model.Area) && model.Area.Split('|').Length == 3)
            {
                var areaArray = model.Area.Split('|');
                od.Wdith = Convert.ToDecimal(areaArray[0]);
                od.Height = Convert.ToDecimal(areaArray[1]);
                od.TotalFaces = Convert.ToInt32(areaArray[2]);
            }
            //Light Time 设置
            if (model.HasLight)
            {
                if (!string.IsNullOrEmpty(model.LightTime) && model.LightTime.Split('|').Length == 2)
                {
                    var LightTime = model.LightTime.Split('|');
                    od.LightStrat = LightTime[0];
                    od.LightEnd = LightTime[1];
                }
            }

            MediaImg media = new MediaImg()
            {
                FocusImgUrl = UIHelper.GetImgUrl(model.MediaImg.Split(',')[0], ImgUrlType.Img120),
                ImgUrls = model.MediaImg,
                MemberID = MemberID
            };
            od.MediaImg = media;

            var AreaAttArray = model.AreaAtt.Split(',').Select(x => Convert.ToInt32(x)).ToList();
            var AreaAttList = AreaAttService.GetList(AreaAttArray);

            od.AreaAtt.AddRange(AreaAttList);

            CredentialsImg credent = new CredentialsImg()
            {
                FocusImgUrl = UIHelper.GetImgUrl(model.CredentialsImg.Split(',')[0], ImgUrlType.Img120),
                ImgUrls = model.CredentialsImg,
                MemberID = MemberID
            };

            od.OwnerCode = model.OwnerCode;
            od.CredentialsImg = credent;
            od.Deadline = model.Deadline;

            //set OutDoor Status 待审核状态
            od.Status = (int)OutDoorStatus.PreVerify;

            DB_Service.Add<OutDoor>(od);
            DB_Service.Commit();

            return od;
        }
Пример #3
0
        private List<HttpLinkItem> GetBread(string province, OutDoor outdoor, Company company)
        {
            List<HttpLinkItem> model = new List<HttpLinkItem>();

            HttpLinkItem breaditem = new HttpLinkItem()
            {
                Url = Url.Action("index", "home", new
                {
                    province = province
                })
            };

            model.Add(breaditem);

            breaditem = new HttpLinkItem()
            {
                Url = Url.Action("index", "list", new
                {
                    province = province,
                    mediacode = outdoor.OutDoorMediaCate.PCategory.ID,
                }),
                Name = outdoor.OutDoorMediaCate.PCategory.CateName
            };

            model.Add(breaditem);

            breaditem = new HttpLinkItem()
            {
                Url = Url.Action("index", "list", new
                {
                    province = province,
                    mediacode = outdoor.OutDoorMediaCate.PCategory.ID,
                    childmediacode = outdoor.OutDoorMediaCate.ID

                }),
                Name = outdoor.OutDoorMediaCate.CateName
            };

            model.Add(breaditem);

            breaditem = new HttpLinkItem()
            {
                Url = Url.Action("index", "shop", new
                {
                    id = company.MemberID
                }),
                Name = company.Name
            };

            model.Add(breaditem);

            breaditem = new HttpLinkItem()
               {
               Name = outdoor.Name
               };

            model.Add(breaditem);
            return model;
        }