/// <summary> /// checkbox勾选中后保存到数据库 /// </summary> /// <param name="id">选中的地区ID</param> /// <returns></returns> public void AddRegion(Guid id) { var oRegion = (from o in dbEntity.ShippingAreas where (o.RegionID == id && o.ShipID == gShipperID) select o).FirstOrDefault(); if (oRegion == null) { ShippingArea oShippingArea = new ShippingArea(); oShippingArea.ShipID = gShipperID; oShippingArea.RegionID = id; dbEntity.ShippingAreas.Add(oShippingArea); dbEntity.SaveChanges(); } else { oRegion.Deleted = false; dbEntity.SaveChanges(); } //return View(); }
public ActionResult RegionAttribute(ShippingArea shipArea) { ShippingArea oShippingArea = (from o in dbEntity.ShippingAreas where (o.Gid == shipArea.Gid && o.Deleted == false) select o).Single(); ViewData["oSupport"] = SelectEnumList(shipArea.SupportCod); oShippingArea.Residential = NewResource(ModelEnum.ResourceType.MONEY); oShippingArea.LiftGate = NewResource(ModelEnum.ResourceType.MONEY); oShippingArea.Installation = NewResource(ModelEnum.ResourceType.MONEY); oShippingArea.PriceWeight = NewResource(ModelEnum.ResourceType.MONEY); oShippingArea.PriceVolume = NewResource(ModelEnum.ResourceType.MONEY); oShippingArea.PricePiece = NewResource(ModelEnum.ResourceType.MONEY); oShippingArea.PriceHigh = NewResource(ModelEnum.ResourceType.MONEY); oShippingArea.PriceLow = NewResource(ModelEnum.ResourceType.MONEY); oShippingArea.ShipID = shipArea.ShipID; oShippingArea.RegionID = shipArea.RegionID; oShippingArea.SupportCod = shipArea.SupportCod; oShippingArea.Residential.SetResource(ModelEnum.ResourceType.MONEY, shipArea.Residential); oShippingArea.LiftGate.SetResource(ModelEnum.ResourceType.MONEY, shipArea.LiftGate); oShippingArea.Installation.SetResource(ModelEnum.ResourceType.MONEY, shipArea.Installation); oShippingArea.PriceWeight.SetResource(ModelEnum.ResourceType.MONEY, shipArea.PriceWeight); oShippingArea.PriceVolume.SetResource(ModelEnum.ResourceType.MONEY, shipArea.PriceVolume); oShippingArea.PricePiece.SetResource(ModelEnum.ResourceType.MONEY, shipArea.PricePiece); oShippingArea.PriceHigh.SetResource(ModelEnum.ResourceType.MONEY, shipArea.PriceHigh); oShippingArea.PriceLow.SetResource(ModelEnum.ResourceType.MONEY, shipArea.PriceLow); oShippingArea.Remark = shipArea.Remark; dbEntity.SaveChanges(); return RedirectToAction("Region"); }
/// <summary> /// 配送区域属性设置 /// </summary> /// <returns></returns> public ActionResult RegionAttribute(Guid id) { ShippingArea oShipArea = new ShippingArea(); oShipArea = (from o in dbEntity.ShippingAreas.Include("Residential").Include("LiftGate") .Include("Installation").Include("PriceWeight").Include("PriceVolume") .Include("PricePiece").Include("PriceHigh").Include("PriceLow") where (o.Deleted == false && o.RegionID == id && o.ShipID == gShipperID) select o).Single(); ViewData["oSupport"] = SelectEnumList(oShipArea.SupportCod); oShipArea.Residential = RefreshResource(ModelEnum.ResourceType.MONEY,oShipArea.Residential); oShipArea.LiftGate = RefreshResource(ModelEnum.ResourceType.MONEY,oShipArea.LiftGate); oShipArea.Installation = RefreshResource(ModelEnum.ResourceType.MONEY,oShipArea.Installation); oShipArea.PriceWeight = RefreshResource(ModelEnum.ResourceType.MONEY,oShipArea.PriceWeight); oShipArea.PriceVolume = RefreshResource(ModelEnum.ResourceType.MONEY,oShipArea.PriceVolume); oShipArea.PricePiece = RefreshResource(ModelEnum.ResourceType.MONEY,oShipArea.PricePiece); oShipArea.PriceHigh = RefreshResource(ModelEnum.ResourceType.MONEY, oShipArea.PriceHigh); oShipArea.PriceLow= RefreshResource(ModelEnum.ResourceType.MONEY, oShipArea.PriceLow); return View("RegionAttribute",oShipArea); }