2025-04-10 19:04:56 +08:00
|
|
|
|
using BLL;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Data.SqlClient;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.DataShow
|
|
|
|
|
{
|
|
|
|
|
public partial class JDMonthDetail : PageBase
|
|
|
|
|
{
|
|
|
|
|
#region 项目主键
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 项目主键
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string ProjectId
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return (string)ViewState["ProjectId"];
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
ViewState["ProjectId"] = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public string Month
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return (string)ViewState["Month"];
|
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
ViewState["Month"] = value;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!IsPostBack)
|
|
|
|
|
{
|
|
|
|
|
this.ProjectId = this.CurrUser.LoginProjectId;
|
|
|
|
|
if (!string.IsNullOrEmpty(Request.Params["projectId"]) && Request.Params["projectId"] != this.CurrUser.LoginProjectId)
|
|
|
|
|
{
|
|
|
|
|
this.ProjectId = Request.Params["projectId"];
|
|
|
|
|
}
|
|
|
|
|
if (!string.IsNullOrEmpty(Request.Params["month"]))
|
|
|
|
|
{
|
|
|
|
|
this.Month = Request.Params["month"];
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
//统计月份信息
|
|
|
|
|
DateTime months = Convert.ToDateTime(DateTime.Now.Year.ToString() + "-" + DateTime.Now.Month.ToString() + "-01");
|
|
|
|
|
if (DateTime.Now.Day < 26)
|
|
|
|
|
{
|
|
|
|
|
months = Convert.ToDateTime(DateTime.Now.Year.ToString() + "-" + DateTime.Now.AddMonths(-1).Month.ToString() + "-01");
|
|
|
|
|
}
|
|
|
|
|
this.Month = months.ToString("yyyy-MM-dd");
|
|
|
|
|
}
|
2025-04-18 16:59:01 +08:00
|
|
|
|
this.txtMonths.Text = this.Month.Replace("-01", "");
|
2025-04-10 19:04:56 +08:00
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-18 16:59:01 +08:00
|
|
|
|
#region 月份选择事件
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 月份选择事件
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void txtMonths_TextChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.Month = string.Format("{0:yyyy-MM-dd}", Convert.ToDateTime(this.txtMonths.Text.Trim() + "-01"));
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
2025-04-10 19:04:56 +08:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 加载Grid
|
|
|
|
|
/// </summary>
|
|
|
|
|
private void BindGrid()
|
|
|
|
|
{
|
|
|
|
|
DataTable tb = BindData();
|
|
|
|
|
Grid1.RecordCount = tb.Rows.Count;
|
|
|
|
|
//tb = GetFilteredTable(Grid1.FilteredData, tb);
|
|
|
|
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|
|
|
|
Grid1.DataSource = table;
|
|
|
|
|
Grid1.DataBind();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 加载数据
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private DataTable BindData()
|
|
|
|
|
{
|
|
|
|
|
string strSql = @"select mp.*,u.UnitName
|
|
|
|
|
,DutyPersonName = STUFF((SELECT ',' + p.UserName FROM dbo.Sys_User as p where PATINDEX('%,' + RTRIM(p.UserId) + ',%', ',' + mp.DutyPerson + ',') > 0 FOR XML PATH('')), 1, 1,'')
|
|
|
|
|
from [dbo].[JDGL_MonthPlan] mp
|
|
|
|
|
left join Base_Unit u on u.UnitId=mp.UnitId
|
|
|
|
|
where mp.ProjectId=@ProjectId and mp.Months=@month order by mp.SortIndex";
|
|
|
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
|
|
|
listStr.Add(new SqlParameter("@ProjectId", this.ProjectId));
|
|
|
|
|
listStr.Add(new SqlParameter("@month", this.Month));
|
|
|
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
|
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
|
|
|
return tb;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 查询
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void TextBox2_TextChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.BindGrid();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#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();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|