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); }
/// <summary> /// ����ָ���������ö��� /// </summary> /// <param name="ci">Ҫ�ĵ��������ö���</param> /// <returns>����,���ڻ����0��ɹ�,�����ʧ��</returns> public int Update(ChargeNewsSetInfo ci) { if (object.Equals(null, ci)) return -2; return DAL.Update(ci); }
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); }
/// <summary> /// ���һ���µ��������ö��� /// </summary> /// <param name="ci">Ҫ��ӵ��������ö���</param> /// <returns>����,���ڻ����0��ɹ�,����-1������ͬ����,������ʧ��</returns> public int Insert(ChargeNewsSetInfo ci) { if (object.Equals(null, ci)) return -2; return DAL.Insert(ci); }
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 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); }
/// <summary> /// ��ȡָ����ŵ��շ����Ŷ��� /// </summary> /// <param name="ciid">ָ�����շ����ű��</param> /// <returns>�ñ�Ŷ�Ӧ���շ����Ŷ���</returns> public ChargeNewsSetInfo GetItem(Int64 ciid) { ChargeNewsSetInfo info = null; SqlParameter[] param = new SqlParameter[] { new SqlParameter("@strWhere"," where CN_ID="+ciid.ToString()), new SqlParameter("@strTableName","n_ChargeNewsSet"), new SqlParameter("@strOrder","") }; using (SqlDataReader dr = XYECOM.Core.Data.SqlHelper.ExecuteReader(CommandType.StoredProcedure, "XYP_SelectByWhere", param)) { if (dr.Read()) { info = new ChargeNewsSetInfo(); info.NS_ID = Convert.ToInt64(dr["NS_ID"]); info.CN_VisitPopedom = Convert.ToInt16(dr["CN_VisitPopedom"]); info.CN_ConsumeWebMoney = Convert.ToInt32(dr["CN_ConsumeWebMoney"]); info.CN_ConsumeMoney = Convert.ToInt32(dr["CN_ConsumeMoney"]); info.CN_ID = Convert.ToInt64(dr["CN_ID"]); } } return info; }
/// <summary> /// ����ָ���������ö��� /// </summary> /// <param name="ci">Ҫ�ĵ��������ö���</param> /// <returns>����,���ڻ����0��ɹ�,�����ʧ��</returns> public int Update(ChargeNewsSetInfo ci) { SqlParameter[] param = new SqlParameter[] { new SqlParameter("@CN_ID",ci.CN_ID), new SqlParameter("@CN_VisitPopedom",ci.CN_VisitPopedom), new SqlParameter("@CN_ConsumeWebMoney",ci.CN_ConsumeWebMoney), new SqlParameter("@CN_ConsumeMoney",ci.CN_ConsumeMoney), new SqlParameter("@NS_ID",ci.NS_ID) }; return XYECOM.Core.Data.SqlHelper.ExecuteNonQuery(CommandType.StoredProcedure,"XYP_UpdateChargeNews", param); }