Example #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(SOSOshop.Model.Order.OrderTransOnline model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("if(not exists(select 1 from OrderTransOnline where OrderId=@OrderId)) begin insert into OrderTransOnline(");
            strSql.Append("OrderId, CustomerID, CustomerName, MerSecName, TransId, TransOrderId, TransName, TransSeqNo, TransAmt, TransAmt1, FeeAmt, TransDateTime, TransPPDateTime, ClearingDate, TransStatus, CurrencyType, ProductInfo, MerchantId, PayAcctType, PayAccNo, PayBankNo, PayBankName, PayIp, MsgExt)");

            strSql.Append(" values (");
            strSql.Append("@OrderId, @CustomerID, @CustomerName, @MerSecName, @TransId, @TransOrderId, @TransName, @TransSeqNo, @TransAmt, @TransAmt1, @FeeAmt, @TransDateTime, @TransPPDateTime, @ClearingDate, @TransStatus, @CurrencyType, @ProductInfo, @MerchantId, @PayAcctType, @PayAccNo, @PayBankNo, @PayBankName, @PayIp, @MsgExt)");
            strSql.Append(" SELECT SCOPE_IDENTITY() end");

            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "OrderId", DbType.AnsiString, model.OrderId);
            db.AddInParameter(dbCommand, "CustomerID", DbType.AnsiString, model.CustomerID);
            db.AddInParameter(dbCommand, "CustomerName", DbType.AnsiString, model.CustomerName);
            db.AddInParameter(dbCommand, "MerSecName", DbType.AnsiString, model.MerSecName);
            db.AddInParameter(dbCommand, "TransId", DbType.AnsiString, model.TransId);
            db.AddInParameter(dbCommand, "TransOrderId", DbType.AnsiString, model.TransOrderId);
            db.AddInParameter(dbCommand, "TransName", DbType.AnsiString, model.TransName);
            db.AddInParameter(dbCommand, "TransSeqNo", DbType.AnsiString, model.TransSeqNo);
            db.AddInParameter(dbCommand, "TransAmt", DbType.Decimal, model.TransAmt);
            db.AddInParameter(dbCommand, "TransAmt1", DbType.Decimal, model.TransAmt1);
            db.AddInParameter(dbCommand, "FeeAmt", DbType.Decimal, model.FeeAmt);
            db.AddInParameter(dbCommand, "TransDateTime", DbType.DateTime, model.TransDateTime);
            db.AddInParameter(dbCommand, "TransPPDateTime", DbType.DateTime, model.TransPPDateTime);
            db.AddInParameter(dbCommand, "ClearingDate", DbType.DateTime, model.ClearingDate);
            db.AddInParameter(dbCommand, "TransStatus", DbType.AnsiString, model.TransStatus);
            db.AddInParameter(dbCommand, "CurrencyType", DbType.AnsiString, model.CurrencyType);
            db.AddInParameter(dbCommand, "ProductInfo", DbType.AnsiString, model.ProductInfo);
            db.AddInParameter(dbCommand, "MerchantId", DbType.AnsiString, model.MerchantId);
            db.AddInParameter(dbCommand, "PayAcctType", DbType.AnsiString, model.PayAcctType);
            db.AddInParameter(dbCommand, "PayAccNo", DbType.AnsiString, model.PayAccNo);
            db.AddInParameter(dbCommand, "PayBankNo", DbType.AnsiString, model.PayBankNo);
            db.AddInParameter(dbCommand, "PayBankName", DbType.AnsiString, model.PayBankName);
            db.AddInParameter(dbCommand, "PayIp", DbType.AnsiString, model.PayIp);
            db.AddInParameter(dbCommand, "MsgExt", DbType.AnsiString, model.MsgExt);

            int    cmdresult;
            object obj = db.ExecuteScalar(dbCommand);

            if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
            {
                cmdresult = 0;
            }
            else
            {
                cmdresult = int.Parse(obj.ToString());
            }
            return(cmdresult);
        }
