/// <summary> /// 列表获取 /// </summary> public IList <ZCourseReflectionsEntity> GetList(ZCourseReflectionsEntity entity, int Page, int PageSize) { var objectImagesBLL = new ObjectImagesBLL(CurrentUserInfo); if (PageSize <= 0) { PageSize = 15; } IList <ZCourseReflectionsEntity> eventsList = new List <ZCourseReflectionsEntity>(); DataSet ds = new DataSet(); ds = _currentDAO.GetList(entity, Page, PageSize); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { eventsList = DataTableToObject.ConvertToList <ZCourseReflectionsEntity>(ds.Tables[0]); foreach (var item in eventsList) { item.ImageList = objectImagesBLL.QueryByEntity(new ObjectImagesEntity() { ObjectId = item.ReflectionsId }, null).ToList(); if (item.ImageList.Count > 0) { item.ImageURL = item.ImageList[0].ImageURL; } } } return(eventsList); }
/// <summary> /// 列表获取 /// </summary> public IList <ItemKeepEntity> GetList(ItemKeepEntity entity, int Page, int PageSize) { var lNewsBLL = new LNewsBLL(CurrentUserInfo); var objectImagesBLL = new ObjectImagesBLL(CurrentUserInfo); var itemService = new ItemService(CurrentUserInfo); if (PageSize <= 0) { PageSize = 15; } IList <ItemKeepEntity> eventsList = new List <ItemKeepEntity>(); DataSet ds = new DataSet(); ds = _currentDAO.GetList(entity, Page, PageSize); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { eventsList = DataTableToObject.ConvertToList <ItemKeepEntity>(ds.Tables[0]); if (eventsList != null) { foreach (var item in eventsList) { item.ItemDetail = itemService.GetVwItemDetailById(item.ItemId, entity.VipId); } } } return(eventsList); }
/// <summary> /// 列表获取 /// </summary> public IList <UserInfo> GetHairStylistByStoreId(string customerId, string unitId, int Page, int PageSize) { var lNewsBLL = new LNewsBLL(CurrentUserInfo); var objectImagesBLL = new ObjectImagesBLL(CurrentUserInfo); var itemService = new ItemService(CurrentUserInfo); if (PageSize <= 0) { PageSize = 15; } IList <UserInfo> eventsList = new List <UserInfo>(); DataSet ds = new DataSet(); ds = _currentDAO.GetHairStylistByStoreId(customerId, unitId, Page, PageSize); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { eventsList = DataTableToObject.ConvertToList <UserInfo>(ds.Tables[0]); //if (eventsList != null) //{ // foreach (var item in eventsList) // { // item.ImageList = objectImagesBLL.QueryByEntity(new ObjectImagesEntity() // { // ObjectId = item.VipShowId // }, null); // } //} } return(eventsList); }
/// <summary> /// 列表获取 /// </summary> public IList <MVipShowEntity> GetList(MVipShowEntity entity, int Page, int PageSize) { var lNewsBLL = new LNewsBLL(CurrentUserInfo); var objectImagesBLL = new ObjectImagesBLL(CurrentUserInfo); var itemService = new ItemService(CurrentUserInfo); if (PageSize <= 0) { PageSize = 15; } IList <MVipShowEntity> eventsList = new List <MVipShowEntity>(); DataSet ds = new DataSet(); ds = _currentDAO.GetList(entity, Page, PageSize); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { eventsList = DataTableToObject.ConvertToList <MVipShowEntity>(ds.Tables[0]); if (eventsList != null) { foreach (var item in eventsList) { item.ImageList = objectImagesBLL.QueryByEntity(new ObjectImagesEntity() { ObjectId = item.VipShowId }, new OrderBy[] { new OrderBy { FieldName = "CreateTime", Direction = OrderByDirections.Desc } }); } } } return(eventsList); }
/// <summary> /// 获取单个商品类别信息 /// </summary> /// <param name="Item_Category_Id"></param> /// <returns></returns> public ItemCategoryInfo GetItemCategoryById(string Item_Category_Id) { try { DataSet ds = new DataSet(); ds = itemCategoryService.GetItemCategoryById(Item_Category_Id); ItemCategoryInfo itemCategoryInfo = new ItemCategoryInfo(); if (ds != null && ds.Tables[0].Rows.Count > 0) { itemCategoryInfo = DataTableToObject.ConvertToObject <ItemCategoryInfo>(ds.Tables[0].Rows[0]); var objectImagesBLL = new ObjectImagesBLL(loggingSessionInfo); var tmpImageList = objectImagesBLL.QueryByEntity(new ObjectImagesEntity() { ObjectId = Item_Category_Id }, null); if (tmpImageList != null && tmpImageList.Length > 0) { itemCategoryInfo.ImageUrl = tmpImageList[0].ImageURL; } } return(itemCategoryInfo); } catch (Exception ex) { throw (ex); } }
/// <summary> /// 获取门店详情 /// </summary> /// <param name="StoreId"></param> /// <returns></returns> public StoreBrandMappingEntity GetStoreDetail(string StoreId) { StoreBrandMappingEntity info = new StoreBrandMappingEntity(); DataSet ds = new DataSet(); ds = _currentDAO.GetStoreDetail(StoreId); if (ds != null && ds.Tables[0].Rows.Count > 0) { info = DataTableToObject.ConvertToObject <JIT.CPOS.BS.Entity.StoreBrandMappingEntity>(ds.Tables[0].Rows[0]); } ObjectImagesBLL imageServer = new ObjectImagesBLL(this.CurrentUserInfo); info.ImageList = imageServer.QueryByEntity(new ObjectImagesEntity() { ObjectId = StoreId }, null); return(info); }
/// <summary> /// 列表获取 /// </summary> public IList <ZCourseEntity> GetCourses(ZCourseEntity entity, int Page, int PageSize) { var zCourseReflectionsBLL = new ZCourseReflectionsBLL(CurrentUserInfo); var zCourseNewsMappingBLL = new ZCourseNewsMappingBLL(CurrentUserInfo); var lNewsBLL = new LNewsBLL(CurrentUserInfo); var objectImagesBLL = new ObjectImagesBLL(CurrentUserInfo); if (PageSize <= 0) { PageSize = 15; } IList <ZCourseEntity> eventsList = new List <ZCourseEntity>(); DataSet ds = new DataSet(); ds = _currentDAO.GetCourses(entity, Page, PageSize); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { eventsList = DataTableToObject.ConvertToList <ZCourseEntity>(ds.Tables[0]); if (eventsList != null) { foreach (var item in eventsList) { item.CourseReflectionsList = zCourseReflectionsBLL.GetList(new ZCourseReflectionsEntity() { CourseId = item.CourseId }, 0, 10000); var mapList = zCourseNewsMappingBLL.QueryByEntity(new ZCourseNewsMappingEntity() { CourseId = item.CourseId }, null); if (mapList != null) { item.NewsList = new List <LNewsEntity>(); foreach (var mapItem in mapList) { var newsObj = lNewsBLL.GetByID(mapItem.NewsId); if (newsObj == null) { continue; } item.NewsList.Add(new LNewsEntity() { NewsId = newsObj.NewsId, NewsTitle = newsObj.NewsTitle, PublishTime = newsObj.PublishTime, displayIndex = newsObj.displayIndex, }); } } item.ImageList = objectImagesBLL.QueryByEntity(new ObjectImagesEntity() { ObjectId = item.CourseId }, null).ToList(); if (item.ImageList.Count > 0) { item.ImageUrl = item.ImageList[0].ImageURL; } } } } return(eventsList); }
public object GetDetailByParameters(GetPanicbuyingItemDetailReqPara para, string userId) { LoggingSessionInfo loggingSessionInfo = this.CurrentUserInfo as LoggingSessionInfo; var detail = GetByEventIDAndItemID(para.eventId, para.itemId); if (detail == null) { throw new Exception("未找到相关活动商品信息"); } #region 照片列表 var imagebll = new ObjectImagesBLL(loggingSessionInfo); var tempImageList = imagebll.GetObjectImagesByObjectId(para.itemId); var imagelist = tempImageList.Select(t => new { imageId = t.ImageId, imageUrl = t.ImageURL, imageUrlThumb = GetImageUrl(t.ImageURL, "_120"), imageUrlMiddle = GetImageUrl(t.ImageURL, "_240"), imageUrlBig = GetImageUrl(t.ImageURL, "_480") }).ToArray(); #endregion #region sku列表 var skubll = new SkuService(loggingSessionInfo); var ds = skubll.GetItemSkuListByEventId(para.itemId, para.eventId); var skulist = ds.Tables[0].AsEnumerable().Select(t => new { skuId = t["skuId"].ToString(), skuProp1 = t["skuProp1"].ToString(), skuProp2 = t["skuProp2"].ToString(), price = t["price"] is DBNull ? 0 : Double.Parse(t["price"].ToString()), salesPrice = t["salesPrice"] is DBNull ? 0 : Double.Parse(t["salesPrice"].ToString()), //price = t["price"] is DBNull ? "0" : Double.Parse(t["price"].ToString()).ToString("0.##"), //salesPrice = t["salesPrice"] is DBNull ? "0" : Double.Parse(t["salesPrice"].ToString()).ToString("0.##"), discountRate = string.IsNullOrEmpty(t["discountRate"].ToString()) ? "0" : t["discountRate"].ToString(),//折扣 integral = string.IsNullOrEmpty(t["integral"].ToString()) ? "0" : t["integral"].ToString(), //qty = Convert.ToInt32(t["qty"] is DBNull ? "0" : t["qty"]), //overQty = Convert.ToInt32(t["overQty"] is DBNull ? "0" : t["overQty"]) }).ToArray(); #endregion #region 购买用户列表 var inoutbll = new T_InoutBLL(loggingSessionInfo); var dsSalesUsers = inoutbll.GetItemEventSalesUserList(para.itemId, para.eventId); var salesUserList = dsSalesUsers.Tables[0].AsEnumerable().Select(t => new { userId = t["userId"].ToString(), imageURL = t["imageURL"].ToString() }).ToArray(); #endregion #region 门店信息 object storeInfo = null; var dsStore = inoutbll.GetEventStoreByItemAndEvent(para.itemId, para.eventId); if (dsStore.Tables[0].Rows.Count > 0) { var row = dsStore.Tables[0].Rows[0]; storeInfo = new { storeId = row["storeid"], storeName = row["storeName"], address = row["address"], imageURL = row["imageURL"], phone = row["phone"], storeCount = row["storeCount"] }; } #endregion #region 品牌信息 var dsBrand = inoutbll.GetItemBrandInfo(para.itemId); object brandInfo = null; if (dsBrand.Tables[0].Rows.Count > 0) { var row = dsBrand.Tables[0].Rows[0]; brandInfo = new { brandId = row["brandId"], brandLogoURL = row["brandLogoURL"], brandName = row["brandName"], brandEngName = row["brandEngName"] }; } #endregion #region sku信息 IList <object> skuInfoList = new List <object>(); object skuInfo = null; if (skulist.Count() > 0) { for (int i = skulist.Count() - 1; i >= 0; i--) { var sku = skulist[i]; var info = skubll.GetSkuInfoById(sku.skuId); skuInfoList.Add(new { skuId = sku.skuId, prop1DetailId = info.prop_1_id, prop2DetailId = info.prop_2_id }); if (i == 0) { skuInfo = new { skuId = sku.skuId, prop1DetailId = info.prop_1_id, prop2DetailId = info.prop_2_id }; } } } #endregion #region 属性信息 IList <prop1Info> prop1List = new List <prop1Info>(); object prop1 = null; //update by wzq 20140724 if (skulist.Count() > 0) { for (int c = skulist.Count() - 1; c >= 0; c--) { var dsProp = inoutbll.GetItemProp1List(skulist[c].skuId); //var dsProp = inoutbll.GetItemProp1List(para.itemId); if (dsProp.Tables[0].Rows.Count > 0) { prop1List.Add(dsProp.Tables[0].AsEnumerable().Select(t => new prop1Info { skuId = "" + t["skuId"], prop1DetailId = "" + t["prop1DetailId"], prop1DetailName = "" + t["prop1DetailName"], stock = Convert.ToInt32(string.IsNullOrWhiteSpace("" + t["stock"]) == true ? 0 : t["stock"]), salesCount = Convert.ToInt32(string.IsNullOrWhiteSpace("" + t["salesCount"]) == true ? 0 : t["salesCount"]) }).First()); } if (c == 0) { prop1 = dsProp.Tables[0].AsEnumerable().Select(t => new { skuId = "" + t["skuId"], prop1DetailId = "" + t["prop1DetailId"], prop1DetailName = "" + t["prop1DetailName"], stock = Convert.ToInt32(string.IsNullOrWhiteSpace("" + t["stock"]) == true ? 0 : t["stock"]), salesCount = Convert.ToInt32(string.IsNullOrWhiteSpace("" + t["salesCount"]) == true ? 0 : t["salesCount"]) }).First(); } } prop1List = prop1List.GroupBy(t => new { t.prop1DetailId, t.prop1DetailName }).Select(n => new prop1Info { skuId = n.Max(t => t.skuId), prop1DetailId = n.Key.prop1DetailId, prop1DetailName = n.Key.prop1DetailName, stock = n.Sum(t => t.stock), salesCount = n.Sum(t => t.salesCount) }).ToList(); } #endregion #region 限购处理 int canBuyCount = -1; //可购买数量 int singlePurchaseQty = GetEventItemInfo(para.eventId.ToString(), para.itemId); //活动商品限购数量 if (!string.IsNullOrEmpty(userId)) { if (singlePurchaseQty > 0) { //会员采购数量 int purchaseCount = GetVipPurchaseQty(userId, para.eventId, para.itemId); canBuyCount = singlePurchaseQty - purchaseCount; } } #endregion #region 获取商户信息 add by Henry 2014-10-10 var customerBll = new t_customerBLL(loggingSessionInfo); var customerBasicSettingBll = new CustomerBasicSettingBLL(loggingSessionInfo); t_customerEntity customerEntity = customerBll.GetByCustomerID(loggingSessionInfo.CurrentUser.customer_id); //获取商户名称 var customerInfo = new { CustomerName = customerEntity == null ? "" : customerEntity.customer_name, //商户名称 ImageURL = customerBasicSettingBll.GetSettingValueByCode("AppLogo"), //商户Logo CustomerMobile = customerBasicSettingBll.GetSettingValueByCode("CustomerMobile") }; #endregion var content = new { #region 组织属性 itemId = detail.ItemID, itemName = detail.ItemName, salesPersonCount = detail.SalesPersonCount, useInfo = detail.UseInfo, tel = detail.Tel, endTime = detail.EndTime.Value.To19FormatString(), offersTips = detail.OffersTips, prop1Name = detail.Prop1Name, prop2Name = detail.Prop2Name, itemCategoryName = detail.ItemCategoryName, itemCategoryId = detail.ItemCategoryID, itemIntroduce = detail.ItemIntroduce, itemParaIntroduce = detail.ItemParaIntroduce, //salesCount = detail.MonthSalesCount.HasValue ? detail.MonthSalesCount.Value.ToString("0.##") : "0", salesCount = detail.SalesCount, //销量 update by Henry 2014-11-12 beginLineSecond = GetBeginLineSecond(detail.BeginTime.Value), deadlineTime = detail.deadlineTime, discountRate = detail.DiscountRate == null ? 0 : Convert.ToDecimal((detail.DiscountRate / 10).Value.ToString("0.0")),//update by Henry 2014-10-20 addedTime = detail.AddTime.Value.To19FormatString(), deadlineSecond = detail.RemainingSec, beginTime = detail.BeginTime.Value.To19FormatString(), qty = detail.Qty, overQty = detail.RemainingQty, stopReason = detail.StopReason, status = detail.Status, eventId = detail.EventId, eventTypeID = detail.EventTypeID, imageList = imagelist, skuList = skulist, //数组 skuInfoList = skuInfoList, //数组 salesUserList = salesUserList, storeInfo = storeInfo, brandInfo = brandInfo, skuInfo = skuInfo, prop1List = prop1List, //数组 prop1 = prop1, //object canBuyCount = canBuyCount, singlePurchaseQty = singlePurchaseQty, serviceDescription = detail.ServiceDescription, itemSortId = detail.ItemSortId, CustomerInfo = customerInfo #endregion }; return(content); }
/// <summary> /// 保存商品类别(新建或者修改) /// </summary> /// <param name="loggingSessionInfo"></param> /// <param name="itemCategoryInfo"></param> /// <returns></returns> public string SetItemCategoryInfo(LoggingSessionInfo loggingSessionInfo, ItemCategoryInfo itemCategoryInfo) { string strResult = string.Empty; //事物信息 //cSqlMapper.Instance().BeginTransaction(); try { //处理是新建还是修改 if (itemCategoryInfo.Item_Category_Id == null || itemCategoryInfo.Item_Category_Id.Equals("")) { //如果是新建,并且没有传值给DisplayIndex,就取他所在子类里最大的displayindex+1 if (itemCategoryInfo.DisplayIndex == null || itemCategoryInfo.DisplayIndex == 0) { int displayindex = 0; //获取他的父类下的子分类的 IList <ItemCategoryInfo> list = GetItemCategoryListByParentId(itemCategoryInfo.Parent_Id).OrderByDescending(p => p.DisplayIndex).ToList(); if (list != null && list.Count() != 0) { int oldDisplayIndex = list[0].DisplayIndex == null?0: (int)list[0].DisplayIndex; displayindex = oldDisplayIndex + 1; } itemCategoryInfo.DisplayIndex = displayindex; } itemCategoryInfo.Item_Category_Id = NewGuid(); //2.提交用户信息 if (!SetItemCategoryTableInfo(loggingSessionInfo, itemCategoryInfo)) { strResult = "提交用户表失败"; return(strResult); } } else { CPOS.BS.DataAccess.ItemCategoryService server = new DataAccess.ItemCategoryService(loggingSessionInfo); strResult = server.SetItemCategoryInfoUpdate(itemCategoryInfo).ToString(); } var objectImagesBLL = new ObjectImagesBLL(loggingSessionInfo); var tmpImageList = objectImagesBLL.QueryByEntity(new ObjectImagesEntity() { ObjectId = itemCategoryInfo.Item_Category_Id }, null); if (tmpImageList != null && tmpImageList.Length > 0) { foreach (var tmpImageItem in tmpImageList) { objectImagesBLL.Delete(tmpImageItem); } } if (itemCategoryInfo.ImageUrl != null && itemCategoryInfo.ImageUrl.Length > 0) { objectImagesBLL.Create(new ObjectImagesEntity() { ImageId = NewGuid(), ObjectId = itemCategoryInfo.Item_Category_Id, ImageURL = itemCategoryInfo.ImageUrl }); } strResult = "保存成功!"; return(strResult); } catch (Exception ex) { throw (ex); } //return ""; }