Hidistro.SqlDal/VShop/OrderRedPagerDao.cs
(开头部分) 7KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
namespace Hidistro.SqlDal.VShop
{
using Hidistro.Core;
using Hidistro.Entities;
using Hidistro.Entities.Promotions;
using Hidistro.Entities.VShop;
using Hidistro.SqlDal.Promotions;
using Microsoft.Practices.EnterpriseLibrary.Data;
using System;
using System.Data;
using System.Data.Common;
public class OrderRedPagerDao
{
private Database database = DatabaseFactory.CreateDatabase();
public bool CreateOrderRedPager(OrderRedPagerInfo orderredpager)
{
DbCommand sqlStringCommand = this.database.GetSqlStringCommand("INSERT INTO vshop_OrderRedPager(OrderID,RedPagerActivityId,RedPagerActivityName,MaxGetTimes,AlreadyGetTimes,ItemAmountLimit,OrderAmountCanUse,ExpiryDays,UserID) VALUES(@OrderID,@RedPagerActivityId,@RedPagerActivityName,@MaxGetTimes,@AlreadyGetTimes,@ItemAmountLimit,@OrderAmountCanUse,@ExpiryDays,@UserID);select @@identity");
this.database.AddInParameter(sqlStringCommand, "OrderID", DbType.String, orderredpager.OrderID);
this.database.AddInParameter(sqlStringCommand, "RedPagerActivityId", DbType.Int32, orderredpager.RedPagerActivityId);
this.database.AddInParameter(sqlStringCommand, "RedPagerActivityName", DbType.String, orderredpager.RedPagerActivityName);
this.database.AddInParameter(sqlStringCommand, "MaxGetTimes", DbType.Int32, orderredpager.MaxGetTimes);
this.database.AddInParameter(sqlStringCommand, "AlreadyGetTimes", DbType.Int32, orderredpager.AlreadyGetTimes);
this.database.AddInParameter(sqlStringCommand, "ItemAmountLimit", DbType.Decimal, orderredpager.ItemAmountLimit);
this.database.AddInParameter(sqlStringCommand, "OrderAmountCanUse", DbType.Decimal, orderredpager.OrderAmountCanUse);
this.database.AddInParameter(sqlStringCommand, "ExpiryDays", DbType.Int32, orderredpager.ExpiryDays);
this.database.AddInParameter(sqlStringCommand, "UserID", DbType.Int32, orderredpager.UserID);
return (this.database.ExecuteNonQuery(sqlStringCommand) > 0);
}
public bool CreateOrderRedPager(string orderid, decimal ordertotalprice, int userid)
{
string query = "select top 1 ID,CouponId,CouponNumber,CouponName,ActivityName,ImgUrl,ShareTitle,Description from Hishop_ShareActivity where MeetValue<=@MeetValue and BeginDate<=GETDATE() and EndDate>=GETDATE() order by MeetValue desc ";
DbCommand sqlStringCommand = this.database.GetSqlStringCommand(query);
this.database.AddInParameter(sqlStringCommand, "MeetValue", DbType.Decimal, ordertotalprice);
DataTable table = this.database.ExecuteDataSet(sqlStringCommand).Tables[0];
if ((!string.IsNullOrEmpty(orderid) && (userid > 0)) && (table.Rows.Count > 0))
{
int couponId = Globals.ToNum(table.Rows[0]["CouponId"]);
if (couponId > 0)
{
CouponInfo couponDetails = new CouponDao().GetCouponDetails(couponId);
if (couponDetails != null)
{
OrderRedPagerInfo orderredpager = new OrderRedPagerInfo {
OrderID = orderid,
RedPagerActivityId = int.Parse(table.Rows[0]["ID"].ToString()),
RedPagerActivityName = table.Rows[0]["ActivityName"].ToString(),
MaxGetTimes = int.Parse(table.Rows[0]["CouponNumber"].ToString()),
AlreadyGetTimes = 0,
ItemAmountLimit = couponDetails.CouponValue,
OrderAmountCanUse = couponDetails.ConditionValue
};
TimeSpan span = (TimeSpan) (couponDetails.EndDate - DateTime.Now);
orderredpager.ExpiryDays = span.Days;
orderredpager.UserID = userid;
return this.CreateOrderRedPager(orderredpager);
}
}
后面还有 54 行代码,购买后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。
