本文整理汇总了C#中Payment.Save方法的典型用法代码示例。如果您正苦于以下问题:C# Payment.Save方法的具体用法?C# Payment.Save怎么用?C# Payment.Save使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Payment
的用法示例。
在下文中一共展示了Payment.Save方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PaymentCreate
public void PaymentCreate()
{
var liqpayConnId = "111000064";
var payment = new Payment
{
Amount = 13,
Currency = "RUB",
Connection = liqpayConnId,
};
payment.Params["description"] = "yo, liqpay";
Assert.AreEqual(0, payment.AmountPaid);
Assert.AreEqual(0, payment.AmountRefunded);
Assert.False(payment.Paid);
Assert.False(payment.Refunded);
Assert.False(payment.Cancelled);
Assert.True(string.IsNullOrEmpty(payment.Id));
payment.Save();
Assert.False(string.IsNullOrEmpty(payment.Id));
var payment2 = Payment.Get(payment.Id);
Assert.AreEqual(13, payment2.Amount);
Assert.AreEqual("RUB", payment2.Currency);
Assert.AreEqual(liqpayConnId, payment2.Connection);
Assert.AreEqual("yo, liqpay", payment2.Params["description"].ToString());
Assert.That(payment2.Created, Is.EqualTo(DateTime.UtcNow).Within(5).Minutes);
Assert.That(payment2.Modified, Is.EqualTo(DateTime.UtcNow).Within(5).Minutes);
Assert.True(payment2.PaymentUrl.Contains("unipag"));
Assert.AreEqual(payment.ToString(), payment2.ToString());
}
示例2: ClickCompanyItem
public static bool ClickCompanyItem(SysCompany company, SysMember user, DateTime dtDate, SysCompanyItem item, out int memberItemID, out string message)
{
memberItemID = 0;
if (item == null || user == null)
{
message = "参数错误!";
goto lbl_end;
}
if (item.ItemClicked >= item.ItemAmount)
{
message = "已经达到了最大可{ItemType}的数量";
goto lbl_end;
}
//check ItemLimitOnce
if (CheckCompanyItemOnceLimit(company.Id, user.Id))
{
message = ItemCheckResult[-3];
goto lbl_end;
}
decimal userLastOrderSum = UserBLL.GetUserLastMonthOrderSum(user.Id);
int result = CompanyItemBLL.ExecuteCheckFunc(user.Id, item.ItemID, userLastOrderSum);
if (result < 0)
{
message = ItemCheckResult.ContainsKey(result) ? ItemCheckResult[result] : "你无权{ItemType}此优惠项目!";
goto lbl_end;
}
//判断会员积分是否足够
decimal point = DB.Select(SysMember.Columns.MemberBalance).From<SysMember>( )
.Where(SysMember.IdColumn).IsEqualTo(user.Id)
.ExecuteScalar<decimal>( );
if (item.ItemPoint.HasValue && point < item.ItemPoint.Value)
{
message = "您的账户积分余额不足,无法{ItemType}^_^";
goto lbl_end;
}
SysMemberItem data = new SysMemberItem
{
CompanyID = item.CompanyID,
CompanyItemID = item.ItemID,
ItemDate = dtDate,
OrderDate = DateTime.Now,
MemberID = user.Id,
OrderSum = userLastOrderSum,
ItemPoint = item.ItemPoint,
ItemStatus = (int)MemberCompanyItemStatus.InProgress,
SetDate = null,
IsCanModifiedDate = true,
PaymentID = 0,
OrderID = 0
};
TransactionScope ts = new TransactionScope( );
SharedDbConnectionScope ss = new SharedDbConnectionScope( );
try
{
if (item.ItemPoint.HasValue && item.ItemPoint.Value > 0)
{
Payment p = new Payment
{
PaymentCode = string.Empty,
PaymentCompanyID = item.CompanyID,
PaymentDate = data.OrderDate.Value,
PaymentEmail = string.Empty,
PaymentMemberID = user.Id,
PaymentMemo = string.Format("抢购【{0}】的优惠项目,并使用{1:0.00}个积分消费", company.CompanyName, item.ItemPoint.Value),
PaymentOrderID = 0,
PaymentStatus = 2,
PaymentSum = -item.ItemPoint.Value,
PaymentType = (int)PaymentType.CompanyItem
};
p.Save( );
data.PaymentID = p.Id;
}
data.Save( );
item.ItemClicked = Utilities.ToInt(item.ItemClicked) + 1;
item.Save( );
OrderBLL.UpdateBalance( );
ts.Complete( );
message = "{ItemType}成功";
memberItemID = data.ItemID;
return true;
}
catch (Exception ex)
{
message = "{ItemType}失败:" + ex.Message;
Logging.Log("CompanyItemBLL->ClickCompanyItem", ex, true);
}
finally
{
ss.Dispose( );
ts.Dispose( );
}
lbl_end:
return false;
}
示例3: Insert
public void Insert(string PaymentCode,DateTime PaymentDate,int? PaymentMemberID,int? PaymentCompanyID,string PaymentEmail,decimal PaymentSum,string PaymentMemo,int PaymentStatus,int? PaymentType,int? PaymentOrderID,int? CreatedBy,DateTime? CreatedOn,int? ModifiedBy,DateTime? ModifiedOn)
{
Payment item = new Payment();
item.PaymentCode = PaymentCode;
item.PaymentDate = PaymentDate;
item.PaymentMemberID = PaymentMemberID;
item.PaymentCompanyID = PaymentCompanyID;
item.PaymentEmail = PaymentEmail;
item.PaymentSum = PaymentSum;
item.PaymentMemo = PaymentMemo;
item.PaymentStatus = PaymentStatus;
item.PaymentType = PaymentType;
item.PaymentOrderID = PaymentOrderID;
item.CreatedBy = CreatedBy;
item.CreatedOn = CreatedOn;
item.ModifiedBy = ModifiedBy;
item.ModifiedOn = ModifiedOn;
item.Save(UserName);
}
示例4: Insert
public void Insert(int QuoteKey,int? QuoteKeyActual,int PaymentStatus,DateTime DateCreated,int? RequestorUserKey,long? PaymentObjectSender,long? PaymentObjectReceiver,string PaymentDescription,int? TreasuryType)
{
Payment item = new Payment();
item.QuoteKey = QuoteKey;
item.QuoteKeyActual = QuoteKeyActual;
item.PaymentStatus = PaymentStatus;
item.DateCreated = DateCreated;
item.RequestorUserKey = RequestorUserKey;
item.PaymentObjectSender = PaymentObjectSender;
item.PaymentObjectReceiver = PaymentObjectReceiver;
item.PaymentDescription = PaymentDescription;
item.TreasuryType = TreasuryType;
item.Save(UserName);
}
示例5: ClickCompanyAds
public static bool ClickCompanyAds(SysMember user, int adsID, string answer, out string message)
{
SysCompanyAd item = SysCompanyAd.FetchByID(adsID);
SysCompany company = SysCompany.FetchByID(item.AdsCompanyID);
decimal userLastOrderSum = UserBLL.GetUserLastMonthOrderSum(user.Id);
if (!CheckCompanyAdsCanClick(user, item, company, userLastOrderSum, out message))
goto lbl_end;
if (!string.IsNullOrEmpty(item.AdsQuestion) && item.AdsRightAnswer.HasValue &&
Utilities.ToInt(answer) != item.AdsRightAnswer.Value)
{
message = "你的互动答题答案不正确!";
goto lbl_end;
}
decimal point = CompanyAdsBLL.GetCompanyAdPoint(userLastOrderSum, item.AdsID);
if (CompanyBLL.IsMaxPointLevel(company.Id, point))
{
message = "此广告主累计赠送的积分已经超过500,须进行积分结算后才能继续操作系统";
goto lbl_end;
}
SysMemberAd ad = new SysMemberAd
{
AdsDate = DateTime.Now,
AdsMemberID = user.Id,
AdsPoint = point,
CompanyID = item.AdsCompanyID,
CompanyAdsID = item.AdsID,
OrderSum = userLastOrderSum,
PaymentID = 0
};
TransactionScope ts = new TransactionScope( );
SharedDbConnectionScope ss = new SharedDbConnectionScope( );
try
{
ad.Save( );
item.AdsClicked = Utilities.ToInt(item.AdsClicked) + 1;
item.AdsPointSum = Utilities.ToDecimal(item.AdsPointSum) + point;
item.Save( );
if (ad.AdsPoint.HasValue && ad.AdsPoint.Value > 0)
{
var p = new Payment
{
PaymentDate = DateTime.Now,
PaymentCode = string.Empty,
PaymentCompanyID = item.AdsCompanyID,
PaymentEmail = string.Empty,
PaymentMemberID = user.Id,
PaymentMemo = string.Format("浏览【{0}】投放的广告,获得{1:0.00}个积分", company.CompanyName, ad.AdsPoint),
PaymentOrderID = ad.AdsID,
PaymentStatus = 1,
PaymentSum = ad.AdsPoint.Value,
PaymentType = (int)PaymentType.AdvsGive
};
p.Save( );
ad.PaymentID = p.Id;
ad.Save( );
OrderBLL.UpdateBalance( );
}
ts.Complete( );
message = string.Format("成功抢得{0}个积分", ad.AdsPoint);
return true;
}
catch (Exception ex)
{
message = "抢积分失败:" + ex.Message;
Logging.Log("CompanyAdsBLL->ClickCompanyAds", ex, true);
}
finally
{
ss.Dispose( );
ts.Dispose( );
}
lbl_end:
return false;
}