当前位置: 首页>>代码示例>>C#>>正文


C# MySqlDatabase.AddCreditHistory方法代码示例

本文整理汇总了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);
                }
            }
        }
开发者ID:nageshverma2003,项目名称:TrackProtectSource,代码行数:38,代码来源:CouponCode.aspx.cs

示例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";
开发者ID:nageshverma2003,项目名称:TrackProtectSource,代码行数:67,代码来源:RegisterDocManaged.aspx.cs


注:本文中的MySqlDatabase.AddCreditHistory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。