本文整理汇总了C#中MySqlDatabase.AddCreditHistory方法的典型用法代码示例。如果您正苦于以下问题:C# MySqlDatabase.AddCreditHistory方法的具体用法?C# MySqlDatabase.AddCreditHistory怎么用?C# MySqlDatabase.AddCreditHistory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MySqlDatabase
的用法示例。
在下文中一共展示了MySqlDatabase.AddCreditHistory方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CouponCodeGoCommand
protected void CouponCodeGoCommand(object sender, CommandEventArgs e)
{
string couponCode = CouponCodeEdit.Text;
using (Database db = new MySqlDatabase())
{
ClientInfo ci = db.GetClientInfo(Util.UserId);
if (db.CheckActivationCode(couponCode))
{
// Code is ok, raise the number of credits for this user
db.MarkActivationCode(couponCode, Util.UserId);
Config cfg = new Config();
cfg.Load(Server.MapPath("~/Config/trackprotect.config"));
long prodid = 0;
if (cfg["activationcode.productid"] != null)
prodid = Convert.ToInt64(cfg["activationcode.productid"]);
// Get the credits from the database
ProductInfo pi = db.GetProductById(prodid);
if (pi != null && pi.ProductId > 0)
{
// How many credits to issue
string transactionIdCoupon = string.Format("COUPON {0}", couponCode);
long orderId = db.CreateTransaction(Util.UserId, 0m, prodid, pi.Description);
db.UpdateTransaction(orderId.ToString(), "OK", "OK", "Payment Completed", "COUPON", couponCode, couponCode, transactionIdCoupon, "COUPON", 0m, pi, "EUR", Util.GetCountryIso2(ci.Country));
db.UpdateUserCredits(Util.UserId, prodid, pi.Credits);
db.AddCreditHistory(Util.UserId, prodid, pi.Credits, orderId);
Response.Redirect(string.Format("~/Member/CouponSuccess.aspx?cradd={0}", pi.Credits), false);
}
}
else
{
Response.Redirect(string.Format("~/Member/CouponFailure.aspx?couponcode={0}", couponCode), false);
}
}
}
示例2: SubmitButton_Command
//.........这里部分代码省略.........
(Genre3.SelectedItem.Text == "--Select--" ? "" : Genre3.SelectedItem.Text),
(SubGenre1.SelectedItem.Text == "--Select--" ? "" : SubGenre1.SelectedItem.Text),
(SubGenre2.SelectedItem.Text == "--Select--" ? "" : SubGenre2.SelectedItem.Text),
(SubGenre3.SelectedItem.Text == "--Select--" ? "" : SubGenre3.SelectedItem.Text),
(Tag1.SelectedItem.Text == "--Select--" ? "" : Tag1.SelectedItem.Text),
(Tag2.SelectedItem.Text == "--Select--" ? "" : Tag2.SelectedItem.Text),
(Tag3.SelectedItem.Text == "--Select--" ? "" : Tag3.SelectedItem.Text), StageNameText.Text.Trim());
if (registerId > 0)
{
if (!failed && !string.IsNullOrEmpty(f1))
failed = (RegisterDoc(registerId, f1) == 0);
if (!failed && !string.IsNullOrEmpty(f2))
failed = (RegisterDoc(registerId, f2) == 0);
if (!failed && !string.IsNullOrEmpty(f3))
failed = (RegisterDoc(registerId, f3) == 0);
if (!failed && CoArtistsTable.Rows.Count > 0)
{
foreach (DataRow row in CoArtistsTable.Rows)
{
string name = Convert.ToString(row[0]);
string role = Convert.ToString(row[1]);
long clientId = Convert.ToInt64(row[2]);
string id = clientId.ToString();
RegisterCoArtist(registerId, name, id, role);
}
}
if (!failed)
{
StatusInfo4.Text = Resources.Resource.RegistrationSuccessful;
db.DecrementCredits(Util.UserId);
db.AddCreditHistory(Util.UserId, 0L, 1, 0);
string certdocfile = Path.ChangeExtension(certfilename, ".pdf");
Util.SendRegistration(Convert.ToInt64(Session["managed.userid"]), uploadPath, trackName, certfilename, certdocfile);
}
else
{
StatusInfo4.Text = Resources.Resource.RegistrationFailed;
}
}
else
{
// Registration failed
StatusInfo4.Text = Resources.Resource.RegistrationFailed;
}
}
else
{
if (!string.IsNullOrEmpty(doc1))
DeleteFile(Path.Combine(uploadPath, Path.GetFileName(doc1)));
if (!string.IsNullOrEmpty(doc2))
DeleteFile(Path.Combine(uploadPath, Path.GetFileName(doc2)));
if (!string.IsNullOrEmpty(doc3))
DeleteFile(Path.Combine(uploadPath, Path.GetFileName(doc3)));
}
}
if (failed == false)
{
Session["TrackProtected"] = true;
if (cbxSendToSoundCloud.Checked == false)
Session["SoundCloud.Response"] = "Deactive";