public void LoadGift() { if (!string.IsNullOrEmpty(this.context.Request["PageSize"]) && !string.IsNullOrEmpty(this.context.Request["CurrentPage"])) { int pageSize = int.Parse(this.context.Request["PageSize"]); int pageIndex = int.Parse(this.context.Request["CurrentPage"]); GiftQuery giftQuery = new GiftQuery(); giftQuery.IsOnline = true; giftQuery.Page.PageSize = pageSize; giftQuery.Page.PageIndex = pageIndex; giftQuery.Page.SortBy = "GiftId"; giftQuery.Page.SortOrder = SortAction.Desc; DbQueryResult gifts = GiftHelper.GetGifts(giftQuery); DataTable data = gifts.Data; string str = "{\"totalCount\":\"" + gifts.TotalRecords + "\",\"data\":["; string text = ""; for (int i = 0; i < data.Rows.Count; i++) { if (text != "") { text += ","; } text = text + "{\"GiftId\":\"" + data.Rows[i]["GiftId"] + "\",\"Name\":\"" + data.Rows[i]["Name"] + "\",\"NeedPoint\":\"" + data.Rows[i]["NeedPoint"] + "\",\"ThumbnailUrl180\":\"" + Globals.GetImageServerUrl("http://", data.Rows[i]["ThumbnailUrl180"].ToNullString()) + "\"}"; } str += text; str += "]}"; this.context.Response.Write(str); } }
public void Delete(HttpContext context) { string text = context.Request["ids"]; if (string.IsNullOrWhiteSpace(text)) { throw new HidistroAshxException("错误的活动编号"); } int[] array = (from d in text.Split(',') select int.Parse(d)).ToArray(); int num = 0; int num2 = array.Count(); int[] array2 = array; foreach (int giftId in array2) { if (GiftHelper.DeleteGift(giftId)) { num++; } } if (num > 0) { if (num2 == 1) { base.ReturnSuccessResult(context, "删除成功", 0, true); } else { base.ReturnSuccessResult(context, $"成功删除{num}条记录", 0, true); } return; } throw new HidistroAshxException("删除失败"); }
private void Add(HttpContext context) { int value = base.GetIntParam(context, "giftId", false).Value; int value2 = base.GetIntParam(context, "quantity", false).Value; if (string.IsNullOrWhiteSpace(this.orderId)) { throw new HidistroAshxException("错误的数据编号"); } if (value <= 0) { throw new HidistroAshxException("错误的数据编号"); } if (value2 <= 0) { throw new HidistroAshxException("礼品数量填写错误"); } OrderInfo orderInfo = OrderHelper.GetOrderInfo(this.orderId); if (!orderInfo.CheckAction(OrderActions.MASTER_SELLER_MODIFY_GIFTS)) { throw new HidistroAshxException("当前订单状态没有订单礼品操作"); } GiftInfo giftDetails = GiftHelper.GetGiftDetails(value); if (giftDetails == null) { throw new HidistroAshxException("错误的数据编号"); } if (!OrderHelper.AddOrderGift(orderInfo, giftDetails, value2, 15.GetHashCode())) { throw new HidistroAshxException("添加订单礼品失败,可能礼品己存在"); } base.ReturnSuccessResult(context, "操作成功!", 0, true); }
public string GetPrizeName(int PrizeType, int PrizeValue) { switch (PrizeType) { case 2: { CouponInfo coupon = CouponHelper.GetCoupon(PrizeValue); if (coupon != null) { return(coupon.Price.F2ToString("f2") + "元优惠券"); } return(PrizeValue + "元优惠券"); } case 3: { GiftInfo giftDetails = GiftHelper.GetGiftDetails(PrizeValue); if (giftDetails != null) { return(giftDetails.Name); } return("礼品"); } default: return(PrizeValue + "积分"); } }
/// <summary> /// 多尺寸繪製 /// </summary> /// <param name="img">圖檔</param> /// <param name="Size">尺寸陣列(from BS_Profile)</param> /// <param name="sFolderPath">資料夾路徑</param> /// <param name="fileExtension">副檔名</param> /// <returns></returns> public List <MultiSizeImg> ResizeImg(Image img, String[] Size, String sFolderPath, String fileExtension) { try { List <MultiSizeImg> MultiSizeImgList = new List <MultiSizeImg>(); foreach (var item in Size) { MultiSizeImg MultiSizeImgData = new MultiSizeImg(item.Substring(0, 1)); String[] WidthHeight = GiftHelper.GetProfileParm(item).Replace(" ", "").Split('x'); MultiSizeImgData.Width = Convert.ToInt32(WidthHeight[0]); MultiSizeImgData.Height = Convert.ToInt32(WidthHeight[1]); //resize MultiSizeImgData.ImageOut = new Bitmap(img, MultiSizeImgData.Width, MultiSizeImgData.Height); MultiSizeImgData.FileName = Guid.NewGuid().ToString() + fileExtension; MultiSizeImgData.FilePath = Path.Combine(sFolderPath, MultiSizeImgData.FileName); MultiSizeImgList.Add(MultiSizeImgData); } return(MultiSizeImgList); } catch (Exception ex) { logger.Error("ResizeImg 圖片多尺寸繪製" + ex.Message); //在外層處理 throw ex; } }
public string GetPrizeType(PrizeTypes PrizeType, int PrizeValue) { string result = string.Empty; switch (PrizeType) { case PrizeTypes.Integral: result = PrizeValue + "积分; "; break; case PrizeTypes.Coupou: { CouponInfo coupon = CouponHelper.GetCoupon(PrizeValue); result = ((coupon == null) ? " " : ((!(coupon.ClosingTime > coupon.StartTime)) ? (coupon.Price + "元优惠券<font style='color:red;'>(已失效)</font>; ") : (coupon.Price + "元优惠券; "))); break; } case PrizeTypes.Gift: { GiftInfo giftDetails = GiftHelper.GetGiftDetails(PrizeValue); result = ((giftDetails == null) ? " " : (giftDetails.Name + "; ")); break; } } return(result); }
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 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); } }
public override void BuildPacket() { this.PushIntoStack(userGeneral == null ? string.Empty : userGeneral.GeneralName.ToNotNullString()); this.PushIntoStack(userGeneral == null ? string.Empty : userGeneral.HeadID.ToNotNullString()); this.PushIntoStack(userGeneral == null ? (short)0 : userGeneral.FeelLv); this.PushIntoStack(userGeneral == null ? 0 : userGeneral.FeelExperience); this.PushIntoStack(upExperience); this.PushIntoStack(giftName.ToNotNullString()); this.PushIntoStack(userGeneral == null ? (short)0 : userGeneral.SaturationNum); this.PushIntoStack(goldNum); this.PushIntoStack(skillName.ToNotNullString()); this.PushIntoStack(demandLv); this.PushIntoStack(isLearn); this.PushIntoStack(skillDesc.ToNotNullString()); this.PushIntoStack(isSaturation); this.PushIntoStack(propertyList.Count); foreach (var item in propertyList) { int upNum = GiftHelper.FeelUpPropertyNum(ContextUser.UserID, generalID, item.AbilityType); DataStruct dsItem = new DataStruct(); dsItem.PushIntoStack((int)item.AbilityType); dsItem.PushIntoStack((int)item.AbilityValue); dsItem.PushIntoStack(upNum); this.PushIntoStack(dsItem); } }
protected override void AttachChildControls() { int num = this.Page.Request["RecordId"].ToInt(0); if (num <= 0) { base.GotoResourceNotFound("记录不存在!"); } else { UserAwardRecordsInfo userAwardRecordsInfo = ActivityHelper.GetUserAwardRecordsInfo(num); if (userAwardRecordsInfo == null) { base.GotoResourceNotFound("记录不存在!"); } else if (userAwardRecordsInfo.PrizeType != 3) { base.GotoResourceNotFound("记录不存在!"); } else { this.litMarketPrice = (Literal)this.FindControl("litMarketPrice"); this.litDescript = (Literal)this.FindControl("litDescript"); this.imgPrize = (Image)this.FindControl("imgPrize"); this.goBuy = (HtmlAnchor)this.FindControl("goBuy"); this.litName = (Literal)this.FindControl("litName"); if (userAwardRecordsInfo.Status == 2) { this.goBuy.Visible = false; } else { this.goBuy.HRef = "SubmmitOrder.aspx?from=prize&RecordId=" + num; } GiftInfo giftDetails = GiftHelper.GetGiftDetails(userAwardRecordsInfo.PrizeValue); if (giftDetails != null) { this.litName.Text = giftDetails.Name; if (giftDetails.MarketPrice.HasValue) { this.litMarketPrice.Text = "市场参考价:" + giftDetails.MarketPrice.Value.F2ToString("f2"); } else { this.litMarketPrice.Visible = false; } this.litDescript.Text = giftDetails.LongDescription; this.imgPrize.ImageUrl = giftDetails.ImageUrl; PageTitle.AddSiteNameTitle("奖品详情"); } else { base.GotoResourceNotFound("礼品已被删除!"); } } } }
public void GetLP(HttpContext context) { List <GiftInfo> allGift = GiftHelper.GetAllGift(); StringBuilder stringBuilder = new StringBuilder(); JavaScriptSerializer javaScriptSerializer = new JavaScriptSerializer(); javaScriptSerializer.Serialize(allGift, stringBuilder); context.Response.Write(stringBuilder); context.Response.End(); }
private void LoadGift() { GiftInfo giftDetails = GiftHelper.GetGiftDetails(this.giftId); if (giftDetails == null) { base.GotoResourceNotFound(); } else { Globals.EntityCoding(giftDetails, false); this.txtGiftName.Text = Globals.HtmlDecode(giftDetails.Name); this.txtPurchasePrice.Text = string.Format("{0:F2}", giftDetails.PurchasePrice); this.txtNeedPoint.Text = giftDetails.NeedPoint.ToString(); if (!string.IsNullOrEmpty(giftDetails.Unit)) { this.txtUnit.Text = giftDetails.Unit; } if (giftDetails.CostPrice.HasValue) { this.txtCostPrice.Text = string.Format("{0:F2}", giftDetails.CostPrice); } if (giftDetails.MarketPrice.HasValue) { this.txtMarketPrice.Text = string.Format("{0:F2}", giftDetails.MarketPrice); } if (!string.IsNullOrEmpty(giftDetails.ShortDescription)) { this.txtShortDescription.Text = Globals.HtmlDecode(giftDetails.ShortDescription); } if (!string.IsNullOrEmpty(giftDetails.LongDescription)) { this.fcDescription.Text = giftDetails.LongDescription; } if (!string.IsNullOrEmpty(giftDetails.Title)) { this.txtGiftTitle.Text = Globals.HtmlDecode(giftDetails.Title); } if (!string.IsNullOrEmpty(giftDetails.Meta_Description)) { this.txtTitleDescription.Text = Globals.HtmlDecode(giftDetails.Meta_Description); } if (!string.IsNullOrEmpty(giftDetails.Meta_Keywords)) { this.txtTitleKeywords.Text = Globals.HtmlDecode(giftDetails.Meta_Keywords); } if (!string.IsNullOrEmpty(giftDetails.ImageUrl)) { this.uploader1.UploadedImageUrl = giftDetails.ImageUrl; } this.chkDownLoad.Checked = giftDetails.IsDownLoad; this.chkPromotion.Checked = giftDetails.IsPromotion; } }
private void grdGift_RowDeleting(object sender, System.Web.UI.WebControls.GridViewDeleteEventArgs e) { int giftId = (int)this.grdGift.DataKeys[e.RowIndex].Value; if (GiftHelper.DeleteGift(giftId)) { this.ShowMsg("成功的删除了一件礼品信息", true); this.BindData(); return; } this.ShowMsg("未知错误", false); }
private void grdGift_RowDeleting(object sender, GridViewDeleteEventArgs e) { int giftId = (int)grdGift.DataKeys[e.RowIndex].Value; if (GiftHelper.DeleteGift(giftId)) { ShowMsg("成功的删除了一件礼品信息", true); BindData(); } else { ShowMsg("未知错误", false); } }
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); } }
private void ProcessRequests(Guid portalId) { MsCrmResultObject resultRequestList = GiftHelper.GetGiftReuqestListByStatus(portalId, GiftStatus.Confirmed, _sda); if (resultRequestList.Success) { try { List <UserGiftRequest> lstRequests = resultRequestList.GetReturnObject <List <UserGiftRequest> >(); FileLogHelper.LogFunction(this.GetType().Name, "RequestCount:" + lstRequests.Count.ToString(), @Globals.FileLogPath); foreach (UserGiftRequest req in lstRequests) { MsCrmResult result = SendToServiceBirIleri(req); if (result.Success) { req.OrderCode = result.Result; req.Status = new OptionSetValueWrapper() { AttributeValue = (int)GiftStatus.ServiceSent }; } else { req.ErrorDesc = result.Result; req.Status = new OptionSetValueWrapper() { AttributeValue = (int)GiftStatus.ServiceError }; FileLogHelper.LogFunction(this.GetType().Name, "SendToService::" + result.Result, @Globals.FileLogPath); } GiftHelper.UpdateGiftRequest(req, _service); } } catch (Exception ex) { FileLogHelper.LogFunction(this.GetType().Name, ex.Message, @Globals.FileLogPath); } } else { FileLogHelper.LogFunction(this.GetType().Name, resultRequestList.Result, @Globals.FileLogPath); } }
private DataGridViewModel <Dictionary <string, object> > GetDataList(GiftQuery query) { DataGridViewModel <Dictionary <string, object> > dataGridViewModel = new DataGridViewModel <Dictionary <string, object> >(); if (query != null) { DbQueryResult gifts = GiftHelper.GetGifts(query); dataGridViewModel.rows = DataHelper.DataTableToDictionary(gifts.Data); dataGridViewModel.total = gifts.TotalRecords; foreach (Dictionary <string, object> row in dataGridViewModel.rows) { row["ThumbnailUrl40"] = base.GetImageOrDefaultImage(row["ThumbnailUrl40"], base.CurrentSiteSetting.DefaultProductImage); } } return(dataGridViewModel); }
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 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); } } } }
private void BindData() { GiftQuery query = new GiftQuery { Name = this.giftName, IsPromotion = this.isPromotion }; query.Page.PageSize = this.pager.PageSize; query.Page.PageIndex = this.pager.PageIndex; query.Page.SortBy = this.grdGift.SortOrderBy; if (this.grdGift.SortOrder.ToLower() == "desc") { query.Page.SortOrder = SortAction.Desc; } DbQueryResult gifts = GiftHelper.GetGifts(query); this.grdGift.DataSource = gifts.Data; this.grdGift.DataBind(); this.pager.TotalRecords = gifts.TotalRecords; this.pager1.TotalRecords = gifts.TotalRecords; }
private void BindData() { GiftQuery query = new GiftQuery(); query.Name = 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 gifts = GiftHelper.GetGifts(query); grdGift.DataSource = gifts.Data; grdGift.DataBind(); pager.TotalRecords = gifts.TotalRecords; pager1.TotalRecords = gifts.TotalRecords; }
private void lkbDelectCheck_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.Checked && GiftHelper.DeleteGift(System.Convert.ToInt32(this.grdGift.DataKeys[gridViewRow.RowIndex].Value, System.Globalization.CultureInfo.InvariantCulture))) { num++; } } if (num > 0) { this.ShowMsg(string.Format("成功的删除了{0}件礼品", num), true); this.BindData(); return; } this.ShowMsg("请选择您要删除的礼品", false); }
private void BindPromotionGifts(PromotionInfo promotion) { this.hidSelectGiftId.Value = promotion.GiftIds.ToString(); IList <GiftInfo> giftDetailsByGiftIds = GiftHelper.GetGiftDetailsByGiftIds(promotion.GiftIds); if (giftDetailsByGiftIds.Count != 0) { StringBuilder stringBuilder = new StringBuilder(); foreach (GiftInfo item in giftDetailsByGiftIds) { stringBuilder.Append(item.GiftId + "|||" + item.Name + "|||" + (item.CostPrice.HasValue ? item.CostPrice.Value.F2ToString("f2") : "0") + ",,,"); } if (stringBuilder.ToString().Length > 0) { HiddenField hiddenField = this.hidAllSelectedGifts; HiddenField hiddenField2 = this.hidSelectGifts; string text3 = hiddenField.Value = (hiddenField2.Value = stringBuilder.ToString().Substring(0, stringBuilder.Length - 3)); } } }
private void dlstGifts_ItemCommand(object source, DataListCommandEventArgs e) { if (e.CommandName == "check") { if (!order.CheckAction(OrderActions.MASTER_SELLER_MODIFY_GIFTS)) { ShowMsg("当前订单状态没有订单礼品操作", false); } else { int num; int itemIndex = e.Item.ItemIndex; int giftId = int.Parse(dlstGifts.DataKeys[itemIndex].ToString()); TextBox box = dlstGifts.Items[itemIndex].FindControl("txtQuantity") as TextBox; if (!int.TryParse(box.Text.Trim(), out num)) { ShowMsg("礼品数量填写错误", false); } else if (num <= 0) { ShowMsg("礼品赠送数量不能为0", false); } else { GiftInfo giftDetails = GiftHelper.GetGiftDetails(giftId); if (giftDetails == null) { base.GotoResourceNotFound(); } else if (!OrderHelper.AddOrderGift(order, giftDetails, num)) { ShowMsg("添加订单礼品失败", false); } else { BindOrderGifts(); } } } } }
public GiftServiceResult Post(GiftUpdateInfo val) { GiftServiceResult returnValue = new GiftServiceResult(); if (string.IsNullOrWhiteSpace(val.api_key) || string.IsNullOrWhiteSpace(val.id)) { returnValue.message = "Failure"; return(returnValue); } if (val.api_key != "6r9ZTok8zp4yZxKq") { returnValue.message = "Not authorized"; return(returnValue); } try { IOrganizationService service = MSCRM.GetOrgService(true); UserGiftRequest request = new UserGiftRequest(); request.Id = new Guid(val.id); request.ShippingCompany = val.shipping_company; request.ShippingNo = val.shipping_no; request.Note = val.note; request.ServiceStatus = val.status; GiftHelper.UpdateGiftRequest(request, service); returnValue.message = "Success"; } catch (Exception ex) { returnValue.message = "Failure | Ex:" + ex.Message; } return(returnValue); }
private void lkbDelectCheck_Click(object sender, EventArgs e) { int num = 0; foreach (GridViewRow row in this.grdGift.Rows) { CheckBox box = (CheckBox) row.FindControl("checkboxCol"); if (box.Checked && GiftHelper.DeleteGift(Convert.ToInt32(this.grdGift.DataKeys[row.RowIndex].Value, CultureInfo.InvariantCulture))) { num++; } } if (num > 0) { this.ShowMsg(string.Format("成功的删除了{0}件礼品", num), true); this.BindData(); } else { this.ShowMsg("请选择您要删除的礼品", false); } }
private void UpdateIsDownLoad() { if (!string.IsNullOrEmpty(base.Request.QueryString["oper"]) && base.Request.QueryString["oper"].Trim() == "update" && !string.IsNullOrEmpty(base.Request.QueryString["GiftId"]) && !string.IsNullOrEmpty(base.Request.QueryString["Status"]) && int.Parse(base.Request.QueryString["GiftId"].Trim()) > 0 && int.Parse(base.Request.QueryString["Status"].Trim()) >= 0) { int giftId = int.Parse(base.Request.QueryString["GiftId"]); bool isdownload = false; string str = "取消"; if (int.Parse(base.Request.QueryString["Status"].Trim()) == 1) { isdownload = true; str = "允许"; } if (GiftHelper.UpdateIsDownLoad(giftId, isdownload)) { this.BindData(); this.ShowMsg(str + "当前礼品下载成功!", true); return; } this.ShowMsg(str + "当前礼品下载失败!", false); } }
private void dlstGifts_ItemCommand(object sender, System.Web.UI.WebControls.DataListCommandEventArgs e) { if (e.CommandName == "check") { if (!this.order.CheckAction(OrderActions.MASTER_SELLER_MODIFY_GIFTS)) { this.ShowMsg("当前订单状态没有订单礼品操作", false); return; } int itemIndex = e.Item.ItemIndex; int giftId = int.Parse(this.dlstGifts.DataKeys[itemIndex].ToString()); System.Web.UI.WebControls.TextBox textBox = this.dlstGifts.Items[itemIndex].FindControl("txtQuantity") as System.Web.UI.WebControls.TextBox; int num; if (!int.TryParse(textBox.Text.Trim(), out num)) { this.ShowMsg("礼品数量填写错误", false); return; } if (num <= 0) { this.ShowMsg("礼品赠送数量不能为0", false); return; } GiftInfo giftDetails = GiftHelper.GetGiftDetails(giftId); if (giftDetails == null) { base.GotoResourceNotFound(); return; } if (!OrderHelper.AddOrderGift(this.order, giftDetails, num, 0)) { this.ShowMsg("添加订单礼品失败", false); return; } this.BindOrderGifts(); } }
public override bool TakeAction() { UserHelper.GetFeelHunger(ContextUser.UserID, generalID); UserHelper.ChechDailyRestrain(ContextUser.UserID); generalInfo = new ShareCacheStruct <GeneralInfo>().FindKey(generalID); if (generalInfo != null) { giftName = GiftHelper.GetGiftTypeName(generalInfo.GiftType); if (generalInfo.ReplaceSkills != null) { demandLv = generalInfo.ReplaceSkills.FeelLv; AbilityInfo abilityInfo = new ShareCacheStruct <AbilityInfo>().FindKey(generalInfo.ReplaceSkills.AbilityID); if (abilityInfo != null) { skillName = abilityInfo.AbilityName; skillDesc = abilityInfo.AbilityDesc; } } } userGeneral = new PersonalCacheStruct <UserGeneral>().FindKey(ContextUser.UserID, generalID); if (userGeneral != null) { FeelLvInfo feelLvInfo = new ShareCacheStruct <FeelLvInfo>().FindKey(userGeneral.FeelLv); if (feelLvInfo != null) { propertyList = feelLvInfo.Property.ToList(); } short feelLv = MathUtils.Addition(userGeneral.FeelLv, (short)1, GiftHelper.maxFeelLv); FeelLvInfo upfeelLvInfo = new ShareCacheStruct <FeelLvInfo>().FindKey(feelLv); if (upfeelLvInfo != null) { upExperience = upfeelLvInfo.Experience; } if (demandLv > 0 && userGeneral.FeelLv >= demandLv) { isLearn = 1; } else { isLearn = 0; } } goldNum = GiftHelper.SurplusGoldNum(ContextUser.UserID); int _itemid = 5050; //消除饱食度物品ID var package = UserItemPackage.Get(ContextUser.UserID); var itemArray = package.ItemPackage.FindAll( m => m.ItemStatus.Equals(ItemStatus.BeiBao) && m.ItemID.Equals(_itemid)); if (itemArray.Count > 0) { isSaturation = 1; } else { isSaturation = 0; } return(true); }