/** * SeckillInfoEdit.aspx.cs * * 功 能: 特价信息编辑页 * 类 名: SeckillInfoEdit * * Ver 变更日期 负责人 变更内容 * ─────────────────────────────────── * V0.01 2013-4-9 10:43 吴崎均 初版 * V0.02 2013-4-12 17:45 吴崎均 修改Page_load方法为Target=GetDataById参数分配LoadModelById()方法 * V0.03 2013-4-16 吴崎均 变更查询方式,使分页过程中修改查询条件对分页无影响 * V0.03 2013-5-3 10:24 吴崎均 修改关联字典表的字段存储值为MeanValue * * * * * */ using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using CY.BLL.Sys; using CY.BLL.EC; using CY.Infrastructure.Common; using CY.Model; using CY.WebForm.cs; using CY.BLL; namespace CY.WebForm.Pages.business { /// /// 特价信息编辑页 /// public partial class SeckillInfoEdit : BasePage { private Sys_DictionaryBLL _sys_DictionaryBLL = null;//字典业务逻辑操作类对象 private SysInquiry_PrintingTypeBLL _sysInquiry_PrintingTypeBLL = null;//印刷业务类型业务逻辑操作类对象 private EC_SeckillInfoBLL _eC_SeckillInfoBLL = null;//特价信息业务逻辑操作对象 /// /// 初始化 /// public SeckillInfoEdit() { _sys_DictionaryBLL = new Sys_DictionaryBLL(); _eC_SeckillInfoBLL = new EC_SeckillInfoBLL(); _sysInquiry_PrintingTypeBLL = new SysInquiry_PrintingTypeBLL(); } protected void Page_Load(object sender, EventArgs e) { try { switch (Request["Target"]) { case "SaveInfo": SaveSeckillInfo(); break; case "GetDataById": LoadModelById(); break; default://一般情况不处理 InitPageData(); LoadModelById(); if (IsPostBack || IsCallback) return; else { } return; } } catch (Exception ex) { PAGEHandleException(ex); Response.Clear(); Response.Write("-1"); } Response.End(); } /// /// 根据编号加载数据 /// /// private bool LoadModelById() { // DealMvc.Common.Net.DealString.ChangeSQL(Request["ParamName"]) int? id = MyConvert.ConvertToInt32(Request["id"]); if (!id.HasValue) { EC_SeckillInfo m_EC_SeckillInfo = new EC_SeckillInfo(); m_EC_SeckillInfo.ContactPhone = CurrentMemberExtend.PhoneNum; m_EC_SeckillInfo.Contacts = CurrentMemberExtend.BusinessContacts; m_EC_SeckillInfo.QQ = CurrentMemberExtend.QQ; m_EC_SeckillInfo.EndTime = DateTime.Now.AddDays(3); string jsonmodel = JsonHelper.GetJsonStringByObject(m_EC_SeckillInfo); Request.RequestContext.RouteData.DataTokens.Add("jmodel", jsonmodel); return false; } this.txtKeyid.Value = id.HasValue ? id.Value.ToString() : string.Empty; EC_SeckillInfo eC_SeckillInfo = _eC_SeckillInfoBLL.SelectModleById(id.Value); string jmodel = null == eC_SeckillInfo ? "" : JsonHelper.GetJsonStringByObject(eC_SeckillInfo); //若是外部获取数据则输出jsonString if (!string.IsNullOrEmpty(Request["IsFrontRequest"]) && "frontTrue".Equals(Request["IsFrontRequest"])) { Response.Write(jmodel); } else { if (eC_SeckillInfo.State == 0) selState.DataBind();//重新绑定 else ; int? stateId = eC_SeckillInfo.State; btnSave.Disabled = stateId.HasValue && stateId.Value == 0; selState.Disabled = !stateId.HasValue || btnSave.Disabled; Request.RequestContext.RouteData.DataTokens.Add("jmodel", jmodel); } return true; } /// /// 保存信息 /// private void SaveSeckillInfo() { //if ("0".Equals(Request["State"])) { Response.Write("-2"); return; }//已发布的信息不能被修改 EC_SeckillInfo seckillInfo = new EC_SeckillInfo(); seckillInfo.Operator = CurrentUser.ShortName; seckillInfo.SellerId = CurrentUser.MemberId; bool isWin= WebUtil.SaveData(_eC_SeckillInfoBLL.AddData, _eC_SeckillInfoBLL.UpdateData, seckillInfo); if (isWin && !seckillInfo.Keyid.HasValue) { Pay_PaymentAccountBLL _pay_PaymentAccountBLL = new Pay_PaymentAccountBLL(); Sys_DictionaryBLL _sys_DictionaryBLL = new BLL.Sys.Sys_DictionaryBLL(); isWin = _pay_PaymentAccountBLL.SendPoOrMoToMember(CurrentUser.MemberId,291, null); } } /// /// 初始化页面数据 /// private void InitPageData() { selState.DataSource = _sys_DictionaryBLL.GetDataByType("特价信息状态"); selState.DataBind(); selState.Value = "0"; } } }