public string AddCoupon(int couponType, int bindType, int bindValue, string bindName, int ruleType, int ruleValue, int couponValue, string couponDesc, int maxLimitNum, DateTime endDate, string remark, string prefix) { ManageUserModel uM = (ManageUserModel)Session["logUser"]; T_Order_CouponInfo model = new T_Order_CouponInfo(); model.couponType = couponType; model.bindType = bindType; model.bindValue = bindValue; model.bindName = bindName; model.ruleType = ruleType; model.ruleValue = ruleValue; model.couponValue = couponValue; model.couponStatus = 0; model.couponDesc = couponDesc; model.maxLimitNum = maxLimitNum; model.createDate = DateTime.Now; model.endDate = endDate.AddHours(23).AddMinutes(59).AddSeconds(59); model.remark = remark; model.operatorId = uM.UserID; model.operarorIp = Request.UserHostAddress; model.operatorTime = DateTime.Now; model.prefixAgent = (prefix == null ? 0 : Convert.ToInt32(prefix)); model.id = T_Order_CouponInfoBLL.Add(model); if (model.id > 0) { return("0"); } else { return("-1"); } }
/// <summary> /// 增加一条数据 /// </summary> public int Add(T_Order_CouponInfo model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into i200.dbo.T_Order_CouponInfo("); strSql.Append("couponDesc,maxLimitNum,createDate,endDate,operatorId,operarorIp,operatorTime,remark,couponType,bindType,bindValue,bindName,ruleType,ruleValue,couponValue,couponStatus,prefixAgent"); strSql.Append(") values ("); strSql.Append("@couponDesc,@maxLimitNum,@createDate,@endDate,@operatorId,@operarorIp,@operatorTime,@remark,@couponType,@bindType,@bindValue,@bindName,@ruleType,@ruleValue,@couponValue,@couponStatus,@prefixAgent"); strSql.Append(") "); strSql.Append(";select @@IDENTITY"); object obj = HelperForFrontend.ExecuteScalar <int>(strSql.ToString(), new { couponDesc = model.couponDesc, maxLimitNum = model.maxLimitNum, createDate = model.createDate, endDate = model.endDate, operatorId = model.operatorId, operarorIp = model.operarorIp, operatorTime = model.operatorTime, remark = model.remark, couponType = model.couponType, bindType = model.bindType, bindValue = model.bindValue, bindName = model.bindName, ruleType = model.ruleType, ruleValue = model.ruleValue, couponValue = model.couponValue, couponStatus = model.couponStatus, prefixAgent = model.prefixAgent }); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
/// <summary> /// 增加一条数据 /// </summary> public static int Add(T_Order_CouponInfo model) { T_Order_CouponInfoDAL dal = new T_Order_CouponInfoDAL(); return(dal.Add(model)); }