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 FastSetByFirm : BasePage
{
#region 变量
FastSetByFirmBLL _fastSetByFirmBLL = new FastSetByFirmBLL();
#endregion
#region 属性
#endregion
#region 方法
///
/// 初始化绑定页面
///
private void BindPage()
{
IList modelList = _fastSetByFirmBLL.GetModelList(InquiryConditionObj.FirmId, InquiryConditionObj.CustomerId);
Inquiry_FastSetByFirm tempObj = new Inquiry_FastSetByFirm();
tempObj.PrintTypeName = "全部类型";
tempObj.FastValue = 0;
tempObj.PrintTypeId = 0;
modelList.Insert(0, tempObj);
this.RepFastSetList.DataSource = modelList;
this.RepFastSetList.DataBind();
}
#endregion
#region 事件
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindPage();
}
}
///
/// 保存事件
///
///
///
protected void btnSave_Click(object sender, EventArgs e)
{
bool isSuccess = true;
IList modelList = new List();
Inquiry_FastSetByFirm model = null;
foreach (RepeaterItem item in this.RepFastSetList.Items)
{
if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
{
Label lblPrintTypeId = item.FindControl("lblPrintTypeId") as Label;
TextBox txtPrice = item.FindControl("txtPrice") as TextBox;
if (lblPrintTypeId.Text == "0")
{
continue;
}
model = new Inquiry_FastSetByFirm();
model.FirmId = InquiryConditionObj.FirmId;
model.CustomerId = InquiryConditionObj.CustomerId;
model.FastValue = txtPrice.Text.ToDecimal2().Value;
model.PrintTypeId = lblPrintTypeId.Text.ToInt32().Value;
modelList.Add(model);
}
}
isSuccess = _fastSetByFirmBLL.SaveModelList(modelList);
if (isSuccess)
{
JavaScript.MessageBox("保存成功", this);
}
else
{
JavaScript.MessageBox("保存失败", this);
}
}
#endregion
}
}