/// <summary> /// 查询全部积分订单 /// </summary> /// <param name="entity">参数:实体</param> /// <returns></returns> public OrderIntegralEntity[] GetAllList(OrderIntegralEntity entity) { List <IWhereCondition> wheres = new List <IWhereCondition>(); if (entity != null && !string.IsNullOrEmpty(entity.item_code)) { wheres.Add(new LikeCondition() { FieldName = "ti.item_code", HasLeftFuzzMatching = true, HasRightFuzzMathing = true, Value = entity.item_code }); } if (entity != null && !string.IsNullOrEmpty(entity.item_name)) { wheres.Add(new LikeCondition() { FieldName = "ti.item_name", HasLeftFuzzMatching = true, HasRightFuzzMathing = true, Value = entity.item_name }); } if (entity != null && !string.IsNullOrEmpty(entity.VipName)) { wheres.Add(new LikeCondition() { FieldName = "vp.VipName", HasLeftFuzzMatching = true, HasRightFuzzMathing = true, Value = entity.VipName }); } return(new OrderIntegralDAO(this.CurrentUserInfo).GetAllList(wheres.ToArray())); }
public bool SetOrderIntegralInfo(OrderIntegralEntity pEntity, string customerId, out string res) { decimal integral = this.itemService.GetItemIntegral(pEntity.ItemID); decimal integralAmmount = pEntity.Quantity.Value * integral; //使用积分 decimal userIntegral = ToDecimal(this.itemService.GetVipValidIntegral(pEntity.VIPID)); //用户剩余积分 if (userIntegral - integralAmmount < 0) { res = "用户剩余积分不足"; return(false); } IDbTransaction tran = new TransactionHelper(loggingSessionInfo).CreateTransaction(); using (tran.Connection) { try { /*插入订单积分、修改订单积分数据*/ //获取商品积分信息 pEntity.Integral = integral; pEntity.IntegralAmmount = integralAmmount; new OrderIntegralBLL(loggingSessionInfo).Create(pEntity, tran); VipIntegralBLL vipIntegralServer = new VipIntegralBLL(loggingSessionInfo); vipIntegralServer.ProcessPoint(18, customerId, pEntity.VIPID, "", null, "", -integralAmmount); //VipIntegralDetailEntity integralDetailEntity = new VipIntegralDetailEntity(); //integralDetailEntity.VipIntegralDetailID = Guid.NewGuid().ToString().Replace("-", ""); //integralDetailEntity.VIPID = pEntity.VIPID; //integralDetailEntity.Integral = integralAmmount; //integralDetailEntity.IntegralSourceID = "18";//兑礼减积分 //integralDetailEntity.CreateBy = "system"; //integralDetailEntity.EffectiveDate = DateTime.Now; //integralDetailEntity.ObjectId = pEntity.OrderIntegralID; //new VipIntegralDetailBLL(loggingSessionInfo).Create(integralDetailEntity, tran); //this.itemService.UpdateVIPIntegral(userIntegral - integralAmmount, pEntity.VIPID, (SqlTransaction)tran); tran.Commit(); } catch { tran.Rollback(); throw; } } res = "操作成功"; return(true); }
public string GetOrderIntegralList(NameValueCollection rParams) { OrderIntegralEntity entity = Request("form").DeserializeJSONTo <OrderIntegralEntity>(); int pageSize = rParams["limit"].ToInt(); int pageIndex = rParams["page"].ToInt(); int rowCount = 0; return(string.Format("{{\"totalCount\":{1},\"topics\":{0}}}", new OrderIntegralBLL(CurrentUserInfo).GetList(entity, pageIndex, pageSize, out rowCount).ToJSON(), rowCount)); }
/// <summary> /// 查询积分订单 /// </summary> /// <param name="entity">参数:实体</param> /// <param name="pageIndex">参数:当前页</param> /// <param name="pageSize">参数:分页个数</param> /// <param name="rowCount">参数:数据集的总数</param> /// <returns></returns> public OrderIntegralEntity[] GetList(OrderIntegralEntity entity, int pageIndex, int pageSize, out int rowCount) { List <IWhereCondition> wheres = new List <IWhereCondition>(); if (entity != null && !string.IsNullOrEmpty(entity.item_code)) { wheres.Add(new LikeCondition() { FieldName = "ti.item_code", HasLeftFuzzMatching = true, HasRightFuzzMathing = true, Value = entity.item_code }); } if (entity != null && !string.IsNullOrEmpty(entity.item_name)) { wheres.Add(new LikeCondition() { FieldName = "ti.item_name", HasLeftFuzzMatching = true, HasRightFuzzMathing = true, Value = entity.item_name }); } if (entity != null && !string.IsNullOrEmpty(entity.VipName)) { wheres.Add(new LikeCondition() { FieldName = "vp.VipName", HasLeftFuzzMatching = true, HasRightFuzzMathing = true, Value = entity.VipName }); } List <OrderBy> orderbys = new List <OrderBy>(); orderbys.Add(new OrderBy() { FieldName = "[CreateTime]", Direction = OrderByDirections.Desc }); PagedQueryResult <OrderIntegralEntity> pEntity = new OrderIntegralDAO(this.CurrentUserInfo).GetList(wheres.ToArray(), orderbys.ToArray(), pageIndex, pageSize); rowCount = pEntity.RowCount; return(pEntity.Entities); }
/// <summary> /// 导出Excel数据功能 /// </summary> /// <param name="pContext"></param> /// <returns></returns> private void Export(HttpContext pContext) { try { #region 获取信息 OrderIntegralEntity entity = Request("param").DeserializeJSONTo <OrderIntegralEntity>(); OrderIntegralEntity[] data = new OrderIntegralBLL(CurrentUserInfo).GetAllList(entity); #endregion string MapUrl = pContext.Server.MapPath(@"~/Framework/Upload/" + DateTime.Now.ToString("yyyy.MM.dd.HH.mm.ss.ms") + ".xls"); Aspose.Cells.License lic = new Aspose.Cells.License(); lic.SetLicense("Aspose.Total.lic"); Workbook workbook = new Workbook(); Worksheet sheet = workbook.Worksheets[0]; Cells cells = sheet.Cells;//单元格 #region //为标题设置样式 Style styleTitle = workbook.Styles[workbook.Styles.Add()]; //新增样式 styleTitle.HorizontalAlignment = TextAlignmentType.Center; //文字居中 styleTitle.Font.Name = "宋体"; //文字字体 styleTitle.Font.Size = 18; //文字大小 styleTitle.Font.IsBold = true; //粗体 //样式2 Style style2 = workbook.Styles[workbook.Styles.Add()]; //新增样式 style2.HorizontalAlignment = TextAlignmentType.Center; //文字居中 style2.Font.Name = "宋体"; //文字字体 style2.Font.Size = 14; //文字大小 style2.Font.IsBold = true; //粗体 style2.IsTextWrapped = true; //单元格内容自动换行 style2.Borders[BorderType.LeftBorder].LineStyle = CellBorderType.Thin; style2.Borders[BorderType.RightBorder].LineStyle = CellBorderType.Thin; style2.Borders[BorderType.TopBorder].LineStyle = CellBorderType.Thin; style2.Borders[BorderType.BottomBorder].LineStyle = CellBorderType.Thin; //样式3 Style style3 = workbook.Styles[workbook.Styles.Add()]; //新增样式 style3.HorizontalAlignment = TextAlignmentType.Center; //文字居中 style3.Font.Name = "宋体"; //文字字体 style3.Font.Size = 12; //文字大小 style3.Borders[BorderType.LeftBorder].LineStyle = CellBorderType.Thin; style3.Borders[BorderType.RightBorder].LineStyle = CellBorderType.Thin; style3.Borders[BorderType.TopBorder].LineStyle = CellBorderType.Thin; style3.Borders[BorderType.BottomBorder].LineStyle = CellBorderType.Thin; #endregion //生成行1 标题行 cells.Merge(0, 0, 1, 12); //合并单元格 cells[0, 0].PutValue("积分订单"); //填写内容 cells[0, 0].SetStyle(styleTitle); cells.SetRowHeight(0, 38); //生成行2 列名行 for (int i = 0; i < 12; i++) { cells.SetColumnWidth(i, 30); } #region 列明 cells[1, 0].PutValue("订单编号"); cells[1, 0].SetStyle(style2); cells.SetRowHeight(1, 25); cells[1, 1].PutValue("下单时间"); cells[1, 1].SetStyle(style2); cells.SetRowHeight(1, 25); cells[1, 2].PutValue("商品名称"); cells[1, 2].SetStyle(style2); cells.SetRowHeight(1, 25); cells[1, 3].PutValue("商品编号"); cells[1, 3].SetStyle(style2); cells.SetRowHeight(1, 25); cells[1, 4].PutValue("商品积分"); cells[1, 4].SetStyle(style2); cells[1, 5].PutValue("兑换数量"); cells[1, 5].SetStyle(style2); cells[1, 6].PutValue("总积分"); cells[1, 6].SetStyle(style2); cells[1, 7].PutValue("会员"); cells[1, 7].SetStyle(style2); cells[1, 8].PutValue("会员编号"); cells[1, 8].SetStyle(style2); cells[1, 9].PutValue("收货人"); cells[1, 9].SetStyle(style2); cells[1, 10].PutValue("收货电话"); cells[1, 10].SetStyle(style2); cells[1, 11].PutValue("收货地址"); cells[1, 11].SetStyle(style2); cells.SetRowHeight(1, 25); #endregion #region 生成数据行 for (int i = 0; i < data.Length; i++) { cells[2 + i, 0].PutValue(data[i].OrderIntegralID); cells[2 + i, 0].SetStyle(style3); cells[2 + i, 1].PutValue(data[i].CreateTimeFormat); cells[2 + i, 1].SetStyle(style3); cells[2 + i, 2].PutValue(data[i].item_name); cells[2 + i, 2].SetStyle(style3); cells[2 + i, 3].PutValue(data[i].item_code); cells[2 + i, 3].SetStyle(style3); cells[2 + i, 4].PutValue(data[i].Integral); cells[2 + i, 4].SetStyle(style3); cells[2 + i, 5].PutValue(data[i].Quantity); cells[2 + i, 5].SetStyle(style3); cells[2 + i, 6].PutValue(data[i].IntegralAmmount); cells[2 + i, 6].SetStyle(style3); cells[2 + i, 7].PutValue(data[i].VipName); cells[2 + i, 7].SetStyle(style3); cells[2 + i, 8].PutValue(data[i].VipCode); cells[2 + i, 8].SetStyle(style3); cells[2 + i, 9].PutValue(data[i].LinkMan); cells[2 + i, 9].SetStyle(style3); cells[2 + i, 10].PutValue(data[i].LinkTel); cells[2 + i, 10].SetStyle(style3); cells[2 + i, 11].PutValue(data[i].Address); cells[2 + i, 11].SetStyle(style3); cells.SetRowHeight(2 + i, 24); } #endregion workbook.Save(MapUrl); Utils.OutputExcel(pContext, MapUrl);//输出Excel文件 } catch (Exception ex) { throw (ex); } }
public void Update(OrderIntegralEntity pEntity, bool pIsUpdateNullField, IDbTransaction pTran) { _currentDAO.Update(pEntity, pIsUpdateNullField, pTran); }
/// <summary> /// 更新 /// </summary> /// <param name="pEntity">实体实例</param> /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param> public void Update(OrderIntegralEntity pEntity, IDbTransaction pTran) { Update(pEntity, true, pTran); }
/// <summary> /// 在事务内创建一个新实例 /// </summary> /// <param name="pEntity">实体实例</param> /// <param name="pTran">事务实例,可为null,如果为null,则不使用事务来更新</param> public void Create(OrderIntegralEntity pEntity, IDbTransaction pTran) { _currentDAO.Create(pEntity, pTran); }
/// <summary> /// 创建一个新实例 /// </summary> /// <param name="pEntity">实体实例</param> public void Create(OrderIntegralEntity pEntity) { _currentDAO.Create(pEntity); }
/// <summary> /// 分页根据实体条件查询实体 /// </summary> /// <param name="pQueryEntity">以实体形式传入的参数</param> /// <param name="pOrderBys">排序组合</param> /// <returns>符合条件的实体集</returns> public PagedQueryResult <OrderIntegralEntity> PagedQueryByEntity(OrderIntegralEntity pQueryEntity, OrderBy[] pOrderBys, int pPageSize, int pCurrentPageIndex) { return(_currentDAO.PagedQueryByEntity(pQueryEntity, pOrderBys, pPageSize, pCurrentPageIndex)); }
/// <summary> /// 根据实体条件查询实体 /// </summary> /// <param name="pQueryEntity">以实体形式传入的参数</param> /// <param name="pOrderBys">排序组合</param> /// <returns>符合条件的实体集</returns> public OrderIntegralEntity[] QueryByEntity(OrderIntegralEntity pQueryEntity, OrderBy[] pOrderBys) { return(_currentDAO.QueryByEntity(pQueryEntity, pOrderBys)); }
/// <summary> /// 删除 /// </summary> /// <param name="pEntity"></param> public void Delete(OrderIntegralEntity pEntity) { _currentDAO.Delete(pEntity); }
public void Update(OrderIntegralEntity pEntity, bool pIsUpdateNullField) { _currentDAO.Update(pEntity, pIsUpdateNullField); }
/// <summary> /// 更新 /// </summary> /// <param name="pEntity">实体实例</param> public void Update(OrderIntegralEntity pEntity) { Update(pEntity, true); }