protected void btadd_Click(object sender, EventArgs e) { XYECOM.Business.ChargeNewsSet cnBLL = new XYECOM.Business.ChargeNewsSet(); XYECOM.Model.ChargeNewsSetInfo cnInfo = new XYECOM.Model.ChargeNewsSetInfo(); string newsIds = this.nsid.Value; this.nsid.Value = newsIds; string[] aryIds = newsIds.Split('|'); long newsId = 0; foreach (string s in aryIds) { newsId = XYECOM.Core.MyConvert.GetInt64(s); //更新表,使HTML页面字段保持为空 XYECOM.Core.Function.UpdateColumuByWhere("NS_HTMLPage", "", " where NS_ID=" + this.nsid.Value, "n_news"); } Alert("收费新闻设置成功", backURL); }
private void InitPageControl(long newsId) { Table t = new Table(); TableRow row = new TableRow(); TableCell cell = new TableCell(); row.CssClass = "vtop"; cell.Text = "用户组"; row.Cells.Add(cell); cell = new TableCell(); cell.Text = "扣除虚拟货币数"; row.Cells.Add(cell); cell = new TableCell(); cell.Text = "扣除现金货币数"; row.Cells.Add(cell); t.Rows.Add(row); XYECOM.Business.ChargeNewsSet cnBLL = new XYECOM.Business.ChargeNewsSet(); XYECOM.Model.ChargeNewsSetInfo cnInfo = new XYECOM.Model.ChargeNewsSetInfo(); this.phMain.Controls.Add(t); }
protected void btadd_Click(object sender, EventArgs e) { bool isUpdate = false; if (XYECOM.Core.XYRequest.GetQueryString("action") == "edit") isUpdate = true; XYECOM.Business.UserGrade ugBLL = new XYECOM.Business.UserGrade(); List<XYECOM.Model.UserGradeInfo> infos = ugBLL.GetItems(); XYECOM.Business.ChargeNewsSet cnBLL = new XYECOM.Business.ChargeNewsSet(); XYECOM.Model.ChargeNewsSetInfo cnInfo = new XYECOM.Model.ChargeNewsSetInfo(); bool isShowChargeNews = false; string newsIds = this.nsid.Value; this.nsid.Value = newsIds; string[] aryIds = newsIds.Split('|'); long newsId = 0; foreach (string s in aryIds) { newsId = XYECOM.Core.MyConvert.GetInt64(s); foreach (XYECOM.Model.UserGradeInfo info in infos) { isShowChargeNews = XYECOM.Business.UserGradePopedom.IsShowChargeNews(info.GradeId); if (!isShowChargeNews) continue; if (isUpdate) cnInfo = cnBLL.GetItem(newsId, info.GradeId); if (cnInfo == null) { cnInfo = new ChargeNewsSetInfo(); isUpdate = false; } TextBox txt = (TextBox)phMain.FindControl("txtWebMoney" + info.GradeId); cnInfo.CN_ConsumeWebMoney = XYECOM.Core.MyConvert.GetInt32(txt.Text.Trim()); txt = (TextBox)phMain.FindControl("txtMoney" + info.GradeId); cnInfo.CN_ConsumeMoney = XYECOM.Core.MyConvert.GetInt32(txt.Text.Trim()); if (!isUpdate && newsId > 0) { cnInfo.CN_VisitPopedom = (short)info.GradeId; cnInfo.NS_ID = newsId; cnBLL.Insert(cnInfo); } else cnBLL.Update(cnInfo); cnInfo = null; if (XYECOM.Core.XYRequest.GetQueryString("action") == "edit") isUpdate = true; } //更新表,使HTML页面字段保持为空 XYECOM.Core.Function.UpdateColumuByWhere("NS_HTMLPage", "", " where NS_ID=" + this.nsid.Value, "n_news"); } Alert("收费新闻设置成功", backURL); }
private void DeductChargeForNews() { string _newsId = XYECOM.Core.XYRequest.GetQueryString("nid"); string _webMoney = XYECOM.Core.XYRequest.GetQueryString("webmoney"); string _money = XYECOM.Core.XYRequest.GetQueryString("money"); if (_newsId.Equals("") || _webMoney.Equals("") || _money.Equals("")) { ResponseXML(Result.Null, "数据不完整!"); } long newsId = Convert.ToInt64(_newsId); Decimal webmoney = Convert.ToDecimal(_webMoney); Decimal money = Convert.ToDecimal(_money); Int64 userId = 0; if (Business.CheckUser.CheckUserLogin()) userId = Business.CheckUser.UserInfo.userid; XYECOM.Model.ChargeNewsSetInfo chargeNesSetInfo = new XYECOM.Model.ChargeNewsSetInfo(); XYECOM.Business.ChargeNewsSet chargeNewsSetBLL = new XYECOM.Business.ChargeNewsSet(); XYECOM.Business.ChargeNews chargeNewsBLL = new XYECOM.Business.ChargeNews(); if (webmoney == 0 && money == 0) { chargeNesSetInfo.U_ID = userId; chargeNesSetInfo.NS_ID = newsId; int row = chargeNewsSetBLL.Insert(chargeNesSetInfo); if (row >= 0) //strMsg = "ok$0"; //添加成功,因为扣费皆为0,所以只插入付费信息 ResponseXML(Result.Success, "添加成功"); else //strMsg = "err$1"; //缴费失败 ResponseXML(Result.Failed, "缴费失败"); } else { int rowAff = chargeNewsBLL.ConsumeUpdateMoney(userId, newsId, webmoney, money); if (rowAff >= 0) { //strMsg += "ok$1"; //扣费成功,消费记录,付费记录都成功 ResponseXML(Result.Success, "成功"); } else if (rowAff == -1) //strMsg += "err$-1"; //扣费失败,因为帐户余额不足 ResponseXML(Result.Failed, "帐户余额不足"); else //strMsg += "err$1"; //扣费失败 ResponseXML(Result.Failed, "帐户余额不足"); } }
private void InitPageControl(long newsId) { XYECOM.Business.UserGrade ugBLL = new XYECOM.Business.UserGrade(); List<XYECOM.Model.UserGradeInfo> infos = ugBLL.GetItems(); Table t = new Table(); TableRow row = new TableRow(); TableCell cell = new TableCell(); row.CssClass = "vtop"; cell.Text = "用户组"; row.Cells.Add(cell); cell = new TableCell(); cell.Text = "扣除虚拟货币数"; row.Cells.Add(cell); cell = new TableCell(); cell.Text = "扣除现金货币数"; row.Cells.Add(cell); t.Rows.Add(row); XYECOM.Business.ChargeNewsSet cnBLL = new XYECOM.Business.ChargeNewsSet(); XYECOM.Model.ChargeNewsSetInfo cnInfo = new XYECOM.Model.ChargeNewsSetInfo(); bool isShowChargeNews = false; foreach (XYECOM.Model.UserGradeInfo info in infos) { isShowChargeNews = XYECOM.Business.UserGradePopedom.IsShowChargeNews(info.GradeId); row = new TableRow(); cell = new TableCell(); row.CssClass = "vtop"; if (newsId == 0) cnInfo = new ChargeNewsSetInfo(); else cnInfo = cnBLL.GetItem(newsId, info.GradeId); if(cnInfo == null) cnInfo = new ChargeNewsSetInfo(); System.Web.UI.WebControls.Label lblGradeName = new System.Web.UI.WebControls.Label(); lblGradeName.Enabled = isShowChargeNews; lblGradeName.ID = "lblGradeId" + info.GradeId; lblGradeName.Text = info.GradeName; cell.Controls.Add(lblGradeName); row.Cells.Add(cell); cell = new TableCell(); TextBox txtWebMoney = new TextBox(); txtWebMoney.Enabled = isShowChargeNews; txtWebMoney.Columns = 5; txtWebMoney.MaxLength = 4; txtWebMoney.ID = "txtWebMoney" + info.GradeId; txtWebMoney.Text = cnInfo.CN_ConsumeWebMoney.ToString(); cell.Controls.Add(txtWebMoney); RangeValidator rv = new RangeValidator(); rv.ControlToValidate = "txtWebMoney" + info.GradeId; rv.ErrorMessage = "*"; rv.MaximumValue = "9999"; rv.MinimumValue = "0"; rv.Type = ValidationDataType.Integer; cell.Controls.Add(rv); row.Cells.Add(cell); cell = new TableCell(); TextBox txtMoney = new TextBox(); txtMoney.Enabled = isShowChargeNews; txtMoney.Columns = 5; txtMoney.MaxLength = 4; txtMoney.ID = "txtMoney" + info.GradeId; txtMoney.Text = cnInfo.CN_ConsumeMoney.ToString(); cell.Controls.Add(txtMoney); RangeValidator rv1 = new RangeValidator(); rv1.ControlToValidate = "txtMoney" + info.GradeId; rv1.ErrorMessage = "*"; rv1.MaximumValue = "9999"; rv1.MinimumValue = "0"; rv1.Type = ValidationDataType.Integer; cell.Controls.Add(rv1); row.Cells.Add(cell); t.Rows.Add(row); } this.phMain.Controls.Add(t); }