/**
|
* SeckillBusinessEdit.aspx.cs
|
*
|
* 功 能: 特价业务编辑页
|
* 类 名: SeckillBusinessEdit
|
*
|
* Ver 变更日期 负责人 变更内容
|
* ───────────────────────────────────
|
* V0.01 2013-4-9 10:43 吴崎均 初版
|
* V0.02 2013-4-12 17:45 吴崎均 修改Page_load方法为Target=GetDataById参数分配LoadModelById()方法
|
* 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
|
{
|
|
/// <summary>
|
/// 特价业务编辑页
|
/// </summary>
|
public partial class SeckillBusinessEdit : BasePage
|
{
|
|
private Sys_DictionaryBLL _sys_DictionaryBLL = null;//字典业务逻辑操作类对象
|
private SysInquiry_PrintingTypeBLL _sysInquiry_PrintingTypeBLL = null;//印刷业务类型业务逻辑操作类对象
|
private EC_SeckillBusinessBLL _eC_SeckillBusinessBLL = null;//特价秒杀业务逻辑操作对象
|
|
/// <summary>
|
/// 初始化
|
/// </summary>
|
public SeckillBusinessEdit()
|
{
|
_sys_DictionaryBLL = new Sys_DictionaryBLL();
|
_eC_SeckillBusinessBLL = new EC_SeckillBusinessBLL();
|
_sysInquiry_PrintingTypeBLL = new SysInquiry_PrintingTypeBLL();
|
}
|
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
try
|
{
|
switch (Request["Target"])
|
{
|
case "SaveInfo":
|
SaveSeckill();
|
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();
|
}
|
|
/// <summary>
|
/// 根据编号加载数据
|
/// </summary>
|
/// <returns></returns>
|
private bool LoadModelById()
|
{
|
// DealMvc.Common.Net.DealString.ChangeSQL(Request["ParamName"])
|
int? id = MyConvert.ConvertToInt32(Request["id"]);
|
if (!id.HasValue)
|
{
|
EC_SeckillBusiness m_EC_SeckillBusiness = new EC_SeckillBusiness();
|
m_EC_SeckillBusiness.ContactPhone = CurrentMemberExtend.PhoneNum;
|
m_EC_SeckillBusiness.Contacts = CurrentMemberExtend.BusinessContacts;
|
m_EC_SeckillBusiness.QQ = CurrentMemberExtend.QQ;
|
m_EC_SeckillBusiness.EndTime = DateTime.Now.AddDays(3);
|
string jsonmodel = JsonHelper.GetJsonStringByObject(m_EC_SeckillBusiness);
|
|
Request.RequestContext.RouteData.DataTokens.Add("jmodel", jsonmodel);
|
return false;
|
}
|
EC_SeckillBusiness _eC_SeckillBusiness = _eC_SeckillBusinessBLL.SelectModleById(id.Value);
|
|
string jmodel = null == _eC_SeckillBusiness ? "" : JsonHelper.GetJsonStringByObject(_eC_SeckillBusiness);
|
|
|
//若是外部获取数据则输出jsonString
|
if (!string.IsNullOrEmpty(Request["IsFrontRequest"]) && "frontTrue".Equals(Request["IsFrontRequest"]))
|
{
|
Response.Write(jmodel);
|
}
|
else
|
{
|
if (_eC_SeckillBusiness.State == 0)
|
selState.DataBind();//重新绑定
|
else
|
;
|
|
int? stateId = _eC_SeckillBusiness.State;
|
btnSave.Disabled = stateId.HasValue && stateId.Value == 0;
|
Request.RequestContext.RouteData.DataTokens.Add("jmodel", jmodel);
|
}
|
|
return true;
|
}
|
|
/// <summary>
|
/// 保存信息
|
/// </summary>
|
private void SaveSeckill()
|
{
|
//if ("0".Equals(Request["State"])) { Response.Write("-2"); return; }//已发布的信息不能被修改
|
EC_SeckillBusiness seckillInfo = new EC_SeckillBusiness();
|
seckillInfo.Operator = CurrentUser.ShortName;
|
seckillInfo.MemberId = CurrentUser.MemberId;
|
bool isWin = WebUtil<EC_SeckillBusiness>.SaveData(_eC_SeckillBusinessBLL.AddData, _eC_SeckillBusinessBLL.UpdateData, seckillInfo);
|
if (isWin && !seckillInfo.Keyid.HasValue)//有发布秒杀时调用清除秒杀缓存方法
|
{
|
WebUtil.UpdateCacheByCoverWay(CacheDataFiles.SeckillBusiness);
|
Pay_PaymentAccountBLL _pay_PaymentAccountBLL = new Pay_PaymentAccountBLL();
|
Sys_DictionaryBLL _sys_DictionaryBLL = new BLL.Sys.Sys_DictionaryBLL();
|
isWin = _pay_PaymentAccountBLL.SendPoOrMoToMember(CurrentUser.MemberId, 290, null);
|
}
|
}
|
|
/// <summary>
|
/// 初始化页面数据
|
/// </summary>
|
private void InitPageData()
|
{
|
selPrintTypes.DataSource = _sysInquiry_PrintingTypeBLL.SelectUsedModlesByFirm(CurrentUser.MemberId);
|
selState.DataSource = _sys_DictionaryBLL.GetDataByType("特价业务状态");
|
|
selPrintTypes.DataBind();
|
selState.DataBind();
|
|
selPrintTypes.Items.Add(new ListItem("请选择", ""));
|
selPrintTypes.Value = "14";
|
selState.Value = "0";
|
//selState.Items.Remove(selState.Items[selState.SelectedIndex]);//添加时没有有效这个状态
|
//selState.Value = "-1";//默认为未发布
|
|
}
|
}
|
}
|