集团主数据
This commit is contained in:
@@ -0,0 +1,147 @@
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
|
||||
namespace FineUIPro.Web.ProjectData
|
||||
{
|
||||
public partial class MasterProjectData : PageBase
|
||||
{
|
||||
#region 加载
|
||||
/// <summary>
|
||||
/// 加载页面
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
Funs.DropDownPageSize(this.ddlPageSize);
|
||||
this.ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
||||
// 绑定表格
|
||||
this.BindGrid();
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 绑定数据
|
||||
/// <summary>
|
||||
/// 绑定数据
|
||||
/// </summary>
|
||||
private void BindGrid()
|
||||
{
|
||||
var db = Funs.DB;
|
||||
var masterProDatas = ProjectService.GetMasterProjectDataInfos();
|
||||
var query = from x in masterProDatas
|
||||
join pro in db.Base_Project on x.Pro_id equals pro.MasterSysId into proGroup
|
||||
from pro in proGroup.DefaultIfEmpty()
|
||||
select new
|
||||
{
|
||||
Pid= x.Pro_id+(pro != null ? $"-{pro.ProjectId}":""),
|
||||
x.Pro_id,
|
||||
x.Pro_name,
|
||||
x.Pro_code,
|
||||
x.Start_date,
|
||||
x.Pro_status,
|
||||
ProjectName = pro != null ? pro.ProjectName : "",
|
||||
ProjectCode = pro != null ? pro.ProjectCode : "",
|
||||
StartDate = pro != null ? pro.StartDate : null,
|
||||
ProjectState = pro != null ? pro.ProjectState : "",
|
||||
relate = pro != null && pro.MasterSysId != null ? "已关联" : ""
|
||||
};
|
||||
|
||||
string proName = this.txtProjectName.Text.Trim();
|
||||
string proCode = this.txtProjectCode.Text.Trim();
|
||||
if (!string.IsNullOrEmpty(proName))
|
||||
{
|
||||
query = query.Where(x => x.Pro_name.Contains(proName));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(proCode))
|
||||
{
|
||||
query = query.Where(x => x.Pro_code.Contains(proCode));
|
||||
}
|
||||
DataTable tb = Funs.LINQToDataTable(query);
|
||||
Grid1.RecordCount = tb.Rows.Count;
|
||||
Grid1.DataSource = this.GetPagedDataTable(Grid1, tb);
|
||||
Grid1.DataBind();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 项目状态
|
||||
/// </summary>
|
||||
/// <param name="addType"></param>
|
||||
/// <returns></returns>
|
||||
protected string ConvertProjectState(object state)
|
||||
{
|
||||
string result = string.Empty;
|
||||
string stateStr = state.ToString();
|
||||
if (state != null && !string.IsNullOrWhiteSpace(stateStr))
|
||||
{
|
||||
result = stateStr == "2" ? "暂停中" : stateStr == "3" ? "已完工" : "施工中";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Grid
|
||||
|
||||
protected void TextBox_TextChanged(object sender, EventArgs e)
|
||||
{
|
||||
this.BindGrid();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
||||
{
|
||||
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
#region 导出按钮
|
||||
/// 导出按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnOut_Click(object sender, EventArgs e)
|
||||
{
|
||||
Response.ClearContent();
|
||||
string filename = Funs.GetNewFileName();
|
||||
Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("集团主数据在建项目使用情况" + filename, System.Text.Encoding.UTF8) + ".xls");
|
||||
Response.ContentType = "application/excel";
|
||||
Response.ContentEncoding = System.Text.Encoding.UTF8;
|
||||
this.Grid1.PageSize = this.Grid1.RecordCount;
|
||||
this.BindGrid();
|
||||
Response.Write(GetGridMultiHeaderTableHtml(Grid1));
|
||||
//Response.Write(GetGridTableHtml(Grid1));
|
||||
Response.End();
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user