本文整理汇总了C#中MySqlDatabase.GetProductById方法的典型用法代码示例。如果您正苦于以下问题:C# MySqlDatabase.GetProductById方法的具体用法?C# MySqlDatabase.GetProductById怎么用?C# MySqlDatabase.GetProductById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MySqlDatabase
的用法示例。
在下文中一共展示了MySqlDatabase.GetProductById方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
Session["bodyid"] = "user-home";
//IncludePage(ProtectInc, Resources.Resource.incProtect);
//IncludePage(RhosMovementInc, Resources.Resource.incRhosMovement2);
LoginView lv = Master.FindControl("HeadLoginView") as LoginView;
if (lv != null)
{
//lv.Visible = false;
}
LoginUser.DestinationPageUrl = "~/Member/MemberHome.aspx";
string productId = string.Empty;
string country = string.Empty;
string price = string.Empty;
string addParams = string.Empty;
if (Request.Params["pid"] != null)
{
productId = Request.Params["pid"];
if (Request.Params["country"] != null)
country = Request.Params["country"];
if (Request.Params["price"] != null)
price = Request.Params["price"];
if (!string.IsNullOrEmpty(productId))
{
LogonMessage.Text = Resources.Resource.LogonRequiredForPurchase;
int prodid = 0;
if (!int.TryParse(productId, out prodid))
prodid = 0;
ProductInfo prodInfo = null;
using (Database db = new MySqlDatabase())
{
prodInfo = db.GetProductById(prodid);
}
if (Request.Params["tid"] == null)
{
addParams = string.Format("pid={0}&country={1}&price={2}", productId, country, price);
decimal decPrice = 0m;
if (!decimal.TryParse(price, out decPrice))
decPrice = 0;
if (decPrice > 0m)
{
if (System.String.Compare(prodInfo.Extra, "subscription", System.StringComparison.OrdinalIgnoreCase) != 0)
LoginUser.DestinationPageUrl = "~/Member/BuyProduct.aspx?" + addParams;
else
LoginUser.DestinationPageUrl = "~/Member/Subscription.aspx?" + addParams;
}
else
{
LoginUser.DestinationPageUrl = "~/Member/Quotation.aspx?" + addParams;
}
}
else
{
addParams = string.Format("tid={0}&pid={1}", Request.Params["tid"], Request.Params["pid"]);
LoginUser.DestinationPageUrl = "~/Member/BuyProduct.aspx?" + addParams;
}
}
}
string guid = string.Empty;
string type = string.Empty;
string email = string.Empty;
string emailRequesting = string.Empty;
//messageDiv.Visible = false;
if (Request.Params["id"] != null)
{
guid = Request.Params["id"];
if (Request.Params["tp"] != null)
type = Request.Params["tp"];
addParams = string.Format("id={0}&tp={1}", guid, type);
using (Database db = new MySqlDatabase())
{
db.ProcessConfirmation(guid, Convert.ToInt32(type), out email, out emailRequesting);
}
LogonMessage.Text = string.Format(Resources.Resource.LogonEmailUnknown, email);
//messageDiv.Visible = true;
}
//RegisterHyperLink.NavigateUrl = "Register.aspx?ReturnUrl=" + HttpUtility.UrlEncode(Request.QueryString["ReturnUrl"]) + "&" + addParams;
if (Convert.ToString(Session["culture"]).Contains("nl"))
{
ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_LanguageNL" + "');", true);
ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_LanguageUS" + "');", true);
}
else
{
ClientScript.RegisterStartupScript(this.GetType(), "HighLightLangBtn", "HighLightLangBtn('" + "ctl00_LanguageUS" + "');", true);
ClientScript.RegisterStartupScript(this.GetType(), "UnHighLightLangBtn", "UnHighLightLangBtn('" + "ctl00_LanguageNL" + "');", true);
}
Control ctrlDiv = this.Master.FindControl("logoutDiv");
ctrlDiv.Visible = false;
}
示例3: SubscriptionSubmit_Click
protected void SubscriptionSubmit_Click(object sender, EventArgs e)
{
int ecl, vcl;
Util.GetUserClearanceLevels(Util.UserId, out vcl, out ecl);
int qty = 0;
if (int.TryParse(QuantityEdit.Text, out qty))
{
int prodid = (int)Session["subscription.productid"];
decimal unitprice = (decimal)Session["subscription.unitprice"];
decimal baseprice = 0m;
string desc = string.Empty;
ProductInfo pi;
using (Database db = new MySqlDatabase())
{
pi = db.GetProductById(prodid);
if (ecl < 100 || vcl < 100)
{
ProductPriceInfoList ppil = db.GetProductPrices(prodid, Request.Params["country"]);
desc = pi.Name;
baseprice = ppil[0].Price;
}
}
decimal totalprice = baseprice + (unitprice * qty);
Session["amt"] = totalprice;
if (pi.Extra.Length > 0)
pi.Extra += "\x01";
pi.Extra += string.Format("{0:F2}", baseprice);
List<ProductInfo> products = new List<ProductInfo>();
if (baseprice > 0m)
products.Add(pi);
string name = string.Format("{0} credits", qty);
//desc = string.Format("{0} credits @ EUR {1:F2}", qty, unitprice);
desc = string.Format("Managed Plan {0} credits", qty);
pi = new ProductInfo(0, name, desc, qty, unitprice.ToString());
if (baseprice == 0m)
pi.Extra = "subscription";
products.Add(pi);
PurchaseProduct(prodid, totalprice, desc, products.ToArray());
}
}
示例4: Page_Load
protected void Page_Load(object sender, EventArgs e)
{
Session["bodyid"] = "user-home";
if (Session != null)
{
// Store essential session information temporarily
string culture = Session["culture"] as string ?? "nl-NL";
Session.Clear();
FormsAuthentication.SignOut();
// Restore the essential session information
Session["culture"] = culture;
}
if (Request.IsAuthenticated)
{
if (Request.Params["pid"] != null || Request.Params["tid"] != null)
{
Response.Redirect(string.Format("~/Account/Login.aspx?tid={0}&pid={1}",
Request.Params["tid"],
Request.Params["pid"]), false);
}
else
{
Response.Redirect("~/Default.aspx", false);
}
}
Literal name = HeadLoginView.FindControl("HeadLoginName") as Literal;
if (name != null)
{
if (Session["userid"] != null)
{
long userId = Util.UserId;
using (Database db = new MySqlDatabase())
{
ClientInfo ci = db.GetClientInfo(userId);
name.Text = string.Format(" {0}", ci.GetFullName());
}
}
}
SetStringForWizardLabel("PasswordLengthLabel", string.Format(Resources.Resource.NewPasswordReq, Membership.MinRequiredPasswordLength));
RegisterUser.ContinueDestinationPageUrl = REGISTER_CONTINUATION_PAGE;
if (!string.IsNullOrEmpty(Request.Params["pid"]))
{
Session["register.pid"] = Request.Params["pid"];
Session["register.country"] = Request.Params["country"];
Session["register.price"] = Request.Params["price"];
}
if (Session["register.pid"] != null)
{
string destinationPage = "BuyProduct";
decimal price = 0m;
if (!decimal.TryParse(Session["register.price"] as string, out price))
price = 0m;
if (price == 0m)
{
destinationPage = "Quotation";
}
else
{
int prodid;
if (!int.TryParse(Request.Params["pid"], out prodid))
prodid = 0;
if (prodid > 0)
{
using (Database db = new MySqlDatabase())
{
ProductInfo prodInfo = db.GetProductById(prodid);
if (System.String.Compare(prodInfo.Extra, "subscription", System.StringComparison.OrdinalIgnoreCase) == 0)
destinationPage = "Subscription";
}
}
}
RegisterUser.ContinueDestinationPageUrl = string.Format("~/Member/{0}.aspx?pid={1}&country={2}&price={3}",
destinationPage,
Session["register.pid"],
Session["register.country"],
Session["register.price"]);
}
if (!string.IsNullOrEmpty(Request.Params["id"]))
{
Session["register.confirm.id"] = Request.Params["id"];
Session["register.confirm.tp"] = Request.Params["tp"];
RegisterUser.ContinueDestinationPageUrl = REGISTER_CONTINUATION_PAGE; // string.Format("~/Member/Confirm.aspx?id={0}&tp={1}", Request.Params["id"], Request.Params["tp"]);
}
if (!IsPostBack)
{
int pid = 0;
if (Request.Params["pid"] != null)
{
string tmp = Request.Params["pid"];
//.........这里部分代码省略.........