public void SetFreeShipFee(int CustomerSysNo, decimal increment, int freeShipFeeLogType, string freeShipFeeLogMemo) { TransactionOptions options = new TransactionOptions(); options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted; options.Timeout = TransactionManager.DefaultTimeout; using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options)) { int rowsAffected = new FreeShipFeeDac().SetFreeShipFee(CustomerSysNo, increment); if (rowsAffected != 1) { throw new BizException("客户免运费余额更新失败,可能因为运费余额不足。"); } if (increment != 0) { CustomerFreeShipFeeLogInfo oLog = new CustomerFreeShipFeeLogInfo(CustomerSysNo, freeShipFeeLogType, increment, freeShipFeeLogMemo); oLog.LogCheck = oLog.CalcLogCheck(); if (1 != new FreeShipFeeDac().Insert(oLog)) { throw new BizException("更新免运费余额失败"); } } scope.Complete(); } }
private void map(CustomerFreeShipFeeLogInfo oParam, DataRow tempdr) { oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]); oParam.CustomerSysNo = Util.TrimIntNull(tempdr["CustomerSysNo"]); oParam.FreeShipFeeLogType = Util.TrimIntNull(tempdr["FreeShipFeeLogType"]); oParam.FreeShipFeeAmount = Util.TrimDecimalNull(tempdr["FreeShipFeeAmount"]); oParam.CreateTime = Util.TrimDateNull(tempdr["CreateTime"]); oParam.Memo = Util.TrimNull(tempdr["Memo"]); oParam.LogCheck = Util.TrimNull(tempdr["LogCheck"]); }
public void CommendCustomerEmailVerified(int CustomerSysNo, string CommendEmail) { TransactionOptions options = new TransactionOptions(); options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted; options.Timeout = TransactionManager.DefaultTimeout; using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options)) { CustomerCommendInfo oInfo = LoadCustomerCommend(CommendEmail); if (oInfo == null) { throw new BizException(""); } decimal increment = 5; //推荐的好友通过Email验证赠送5¥运费 int rowsAffected = new FreeShipFeeDac().SetFreeShipFee(CustomerSysNo, increment); if (rowsAffected != 1) { throw new BizException("客户运费余额更新失败,可能因为运费余额不足。"); } UpdateCustomerCommendStatus(CommendEmail, (int)AppEnum.CommendStatus.Registered); //更新推荐状态 if (increment != 0) { int freeShipFeeLogType = (int)AppEnum.FreeShipFeeLogType.CustomerRegister; string freeShipFeeLogMemo = "推荐客户注册送运费 - " + CommendEmail; CustomerFreeShipFeeLogInfo oLog = new CustomerFreeShipFeeLogInfo(CustomerSysNo, freeShipFeeLogType, increment, freeShipFeeLogMemo); oLog.LogCheck = oLog.CalcLogCheck(); if (1 != new FreeShipFeeDac().Insert(oLog)) { throw new BizException("增加运费余额失败"); } } scope.Complete(); } }
public int Insert(CustomerFreeShipFeeLogInfo oParam) { string sql = @"INSERT INTO Customer_FreeShipFeeLog ( CustomerSysNo, FreeShipFeeLogType, FreeShipFeeAmount, CreateTime, Memo, LogCheck ) VALUES ( @CustomerSysNo, @FreeShipFeeLogType, @FreeShipFeeAmount, @CreateTime, @Memo, @LogCheck );set @SysNo = SCOPE_IDENTITY();"; SqlCommand cmd = new SqlCommand(sql); SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4); SqlParameter paramCustomerSysNo = new SqlParameter("@CustomerSysNo", SqlDbType.Int, 4); SqlParameter paramFreeShipFeeLogType = new SqlParameter("@FreeShipFeeLogType", SqlDbType.Int, 4); SqlParameter paramFreeShipFeeAmount = new SqlParameter("@FreeShipFeeAmount", SqlDbType.Decimal, 9); SqlParameter paramCreateTime = new SqlParameter("@CreateTime", SqlDbType.DateTime); SqlParameter paramMemo = new SqlParameter("@Memo", SqlDbType.NVarChar, 200); SqlParameter paramLogCheck = new SqlParameter("@LogCheck", SqlDbType.NVarChar, 200); paramSysNo.Direction = ParameterDirection.Output; if (oParam.CustomerSysNo != AppConst.IntNull) { paramCustomerSysNo.Value = oParam.CustomerSysNo; } else { paramCustomerSysNo.Value = System.DBNull.Value; } if (oParam.FreeShipFeeLogType != AppConst.IntNull) { paramFreeShipFeeLogType.Value = oParam.FreeShipFeeLogType; } else { paramFreeShipFeeLogType.Value = System.DBNull.Value; } if (oParam.FreeShipFeeAmount != AppConst.DecimalNull) { paramFreeShipFeeAmount.Value = oParam.FreeShipFeeAmount; } else { paramFreeShipFeeAmount.Value = System.DBNull.Value; } if (oParam.CreateTime != AppConst.DateTimeNull) { paramCreateTime.Value = oParam.CreateTime; } else { paramCreateTime.Value = System.DBNull.Value; } if (oParam.Memo != AppConst.StringNull) { paramMemo.Value = oParam.Memo; } else { paramMemo.Value = System.DBNull.Value; } if (oParam.LogCheck != AppConst.StringNull) { paramLogCheck.Value = oParam.LogCheck; } else { paramLogCheck.Value = System.DBNull.Value; } cmd.Parameters.Add(paramSysNo); cmd.Parameters.Add(paramCustomerSysNo); cmd.Parameters.Add(paramFreeShipFeeLogType); cmd.Parameters.Add(paramFreeShipFeeAmount); cmd.Parameters.Add(paramCreateTime); cmd.Parameters.Add(paramMemo); cmd.Parameters.Add(paramLogCheck); return(SqlHelper.ExecuteNonQuery(cmd, out oParam.SysNo)); }
public int InsertCustomerFreeShipFeeLog(CustomerFreeShipFeeLogInfo oParam) { return(new FreeShipFeeDac().Insert(oParam)); }