public ActionResult Save(ProductEntity product) { Swoopo.Model.JsonResult s = new Swoopo.Model.JsonResult(); try { product.RemainTime = product.EndTime.ToFileTime() - product.StarTime.ToFileTime(); ProductBLL proBll = new ProductBLL(); int result = proBll.Save(product); if (result > 0) { s.value = 1; } else { s.error = "保存失败!"; } } catch (BllException e) { #if DEBUG s.error = e.InnerException.StackTrace; #else s.error = e.Message; #endif } catch (DalException ex) { #if DEBUG s.error = ex.InnerException.StackTrace; #else s.error = ex.Message; #endif } return Json(s); }
public List<UserPriceProductEntity> GetByPaged(ProductEntity product, PagerCondition pagerCondition) { try { System.Data.Common.DbCommand cmd = db.GetStoredProcCommand("pagination"); db.AddInParameter(cmd, "tblName", DbType.String, tableName); db.AddInParameter(cmd, "strGetFields", DbType.String, pagerCondition.SelectFields); db.AddInParameter(cmd, "fldName", DbType.String, pagerCondition.SortField);//排序字段名 db.AddInParameter(cmd, "PageSize", DbType.Int32, pagerCondition.PageSize); db.AddInParameter(cmd, "PageIndex", DbType.Int32, pagerCondition.PageIndex); db.AddInParameter(cmd, "doCount", DbType.Byte, pagerCondition.doCount); db.AddInParameter(cmd, "OrderType", DbType.Byte, pagerCondition.SortType); db.AddInParameter(cmd, "strWhere", DbType.String, pagerCondition.StrWhere); using (IDataReader reader = db.ExecuteReader(cmd)) { reader.Close(); reader.Dispose(); } return null; } catch (Exception ex) { throw new DalException("系统异常!", ex); } }