115 lines
3.6 KiB
C#
115 lines
3.6 KiB
C#
using BLL;
|
|
using System;
|
|
using System.Data;
|
|
using System.Linq;
|
|
|
|
namespace FineUIPro.Web.DataShow
|
|
{
|
|
public partial class HJGLWeldingItem : PageBase
|
|
{
|
|
|
|
#region 加载页面
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
string projectId = Request.Params["projectId"];
|
|
this.txtProject.Text = ProjectService.GetProjectNameByProjectId(projectId);
|
|
Funs.DropDownPageSize(this.ddlPageSize);
|
|
btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
|
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
|
// 绑定表格
|
|
BindGrid();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 绑定数据
|
|
/// </summary>
|
|
private void BindGrid()
|
|
{
|
|
var datetime1 = Funs.GetNewDateTime(this.txtStartTime.Text);
|
|
var datetime2 = Funs.GetNewDateTime(this.txtStartTime.Text);
|
|
var View_HJGL_WeldJoint = from x in Funs.DB.View_HJGL_WeldJoint where x.ProjectId == Request.Params["projectId"] select x;
|
|
if (datetime1.HasValue)
|
|
{
|
|
View_HJGL_WeldJoint = View_HJGL_WeldJoint.Where(x => x.WeldingDateD >= datetime1.Value);
|
|
}
|
|
if (datetime2.HasValue)
|
|
{
|
|
View_HJGL_WeldJoint = View_HJGL_WeldJoint.Where(x => x.WeldingDateD <= datetime2.Value);
|
|
}
|
|
|
|
Grid1.RecordCount = View_HJGL_WeldJoint.Count();
|
|
// var table = this.GetPagedDataTable(Grid1, list);
|
|
var table = View_HJGL_WeldJoint.Skip(Grid1.PageSize * (Grid1.PageIndex)).Take(Grid1.PageSize).ToList();
|
|
Grid1.DataSource = table;
|
|
Grid1.DataBind();
|
|
}
|
|
#endregion
|
|
|
|
#region 查询
|
|
/// <summary>
|
|
/// 查询
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void TextBox_TextChanged(object sender, EventArgs e)
|
|
{
|
|
this.BindGrid();
|
|
}
|
|
#endregion
|
|
|
|
#region 表排序、分页、关闭窗口
|
|
/// <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 Grid1_Sort(object sender, GridSortEventArgs 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();
|
|
}
|
|
#endregion
|
|
|
|
/// <summary>
|
|
/// 转换当日人工时
|
|
/// </summary>
|
|
/// <param name="workStage"></param>
|
|
/// <returns></returns>
|
|
protected string ConvertPersonWorkTimeSum(object dayReportId)
|
|
{
|
|
if (dayReportId != null)
|
|
{
|
|
return (Funs.DB.SitePerson_DayReportDetail.Where(x => x.DayReportId == dayReportId.ToString()).Sum(x => x.PersonWorkTime) ?? 0).ToString();
|
|
}
|
|
return "";
|
|
}
|
|
}
|
|
} |