Example #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(SOSOshop.Model.Order.OrderTransOnline model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update OrderTransOnline set ");
            strSql.Append("OrderId=@OrderId,");
            strSql.Append("CustomerID=@CustomerID,");
            strSql.Append("CustomerName=@CustomerName,");
            strSql.Append("MerSecName=@MerSecName,");
            strSql.Append("TransId=@TransId,");
            strSql.Append("TransOrderId=@TransOrderId,");
            strSql.Append("TransName=@TransName,");
            strSql.Append("TransSeqNo=@TransSeqNo,");
            strSql.Append("TransAmt=@TransAmt,");
            strSql.Append("TransAmt1=@TransAmt1,");
            strSql.Append("FeeAmt=@FeeAmt,");
            strSql.Append("TransDateTime=@TransDateTime,");
            strSql.Append("TransPPDateTime=@TransPPDateTime,");
            strSql.Append("ClearingDate=@ClearingDate,");
            strSql.Append("TransStatus=@TransStatus,");
            strSql.Append("CurrencyType=@CurrencyType,");
            strSql.Append("ProductInfo=@ProductInfo,");
            strSql.Append("MerchantId=@MerchantId,");
            strSql.Append("PayAcctType=@PayAcctType,");
            strSql.Append("PayAccNo=@PayAccNo,");
            strSql.Append("PayBankNo=@PayBankNo,");
            strSql.Append("PayBankName=@PayBankName,");
            strSql.Append("PayIp=@PayIp,");
            strSql.Append("MsgExt=@MsgExt");
            strSql.Append(" where ID=@ID ");

            DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());

            db.AddInParameter(dbCommand, "ID", DbType.Int32, model.ID);
            db.AddInParameter(dbCommand, "OrderId", DbType.AnsiString, model.OrderId);
            db.AddInParameter(dbCommand, "CustomerID", DbType.AnsiString, model.CustomerID);
            db.AddInParameter(dbCommand, "CustomerName", DbType.AnsiString, model.CustomerName);
            db.AddInParameter(dbCommand, "MerSecName", DbType.AnsiString, model.MerSecName);
            db.AddInParameter(dbCommand, "TransId", DbType.AnsiString, model.TransId);
            db.AddInParameter(dbCommand, "TransOrderId", DbType.AnsiString, model.TransOrderId);
            db.AddInParameter(dbCommand, "TransName", DbType.AnsiString, model.TransName);
            db.AddInParameter(dbCommand, "TransSeqNo", DbType.AnsiString, model.TransSeqNo);
            db.AddInParameter(dbCommand, "TransAmt", DbType.Decimal, model.TransAmt);
            db.AddInParameter(dbCommand, "TransAmt1", DbType.Decimal, model.TransAmt1);
            db.AddInParameter(dbCommand, "FeeAmt", DbType.Decimal, model.FeeAmt);
            db.AddInParameter(dbCommand, "TransDateTime", DbType.DateTime, model.TransDateTime);
            db.AddInParameter(dbCommand, "TransPPDateTime", DbType.DateTime, model.TransPPDateTime);
            db.AddInParameter(dbCommand, "ClearingDate", DbType.DateTime, model.ClearingDate);
            db.AddInParameter(dbCommand, "TransStatus", DbType.AnsiString, model.TransStatus);
            db.AddInParameter(dbCommand, "CurrencyType", DbType.AnsiString, model.CurrencyType);
            db.AddInParameter(dbCommand, "ProductInfo", DbType.AnsiString, model.ProductInfo);
            db.AddInParameter(dbCommand, "MerchantId", DbType.AnsiString, model.MerchantId);
            db.AddInParameter(dbCommand, "PayAcctType", DbType.AnsiString, model.PayAcctType);
            db.AddInParameter(dbCommand, "PayAccNo", DbType.AnsiString, model.PayAccNo);
            db.AddInParameter(dbCommand, "PayBankNo", DbType.AnsiString, model.PayBankNo);
            db.AddInParameter(dbCommand, "PayBankName", DbType.AnsiString, model.PayBankName);
            db.AddInParameter(dbCommand, "PayIp", DbType.AnsiString, model.PayIp);
            db.AddInParameter(dbCommand, "MsgExt", DbType.AnsiString, model.MsgExt);
            int rows = db.ExecuteNonQuery(dbCommand);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }