SGGL_SHJ/SGGL/FineUIPro.Web/PHTGL/BillOfQuantities/TemQuantitySelect.aspx.cs

66 lines
2.2 KiB
C#

using BLL;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace FineUIPro.Web.PHTGL.BillOfQuantities
{
public partial class TemQuantitySelect : PageBase
{
public string MainProjectQuantityId
{
get => (string)ViewState["MainProjectQuantityId"];
set => ViewState["MainProjectQuantityId"] = value;
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.btnClose.OnClientClick = ActiveWindow.GetHidePostBackReference();
MainProjectQuantityId = Request.Params["MainProjectQuantityId"];
// 绑定表格
BindGrid();
}
}
private void BindGrid()
{
var table = new PHTGL_Quantity();
table.Major = txtMajor.Text.Trim() ?? "";
table.SubProject = txtSubProject.Text.Trim() ?? "";
table.SubItemProject = txtSubItemProject.Text.Trim() ?? "";
table.ProjectCode = txtProjectCode.Text.Trim() ?? "";
table.ProjectName = txtProjectName.Text.Trim() ?? "";
table.IsTemplate = true;
var tb = PHTGL_QuantityService.GetPHTGL_QuantityByModle(table);
Grid1.RecordCount = PHTGL_QuantityService.count;
//tb = GetFilteredTable(Grid1.FilteredData, tb);
Grid1.DataSource = tb;
Grid1.DataBind();
}
protected void btnSave_Click(object sender, EventArgs e)
{
var CheckIdList = Grid1.SelectedRowIDArray;
if (CheckIdList.Length>0)
{
foreach (var item in CheckIdList)
{
var model = BLL.PHTGL_QuantityService.GetPHTGL_QuantityById(item);
PHTGL_QuantityService.AddPHTGL_QuantityByTemModel(model, MainProjectQuantityId);
}
ShowNotify("保存成功",MessageBoxIcon.Success);
}
}
protected void btnSearch_Click(object sender, EventArgs e)
{
BindGrid();
}
}
}