using System;
|
using System.Collections.Generic;
|
using System.Linq;
|
using System.Web;
|
using System.Web.UI;
|
using System.Web.UI.WebControls;
|
using CY.BLL.Inquiry;
|
using CY.Model;
|
using CY.Infrastructure.Common;
|
namespace CY.WebForm.Pages.sysInquiry
|
{
|
public partial class PrintTypeLimit : BasePage
|
{
|
#region 变量
|
PaperInfoBLL _paperInfoBLL = new PaperInfoBLL();
|
RangeofBusinessBLL _rangeofBusinessBLL = new RangeofBusinessBLL();
|
#endregion
|
|
#region 属性
|
#endregion
|
|
#region 方法
|
private void BindPaperList()
|
{
|
IEnumerable<SysInquiry_PaperInfo> list = _paperInfoBLL.GetAllPaperList();
|
this.RepPaperList.DataSource = list;
|
this.RepPaperList.DataBind();
|
}
|
#endregion
|
|
#region 事件
|
/// <summary>
|
/// 初始化
|
/// </summary>
|
/// <param name="sender"></param>
|
/// <param name="e"></param>
|
protected void Page_Load(object sender, EventArgs e)
|
{
|
|
if (!IsPostBack)
|
{
|
BindPaperList();
|
}
|
string result = string.Empty;
|
if (Request["Init"] != null)
|
{
|
int printTypeId = int.Parse(Request["PrintTypeId"].ToString());
|
IList<SysInquiry_RangeofBusiness> list = _rangeofBusinessBLL.GetModelList(printTypeId);
|
string str = string.Empty;
|
string init = string.Empty;
|
if (list.Count > 0)
|
{
|
foreach (SysInquiry_RangeofBusiness model in list)
|
{
|
str += "{ PagerId:" + model.PagerId + ",GramWeights:'" + model.GramWeightRange + "'},";
|
}
|
init = "1";
|
}
|
else
|
{
|
init = "2";
|
IEnumerable<SysInquiry_PaperInfo> list1 = _paperInfoBLL.GetAllPaperList();
|
foreach (SysInquiry_PaperInfo model1 in list1)
|
{
|
str += "{ PagerId:" + model1.PapeId + ",GramWeights:'" + model1.GramWeights + "'},";
|
}
|
}
|
if (!string.IsNullOrEmpty(str))
|
{
|
str = str.Substring(0, str.Length - 1);
|
|
}
|
result = "{initObj:" + init + ",list:[" + str + "]}";
|
Response.Write(result);
|
Response.End();
|
}
|
if (Request["Save"] != null)
|
{
|
IList<SysInquiry_RangeofBusiness> list = new List<SysInquiry_RangeofBusiness>();
|
SysInquiry_RangeofBusiness model = null;
|
int printTypeId = int.Parse(Request["PrintTypeId"].ToString());
|
string modelList = Request["ModelList"].ToString();
|
string[] modelArry = modelList.Split(',');
|
foreach (string modelStr in modelArry)
|
{
|
string[] arry=modelStr.Split(':');
|
model = new SysInquiry_RangeofBusiness();
|
model.PrintingTypeId = printTypeId;
|
model.PagerId = arry[0].ToInt32();
|
model.GramWeightRange = arry[1];
|
model.PageSizeRange = string.Empty;
|
model.AfterParameterRange = string.Empty;
|
model.Operater = CurrentUser.ShortName;
|
model.OperateTime = DateTime.Now;
|
model.lastUpdateTime = DateTime.Now;
|
list.Add(model);
|
}
|
bool isSuccess = _rangeofBusinessBLL.SaveModelList(list,printTypeId);
|
if (isSuccess)
|
{
|
result = "保存成功";
|
}
|
else
|
{
|
result = "保存失败";
|
}
|
Response.Write(result);
|
Response.End();
|
}
|
}
|
#endregion
|
}
|
}
|