private void lkbtnDownloadCheck_Click(object sender, System.EventArgs e) { int num = 0; foreach (System.Web.UI.WebControls.GridViewRow gridViewRow in this.grdGift.Rows) { System.Web.UI.WebControls.CheckBox checkBox = (System.Web.UI.WebControls.CheckBox)gridViewRow.FindControl("checkboxCol"); if (checkBox != null && checkBox.Checked) { num++; } } if (num == 0) { this.ShowMsg("请先选择要下载的礼品", false); return; } foreach (System.Web.UI.WebControls.GridViewRow gridViewRow2 in this.grdGift.Rows) { System.Web.UI.WebControls.CheckBox checkBox2 = (System.Web.UI.WebControls.CheckBox)gridViewRow2.FindControl("checkboxCol"); if (checkBox2.Checked) { int giftId = (int)this.grdGift.DataKeys[gridViewRow2.RowIndex].Value; GiftInfo giftDetails = GiftHelper.GetGiftDetails(giftId); SubsiteGiftHelper.DownLoadGift(giftDetails); } } this.ShowMsg("下载的礼品成功", true); this.ReloadGiftsList(true); }
private void btnUpdate_Click(object sender, System.EventArgs e) { GiftInfo giftInfo = new GiftInfo(); int needPoint; if (!int.TryParse(this.txtNeedPoint.Text.Trim(), out needPoint)) { this.ShowMsg("兑换所需积分不能为空,大小0-10000之间", false); return; } giftInfo.GiftId = this.Id; giftInfo.NeedPoint = needPoint; giftInfo.Name = Globals.HtmlEncode(this.txtGiftName.Text.Trim()); giftInfo.Title = Globals.HtmlEncode(this.txtGiftTitle.Text.Trim()); giftInfo.Meta_Description = Globals.HtmlEncode(this.txtTitleDescription.Text.Trim()); giftInfo.Meta_Keywords = Globals.HtmlEncode(this.txtTitleKeywords.Text.Trim()); giftInfo.IsPromotion = this.ckpromotion.Checked; Globals.EntityCoding(giftInfo, false); if (SubsiteGiftHelper.UpdateMyGifts(giftInfo)) { this.ShowMsg("成功修改了一件礼品的基本信息", true); return; } this.ShowMsg("修改件礼品的基本信息失败", true); }
private void lkbtnDownloadCheck_Click(object sender, EventArgs e) { int num = 0; foreach (GridViewRow row in grdGift.Rows) { CheckBox box = (CheckBox)row.FindControl("checkboxCol"); if ((box != null) && box.Checked) { num++; } } if (num == 0) { ShowMsg("请先选择要下载的礼品", false); } else { foreach (GridViewRow row2 in grdGift.Rows) { CheckBox box2 = (CheckBox)row2.FindControl("checkboxCol"); if (box2.Checked) { int giftId = (int)grdGift.DataKeys[row2.RowIndex].Value; SubsiteGiftHelper.DownLoadGift(GiftHelper.GetGiftDetails(giftId)); } } ShowMsg("下载的礼品成功", true); ReloadGiftsList(true); } }
private void btnUpdate_Click(object sender, EventArgs e) { int num; GiftInfo entity = new GiftInfo(); if (!int.TryParse(this.txtNeedPoint.Text.Trim(), out num)) { this.ShowMsg("兑换所需积分不能为空,大小0-10000之间", false); } else { entity.GiftId = this.Id; entity.NeedPoint = num; entity.Name = Globals.HtmlEncode(this.txtGiftName.Text.Trim()); entity.Title = Globals.HtmlEncode(this.txtGiftTitle.Text.Trim()); entity.Meta_Description = Globals.HtmlEncode(this.txtTitleDescription.Text.Trim()); entity.Meta_Keywords = Globals.HtmlEncode(this.txtTitleKeywords.Text.Trim()); entity.IsPromotion = this.ckpromotion.Checked; Globals.EntityCoding(entity, false); if (SubsiteGiftHelper.UpdateMyGifts(entity)) { this.ShowMsg("成功修改了一件礼品的基本信息", true); } else { this.ShowMsg("修改件礼品的基本信息失败", true); } } }
protected void btnUpdate_Click(object sender, EventArgs e) { int num; GiftInfo entity = new GiftInfo(); if (!int.TryParse(txtNeedPoint.Text.Trim(), out num)) { ShowMsg("兑换所需积分不能为空,大小0-10000之间", false); } else { entity.GiftId = Id; entity.NeedPoint = num; entity.Name = txtGiftName.Text.Trim(); entity.Title = txtGiftTitle.Text.Trim(); entity.Meta_Description = txtTitleDescription.Text.Trim(); entity.Meta_Keywords = txtTitleKeywords.Text.Trim(); Globals.EntityCoding(entity, false); if (SubsiteGiftHelper.UpdateMyGifts(entity)) { ShowMsg("成功修改了一件礼品的基本信息", true); } else { ShowMsg("修改件礼品的基本信息失败", true); } } }
private void DeleteGriftById() { if (!string.IsNullOrEmpty(base.Request.QueryString["oper"]) && base.Request.QueryString["oper"].Trim() == "delete" && !string.IsNullOrEmpty(base.Request.QueryString["GiftId"]) && int.Parse(base.Request.QueryString["GiftId"].Trim()) > 0) { int giftId = int.Parse(base.Request.QueryString["GiftId"].Trim()); GiftInfo giftDetails = GiftHelper.GetGiftDetails(giftId); if (SubsiteGiftHelper.DeleteGiftById(giftId)) { this.ReloadGiftsList(true); this.ShowMsg("删除礼品" + giftDetails.Name + "成功!", true); return; } this.ShowMsg("删除礼品" + giftDetails.Name + "失败!", false); } }
void DeleteGriftById() { if ((!string.IsNullOrEmpty(base.Request.QueryString["oper"]) && (base.Request.QueryString["oper"].Trim() == "delete")) && (!string.IsNullOrEmpty(base.Request.QueryString["GiftId"]) && (int.Parse(base.Request.QueryString["GiftId"].Trim()) > 0))) { int giftId = int.Parse(base.Request.QueryString["GiftId"].Trim()); GiftInfo giftDetails = GiftHelper.GetGiftDetails(giftId); if (SubsiteGiftHelper.DeleteGiftById(giftId)) { ReloadGiftsList(true); ShowMsg("删除礼品" + giftDetails.Name + "成功!", true); } else { ShowMsg("删除礼品" + giftDetails.Name + "失败!", false); } } }
private void DownLoad() { if (!string.IsNullOrEmpty(base.Request.QueryString["oper"]) && base.Request.QueryString["oper"].Trim() == "download" && !string.IsNullOrEmpty(base.Request.QueryString["GiftId"]) && int.Parse(base.Request.QueryString["GiftId"].Trim()) > 0) { int giftId = int.Parse(base.Request.QueryString["GiftId"].Trim()); GiftInfo giftDetails = GiftHelper.GetGiftDetails(giftId); if (giftDetails.IsDownLoad && giftDetails.PurchasePrice > 0m) { if (SubsiteGiftHelper.DownLoadGift(giftDetails)) { this.ReloadGiftsList(true); this.ShowMsg("下载礼品" + giftDetails.Name + "成功!", true); return; } this.ShowMsg("下载礼品" + giftDetails.Name + "失败!", false); } } }
private void LoadGift() { GiftInfo myGiftsDetails = SubsiteGiftHelper.GetMyGiftsDetails(this.Id); this.txtGiftName.Text = Globals.HtmlDecode(myGiftsDetails.Name); this.lblPurchasePrice.Text = string.Format("{0:F2}", myGiftsDetails.PurchasePrice); this.txtNeedPoint.Text = myGiftsDetails.NeedPoint.ToString(); if (!string.IsNullOrEmpty(myGiftsDetails.Unit)) { this.lblUnit.Text = myGiftsDetails.Unit; } if (myGiftsDetails.MarketPrice.HasValue) { this.lblMarketPrice.Text = string.Format("{0:F2}", myGiftsDetails.MarketPrice); } if (!string.IsNullOrEmpty(myGiftsDetails.ShortDescription)) { this.lblShortDescription.Text = Globals.HtmlDecode(myGiftsDetails.ShortDescription); } if (!string.IsNullOrEmpty(myGiftsDetails.LongDescription)) { this.fcDescription.Text = myGiftsDetails.LongDescription; } if (!string.IsNullOrEmpty(myGiftsDetails.Title)) { this.txtGiftTitle.Text = Globals.HtmlDecode(myGiftsDetails.Title); } if (!string.IsNullOrEmpty(myGiftsDetails.Meta_Description)) { this.txtTitleDescription.Text = Globals.HtmlDecode(myGiftsDetails.Meta_Description); } if (!string.IsNullOrEmpty(myGiftsDetails.Meta_Keywords)) { this.txtTitleKeywords.Text = Globals.HtmlDecode(myGiftsDetails.Meta_Keywords); } if (!string.IsNullOrEmpty(myGiftsDetails.ImageUrl)) { this.uploader1.UploadedImageUrl = myGiftsDetails.ImageUrl; } if (myGiftsDetails.IsPromotion) { this.ckpromotion.Checked = true; } }
void BindData() { GiftQuery query = new GiftQuery(); query.Name = Globals.HtmlEncode(giftName); query.Page.PageSize = pager.PageSize; query.Page.PageIndex = pager.PageIndex; query.Page.SortBy = grdGift.SortOrderBy; if (grdGift.SortOrder.ToLower() == "desc") { query.Page.SortOrder = SortAction.Desc; } DbQueryResult abstroGiftsById = SubsiteGiftHelper.GetAbstroGiftsById(query); grdGift.DataSource = abstroGiftsById.Data; grdGift.DataBind(); pager.TotalRecords = abstroGiftsById.TotalRecords; pager1.TotalRecords = abstroGiftsById.TotalRecords; }
private void BindData() { GiftQuery giftQuery = new GiftQuery(); giftQuery.Name = Globals.HtmlEncode(this.giftName); giftQuery.Page.PageSize = this.pager.PageSize; giftQuery.Page.PageIndex = this.pager.PageIndex; giftQuery.Page.SortBy = this.grdGift.SortOrderBy; if (this.grdGift.SortOrder.ToLower() == "desc") { giftQuery.Page.SortOrder = SortAction.Desc; } DbQueryResult gifts = SubsiteGiftHelper.GetGifts(giftQuery); this.grdGift.DataSource = gifts.Data; this.grdGift.DataBind(); this.pager.TotalRecords = gifts.TotalRecords; this.pager1.TotalRecords = gifts.TotalRecords; }
private void DownLoad() { if ((!string.IsNullOrEmpty(base.Request.QueryString["oper"]) && (base.Request.QueryString["oper"].Trim() == "download")) && (!string.IsNullOrEmpty(base.Request.QueryString["GiftId"]) && (int.Parse(base.Request.QueryString["GiftId"].Trim()) > 0))) { GiftInfo giftDetails = GiftHelper.GetGiftDetails(int.Parse(base.Request.QueryString["GiftId"].Trim())); if (giftDetails.IsDownLoad && (giftDetails.PurchasePrice > 0M)) { if (SubsiteGiftHelper.DownLoadGift(giftDetails)) { ReloadGiftsList(true); ShowMsg("下载礼品" + giftDetails.Name + "成功!", true); } else { ShowMsg("下载礼品" + giftDetails.Name + "失败!", false); } } } }
protected void lkbtnDelete_Click(object sender, EventArgs e) { int num = 0; foreach (GridViewRow row in grdGift.Rows) { CheckBox box = (CheckBox)row.FindControl("checkboxCol"); if ((box != null) && box.Checked) { num++; } } if (num == 0) { ShowMsg("请先选择要删除的礼品", false); } else { bool success = true; string msg = "删除礼品成功!"; foreach (GridViewRow row2 in grdGift.Rows) { CheckBox box2 = (CheckBox)row2.FindControl("checkboxCol"); if (box2.Checked) { int giftId = (int)grdGift.DataKeys[row2.RowIndex].Value; if (!SubsiteGiftHelper.DeleteGiftById(giftId)) { success = false; msg = "删除礼品失败!"; break; } } } ShowMsg(msg, success); ReloadGiftsList(true); } }
private void lkbtnDelete_Click(object sender, System.EventArgs e) { int num = 0; foreach (System.Web.UI.WebControls.GridViewRow gridViewRow in this.grdGift.Rows) { System.Web.UI.WebControls.CheckBox checkBox = (System.Web.UI.WebControls.CheckBox)gridViewRow.FindControl("checkboxCol"); if (checkBox != null && checkBox.Checked) { num++; } } if (num == 0) { this.ShowMsg("请先选择要删除的礼品", false); return; } bool success = true; string string_ = "删除礼品成功!"; foreach (System.Web.UI.WebControls.GridViewRow gridViewRow2 in this.grdGift.Rows) { System.Web.UI.WebControls.CheckBox checkBox2 = (System.Web.UI.WebControls.CheckBox)gridViewRow2.FindControl("checkboxCol"); if (checkBox2.Checked) { int giftId = (int)this.grdGift.DataKeys[gridViewRow2.RowIndex].Value; if (!SubsiteGiftHelper.DeleteGiftById(giftId)) { success = false; string_ = "删除礼品失败!"; break; } } } this.ShowMsg(string_, success); this.ReloadGiftsList(true); }