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 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 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 int InsertCustomerFreeShipFeeLog(CustomerFreeShipFeeLogInfo oParam) { return new FreeShipFeeDac().Insert(oParam); }