private void map(PriceReportInfo oParam, DataRow tempdr) { oParam.SysNo = Util.TrimIntNull(tempdr["SysNo"]); oParam.ProductSysNo = Util.TrimIntNull(tempdr["ProductSysNo"]); oParam.CurrentPrice = Util.TrimDecimalNull(tempdr["CurrentPrice"]); oParam.UnitCost = Util.TrimDecimalNull(tempdr["UnitCost"]); oParam.LastOrderPrice = Util.TrimDecimalNull(tempdr["LastOrderPrice"]); oParam.CompetitorSysNo = Util.TrimIntNull(tempdr["CompetitorSysNo"]); oParam.CompetitorPrice = Util.TrimDecimalNull(tempdr["CompetitorPrice"]); oParam.CompetitorUrl = Util.TrimNull(tempdr["CompetitorUrl"]); oParam.CustomerSysNo = Util.TrimIntNull(tempdr["CustomerSysNo"]); oParam.NickName = Util.TrimNull(tempdr["NickName"]); oParam.Email = Util.TrimNull(tempdr["Email"]); oParam.CustomerMemo = Util.TrimNull(tempdr["CustomerMemo"]); oParam.ReportTime = Util.TrimDateNull(tempdr["ReportTime"]); oParam.CustomerIP = Util.TrimNull(tempdr["CustomerIP"]); oParam.AuditUserSysNo = Util.TrimIntNull(tempdr["AuditUserSysNo"]); oParam.AuditMemo = Util.TrimNull(tempdr["AuditMemo"]); oParam.AuditNote = Util.TrimNull(tempdr["AuditNote"]); oParam.AuditTime = Util.TrimDateNull(tempdr["AuditTime"]); oParam.AbandonUserSysNo = Util.TrimIntNull(tempdr["AbandonUserSysNo"]); oParam.AbandonTime = Util.TrimDateNull(tempdr["AbandonTime"]); oParam.Point = Util.TrimIntNull(tempdr["Point"]); oParam.HandleType = Util.TrimIntNull(tempdr["HandleType"]); oParam.Reason = Util.TrimIntNull(tempdr["Reason"]); oParam.Status = Util.TrimIntNull(tempdr["Status"]); }
public int Insert(PriceReportInfo oParam) { PriceReportInfo pr = Load(oParam.ProductSysNo, oParam.CustomerSysNo); if (pr != null && pr.ReportTime.ToString(AppConst.DateFormat) == DateTime.Now.ToString(AppConst.DateFormat)) { throw new BizException("请勿重复提交价格举报信息!"); } return(new PriceReportDac().Insert(oParam)); }
public PriceReportInfo Load(int ProductSysNo, int CustomerSysNo) { string sql = "select * from price_report where productsysno=" + ProductSysNo + " and customersysno=" + CustomerSysNo; DataSet ds = SqlHelper.ExecuteDataSet(sql); if (Util.HasMoreRow(ds)) { PriceReportInfo oInfo = new PriceReportInfo(); map(oInfo, ds.Tables[0].Rows[0]); return(oInfo); } else { return(null); } }
public void Update(Hashtable paramHash) { TransactionOptions options = new TransactionOptions(); options.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted; options.Timeout = TransactionManager.DefaultTimeout; using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, options)) { if (paramHash.ContainsKey("Status")) { bool NeedAddPoint = false; int newStatus = Int32.Parse(paramHash["Status"].ToString()); int SysNo = Int32.Parse(paramHash["SysNo"].ToString()); PriceReportInfo oInfo = Load(SysNo); if (newStatus == (int)AppEnum.PriceReportStatus.Abandon) { if (oInfo.Status != (int)AppEnum.PriceReportStatus.Origin && oInfo.Status != (int)AppEnum.PriceReportStatus.AuditWaitingChangePrice) { throw new BizException("非初始状态,不能作废"); } } else if (newStatus == (int)AppEnum.PriceReportStatus.Origin) { if (oInfo.Status != (int)AppEnum.PriceReportStatus.Abandon) { throw new BizException("非作废状态,不能取消作废"); } } else if (newStatus == (int)AppEnum.PriceReportStatus.AuditedNotChangePrice) { NeedAddPoint = true; if (oInfo.Status != (int)AppEnum.PriceReportStatus.Origin && oInfo.Status != (int)AppEnum.PriceReportStatus.AuditWaitingChangePrice) { throw new BizException("非初始状态,不能审核不修改价格"); } } else if (newStatus == (int)AppEnum.PriceReportStatus.AuditChangePrice) { NeedAddPoint = true; if (oInfo.Status != (int)AppEnum.PriceReportStatus.Origin && oInfo.Status != (int)AppEnum.PriceReportStatus.AuditWaitingChangePrice) { throw new BizException("非初始状态,不能审核并修改价格"); } } new PriceReportDac().Update(paramHash); if (NeedAddPoint) { oInfo = Load(SysNo); CustomerPointRequestInfo cprInfo = new CustomerPointRequestInfo(); cprInfo.CustomerSysNo = oInfo.CustomerSysNo; cprInfo.PointSourceType = (int)AppEnum.PointSourceType.PriceReport; cprInfo.PointSourceSysNo = SysNo; cprInfo.PointLogType = (int)AppEnum.PointLogType.award; cprInfo.PointAmount = oInfo.Point; cprInfo.Memo = oInfo.AuditMemo; cprInfo.RequestTime = DateTime.Now; cprInfo.RequestUserSysNo = oInfo.AuditUserSysNo; cprInfo.RequestUserType = (int)AppEnum.CreateUserType.Employee; cprInfo.Status = (int)AppEnum.PointRequestStatus.Origin; PointManager.GetInstance().InsertCustomerPointRequest(cprInfo); } } else { new PriceReportDac().Update(paramHash); } scope.Complete(); } }
public int Insert(PriceReportInfo oParam) { string sql = @"INSERT INTO Price_Report ( ProductSysNo, CurrentPrice, UnitCost, LastOrderPrice, CompetitorSysNo, CompetitorPrice, CompetitorUrl, CustomerSysNo, NickName, Email, CustomerMemo, ReportTime, CustomerIP, AuditUserSysNo, AuditMemo, AuditNote, AuditTime, AbandonUserSysNo, AbandonTime, Point, HandleType, Reason, Status ) VALUES ( @ProductSysNo, @CurrentPrice, @UnitCost, @LastOrderPrice, @CompetitorSysNo, @CompetitorPrice, @CompetitorUrl, @CustomerSysNo, @NickName, @Email, @CustomerMemo, @ReportTime, @CustomerIP, @AuditUserSysNo, @AuditMemo, @AuditNote, @AuditTime, @AbandonUserSysNo, @AbandonTime, @Point, @HandleType, @Reason, @Status );set @SysNo = SCOPE_IDENTITY();"; SqlCommand cmd = new SqlCommand(sql); SqlParameter paramSysNo = new SqlParameter("@SysNo", SqlDbType.Int, 4); SqlParameter paramProductSysNo = new SqlParameter("@ProductSysNo", SqlDbType.Int, 4); SqlParameter paramCurrentPrice = new SqlParameter("@CurrentPrice", SqlDbType.Decimal, 9); SqlParameter paramUnitCost = new SqlParameter("@UnitCost", SqlDbType.Decimal, 9); SqlParameter paramLastOrderPrice = new SqlParameter("@LastOrderPrice", SqlDbType.Decimal, 9); SqlParameter paramCompetitorSysNo = new SqlParameter("@CompetitorSysNo", SqlDbType.Int, 4); SqlParameter paramCompetitorPrice = new SqlParameter("@CompetitorPrice", SqlDbType.Decimal, 9); SqlParameter paramCompetitorUrl = new SqlParameter("@CompetitorUrl", SqlDbType.NVarChar, 500); SqlParameter paramCustomerSysNo = new SqlParameter("@CustomerSysNo", SqlDbType.Int, 4); SqlParameter paramNickName = new SqlParameter("@NickName", SqlDbType.NVarChar, 100); SqlParameter paramEmail = new SqlParameter("@Email", SqlDbType.NVarChar, 100); SqlParameter paramCustomerMemo = new SqlParameter("@CustomerMemo", SqlDbType.NVarChar, 500); SqlParameter paramReportTime = new SqlParameter("@ReportTime", SqlDbType.DateTime); SqlParameter paramCustomerIP = new SqlParameter("@CustomerIP", SqlDbType.NVarChar, 50); SqlParameter paramAuditUserSysNo = new SqlParameter("@AuditUserSysNo", SqlDbType.Int, 4); SqlParameter paramAuditMemo = new SqlParameter("@AuditMemo", SqlDbType.NVarChar, 200); SqlParameter paramAuditNote = new SqlParameter("@AuditNote", SqlDbType.NVarChar, 200); SqlParameter paramAuditTime = new SqlParameter("@AuditTime", SqlDbType.DateTime); SqlParameter paramAbandonUserSysNo = new SqlParameter("@AbandonUserSysNo", SqlDbType.Int, 4); SqlParameter paramAbandonTime = new SqlParameter("@AbandonTime", SqlDbType.DateTime); SqlParameter paramPoint = new SqlParameter("@Point", SqlDbType.Int, 4); SqlParameter paramHandleType = new SqlParameter("@HandleType", SqlDbType.Int, 4); SqlParameter paramReason = new SqlParameter("@Reason", SqlDbType.Int, 4); SqlParameter paramStatus = new SqlParameter("@Status", SqlDbType.Int, 4); paramSysNo.Direction = ParameterDirection.Output; if (oParam.ProductSysNo != AppConst.IntNull) { paramProductSysNo.Value = oParam.ProductSysNo; } else { paramProductSysNo.Value = System.DBNull.Value; } if (oParam.CurrentPrice != AppConst.DecimalNull) { paramCurrentPrice.Value = oParam.CurrentPrice; } else { paramCurrentPrice.Value = System.DBNull.Value; } if (oParam.UnitCost != AppConst.DecimalNull) { paramUnitCost.Value = oParam.UnitCost; } else { paramUnitCost.Value = System.DBNull.Value; } if (oParam.LastOrderPrice != AppConst.DecimalNull) { paramLastOrderPrice.Value = oParam.LastOrderPrice; } else { paramLastOrderPrice.Value = System.DBNull.Value; } if (oParam.CompetitorSysNo != AppConst.IntNull) { paramCompetitorSysNo.Value = oParam.CompetitorSysNo; } else { paramCompetitorSysNo.Value = System.DBNull.Value; } if (oParam.CompetitorPrice != AppConst.DecimalNull) { paramCompetitorPrice.Value = oParam.CompetitorPrice; } else { paramCompetitorPrice.Value = System.DBNull.Value; } if (oParam.CompetitorUrl != AppConst.StringNull) { paramCompetitorUrl.Value = oParam.CompetitorUrl; } else { paramCompetitorUrl.Value = System.DBNull.Value; } if (oParam.CustomerSysNo != AppConst.IntNull) { paramCustomerSysNo.Value = oParam.CustomerSysNo; } else { paramCustomerSysNo.Value = System.DBNull.Value; } if (oParam.NickName != AppConst.StringNull) { paramNickName.Value = oParam.NickName; } else { paramNickName.Value = System.DBNull.Value; } if (oParam.Email != AppConst.StringNull) { paramEmail.Value = oParam.Email; } else { paramEmail.Value = System.DBNull.Value; } if (oParam.CustomerMemo != AppConst.StringNull) { paramCustomerMemo.Value = oParam.CustomerMemo; } else { paramCustomerMemo.Value = System.DBNull.Value; } if (oParam.ReportTime != AppConst.DateTimeNull) { paramReportTime.Value = oParam.ReportTime; } else { paramReportTime.Value = System.DBNull.Value; } if (oParam.CustomerIP != AppConst.StringNull) { paramCustomerIP.Value = oParam.CustomerIP; } else { paramCustomerIP.Value = System.DBNull.Value; } if (oParam.AuditUserSysNo != AppConst.IntNull) { paramAuditUserSysNo.Value = oParam.AuditUserSysNo; } else { paramAuditUserSysNo.Value = System.DBNull.Value; } if (oParam.AuditMemo != AppConst.StringNull) { paramAuditMemo.Value = oParam.AuditMemo; } else { paramAuditMemo.Value = System.DBNull.Value; } if (oParam.AuditNote != AppConst.StringNull) { paramAuditNote.Value = oParam.AuditNote; } else { paramAuditNote.Value = System.DBNull.Value; } if (oParam.AuditTime != AppConst.DateTimeNull) { paramAuditTime.Value = oParam.AuditTime; } else { paramAuditTime.Value = System.DBNull.Value; } if (oParam.AbandonUserSysNo != AppConst.IntNull) { paramAbandonUserSysNo.Value = oParam.AbandonUserSysNo; } else { paramAbandonUserSysNo.Value = System.DBNull.Value; } if (oParam.AbandonTime != AppConst.DateTimeNull) { paramAbandonTime.Value = oParam.AbandonTime; } else { paramAbandonTime.Value = System.DBNull.Value; } if (oParam.Point != AppConst.IntNull) { paramPoint.Value = oParam.Point; } else { paramPoint.Value = System.DBNull.Value; } if (oParam.HandleType != AppConst.IntNull) { paramHandleType.Value = oParam.HandleType; } else { paramHandleType.Value = System.DBNull.Value; } if (oParam.Reason != AppConst.IntNull) { paramReason.Value = oParam.Reason; } else { paramReason.Value = System.DBNull.Value; } if (oParam.Status != AppConst.IntNull) { paramStatus.Value = oParam.Status; } else { paramStatus.Value = System.DBNull.Value; } cmd.Parameters.Add(paramSysNo); cmd.Parameters.Add(paramProductSysNo); cmd.Parameters.Add(paramCurrentPrice); cmd.Parameters.Add(paramUnitCost); cmd.Parameters.Add(paramLastOrderPrice); cmd.Parameters.Add(paramCompetitorSysNo); cmd.Parameters.Add(paramCompetitorPrice); cmd.Parameters.Add(paramCompetitorUrl); cmd.Parameters.Add(paramCustomerSysNo); cmd.Parameters.Add(paramNickName); cmd.Parameters.Add(paramEmail); cmd.Parameters.Add(paramCustomerMemo); cmd.Parameters.Add(paramReportTime); cmd.Parameters.Add(paramCustomerIP); cmd.Parameters.Add(paramAuditUserSysNo); cmd.Parameters.Add(paramAuditMemo); cmd.Parameters.Add(paramAuditNote); cmd.Parameters.Add(paramAuditTime); cmd.Parameters.Add(paramAbandonUserSysNo); cmd.Parameters.Add(paramAbandonTime); cmd.Parameters.Add(paramPoint); cmd.Parameters.Add(paramHandleType); cmd.Parameters.Add(paramReason); cmd.Parameters.Add(paramStatus); return(SqlHelper.ExecuteNonQuery(cmd, out oParam.SysNo)); }