public void TestMethod2() { OutDoor od = new OutDoor(); od = _IUnitOfWork.Set<OutDoor>() .Include(x => x.Area) .Include(x => x.PeriodCate) .Include(x => x.OutDoorMediaCate) .Include(x => x.FormatCate) .Include(x => x.AreaAtt) .OrderBy(x => x.MediaID).First(); Console.WriteLine(od.AreaAtt.Count()); }
public void TestMethod1() { OutDoor od = new OutDoor(); od.AddIP = "127.0.0.1"; od.AddTime = DateTime.Now; od.AdminUser = 200001; od.CityCode = "001001"; od.Description = "Description"; od.Favorite = 1; od.FormatCode = "F01"; od.HasLight = true; od.Height = 2.0M; od.Hit = 1; od.Integrity = 80; od.LastIP = "127.0.0.1"; od.LastTime = DateTime.Now; od.Lat = 2.123434M; //od.LightStrat = new TimeSpan(18, 00, 00); //od.LightEnd = new TimeSpan(6, 00, 00); od.Lng = 2.123434M; od.Location = "解放东路二坊2034户"; od.MemberID = 200013; od.MeidaCode = "D01008"; od.Message = 3; od.Name = "解放东路二坊2034户"; od.PeriodCode = "P01"; od.Price = 38.3M; od.PriceExten = "买10个便宜一半"; od.SeoDes = "解放东路二坊2034户"; od.SeoTitle = "解放东路二坊2034户"; od.Seokeywords = "解放东路二坊2034户"; od.TotalFaces = 3; od.TrafficAuto = 13033; od.TrafficPerson = 13000; od.Unapprovedlog = string.Empty; od.Wdith = 3.00M; _IUnitOfWork.Add<OutDoor>(od); _IUnitOfWork.Commit(); }
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.ToDecimal(model.Position.Split('|')[0]); od.Lng = Convert.ToDecimal(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; od.SeoTitle = model.Name; od.Seokeywords = model.Name; od.TrafficAuto = model.TrafficAuto; od.TrafficPerson = model.TrafficPerson; 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 = model.MediaImg.Split(',')[0], 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 = model.CredentialsImg.Split(',')[0], 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; }
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.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; }