private void FrmShopDetail_Load(object sender, EventArgs e) { new SystemData().GetShopDetail(); try { if (CommonData.ShopDetail.Any()) { ShopDetailInfo shopDetailInfo = new ShopDetailInfo(); shopDetailInfo = CommonData.ShopDetail.FirstOrDefault(); txtShopName.Text = shopDetailInfo.ShopName; txtShopAddr.Text = shopDetailInfo.ShopAddr; txtTelNo.Text = shopDetailInfo.ShopTelNo; txtVatNo.Text = shopDetailInfo.ShopVATNo; } else { txtShopName.Text = ""; txtShopAddr.Text = ""; txtTelNo.Text = ""; txtVatNo.Text = ""; } } catch (Exception ex) { LogHelper.Error(this.Name, ex); } }
public async Task <BaseResult <ShopDetailInfo> > GetShopskuImage(string shop_id, string shopsku_id) { //根据商品Id和商品SkuId读取商品SKU信息、商品图片信息 var shopSkuEntity = (from n in await shopSkuRepository.GetAllAsync(c => c.shop_id == shop_id && c.shopsku_id == shopsku_id && c.disable == 0) select new ShopSkuEntity() { shopsku_id = n.shopsku_id, shop_code = n.shop_code, shopsku_currentprice = n.shopsku_currentprice, shopsku_originalprice = n.shopsku_originalprice }).FirstOrDefault(); var shopImageEntitys = (from n in await shopImageRepository.GetAllAsync(c => c.shop_id == shop_id && c.shopsku_id == shopsku_id && c.disable == 0) select new ShopImageEntity() { shopimage_address = n.shopimage_address }); ShopDetailInfo shopDetailsInfo = new ShopDetailInfo { shopEntity = null, ShopSkuEntitys = null, shopSkuEntity = shopSkuEntity, shopAttrEntity = null, shopImageEntitys = shopImageEntitys, shopCouponEntity = null }; return(new BaseResult <ShopDetailInfo>(200, shopDetailsInfo)); }
private void btnSave_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(txtShopName.Text)) { CommonTool.ShowMessage("Shift Name is empty,please enter!"); return; } if (string.IsNullOrEmpty(txtShopAddr.Text)) { CommonTool.ShowMessage("Shift Addr is empty,please enter!"); return; } if (string.IsNullOrEmpty(txtTelNo.Text)) { CommonTool.ShowMessage("Telephone No. is empty,please enter!"); return; } if (string.IsNullOrEmpty(txtVatNo.Text)) { CommonTool.ShowMessage("VAT No. is empty,please enter!"); return; } try { ShopDetailInfo shopDetailInfo = new ShopDetailInfo(); shopDetailInfo.ShopName = txtShopName.Text; shopDetailInfo.ShopAddr = txtShopAddr.Text; shopDetailInfo.ShopTelNo = txtTelNo.Text; shopDetailInfo.ShopVATNo = txtVatNo.Text; if (CommonData.ShopDetail.Any()) { shopDetailInfo.ID = CommonData.ShopDetail.FirstOrDefault().ID; _control.UpdateEntity(shopDetailInfo); } else { _control.AddEntity(shopDetailInfo); } } catch (Exception ex) { LogHelper.Error(this.Name, ex); } CommonTool.ShowMessage("Save successful!"); }
/// <summary> /// 保存Shop Detail信息 /// </summary> private void SaveShopDetail() { try { ShopDetailInfo shopDetailInfo = new ShopDetailInfo(); shopDetailInfo.ShopName = txtShopName.Text; shopDetailInfo.ShopAddr = txtShopAddr.Text; if (CommonData.ShopDetail.Any()) { shopDetailInfo.ID = CommonData.ShopDetail.FirstOrDefault().ID; _control.UpdateEntity(shopDetailInfo); } else { _control.AddEntity(shopDetailInfo); } } catch (Exception ex) { LogHelper.Error(this.Name, ex); } }
/// <summary> /// 获得Shop Detail信息 /// </summary> private void GetShopDetail() { new SystemData().GetShopDetail(); try { if (CommonData.ShopDetail.Any()) { ShopDetailInfo shopDetailInfo = new ShopDetailInfo(); shopDetailInfo = CommonData.ShopDetail.FirstOrDefault(); txtShopName.Text = shopDetailInfo.ShopName; txtShopAddr.Text = shopDetailInfo.ShopAddr; } else { txtShopName.Text = ""; txtShopAddr.Text = ""; } } catch (Exception ex) { LogHelper.Error(this.Name, ex); } }
public async Task <ShopDetailInfo> GetShopDetailInfo(string id) { //处理商品查询详情页的实现 //第一步:首先根据商品Id查询商品详情信息 var shopEntity = (from n in await shopRepository.GetAllAsync(c => c.shop_id == id && c.disable == 0) select new ShopEntity() { shop_id = n.shop_id, shop_name = n.shop_name, shop_memo = n.shop_memo, shop_number = n.shop_number, shop_desc = n.shop_desc, shop_defaultimg = n.shop_defaultimg }).FirstOrDefault(); //第二步:根据商品Id查询商品SKU Id的信息,返回集合 var shopSkuEntitys = (from n in await shopSkuRepository.GetAllAsync(c => c.shop_id == id && c.disable == 0) select new ShopSkuEntity() { shopsku_id = n.shopsku_id, shop_code = n.shop_code, shopsku_currentprice = n.shopsku_currentprice, shopsku_originalprice = n.shopsku_originalprice, createtime = n.createtime }).OrderBy(c => c.createtime); //第三步:根据商品Id查询商品属性 var shopAttrEntity = await shopAttrRepository.GetAsync(c => c.shop_id == id); //第四步:根据商品Id和商品SKU-Id查询图片信息(读取第一个版本的图片) IQueryable <ShopImageEntity> shopImageEntitys = null; if (shopSkuEntitys.FirstOrDefault() != null) { string shopsku_id = shopSkuEntitys.FirstOrDefault().shopsku_id; shopImageEntitys = (from n in await shopImageRepository.GetAllAsync(c => c.shop_id == id && c.shopsku_id == shopsku_id && c.disable == 0) select new ShopImageEntity() { shopimage_address = n.shopimage_address }); } //第五步:根据商品Id查询商品优惠信息 var datetime = DateTime.Now; var shopCouponEntity = (from n in await shopCouponRepository.GetAllAsync(c => c.shop_id == id && c.disable == 0 && c.endtime > DateTime.Now) select new ShopCouponEntity() { shopcoupon_type = n.shopcoupon_type, shopcoupon_name = n.shopcoupon_name, shopcoupon_money = n.shopcoupon_money }).FirstOrDefault(); ShopDetailInfo shopDetailsInfo = new ShopDetailInfo { shopEntity = shopEntity, ShopSkuEntitys = shopSkuEntitys, shopSkuEntity = null, shopAttrEntity = shopAttrEntity, shopImageEntitys = shopImageEntitys, shopCouponEntity = shopCouponEntity }; return(shopDetailsInfo); }