11
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
|
||||
|
||||
@@ -18,40 +21,12 @@ namespace FineUIPro.Web.JDGL.SGManPower
|
||||
set { ViewState["ProjectId"] = value; }
|
||||
}
|
||||
|
||||
public string UnitId
|
||||
public string WarningType
|
||||
{
|
||||
get => (string)ViewState["UnitId"];
|
||||
set => ViewState["UnitId"] = value;
|
||||
get => (string)ViewState["WarningType"];
|
||||
set => ViewState["WarningType"] = value;
|
||||
}
|
||||
|
||||
public string UnitWorkId
|
||||
{
|
||||
get => (string)ViewState["UnitWorkId"];
|
||||
set => ViewState["UnitWorkId"] = value;
|
||||
}
|
||||
|
||||
public string WorkPostId
|
||||
{
|
||||
get => (string)ViewState["WorkPostId"];
|
||||
set => ViewState["WorkPostId"] = value;
|
||||
}
|
||||
public string PlanDate
|
||||
{
|
||||
get => (string)ViewState["PlanDate"];
|
||||
set => ViewState["PlanDate"] = value;
|
||||
}
|
||||
|
||||
public string Quantity
|
||||
{
|
||||
get => (string)ViewState["Quantity"];
|
||||
set => ViewState["Quantity"] = value;
|
||||
}
|
||||
|
||||
public string Num
|
||||
{
|
||||
get => (string)ViewState["Num"];
|
||||
set => ViewState["Num"] = value;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -59,65 +34,170 @@ namespace FineUIPro.Web.JDGL.SGManPower
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
this.btnClose.OnClientClick = ActiveWindow.GetHideReference();
|
||||
Funs.DropDownPageSize(this.ddlPageSize);
|
||||
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
||||
this.ProjectId = Request.Params["projectId"];
|
||||
this.UnitId = Request.Params["unitId"];
|
||||
this.UnitWorkId = Request.Params["unitWorkId"];
|
||||
this.WorkPostId = Request.Params["workPostId"];
|
||||
this.PlanDate = Request.Params["planDate"];
|
||||
this.Quantity = Request.Params["quantity"];
|
||||
this.Num = Request.Params["num"];
|
||||
if (!string.IsNullOrEmpty(ProjectId))
|
||||
{
|
||||
var project = BLL.ProjectService.GetProjectByProjectId(ProjectId); //项目
|
||||
if (project != null)
|
||||
{
|
||||
this.lProject.Text = project.ProjectName;
|
||||
}
|
||||
}
|
||||
this.WarningType = Request.Params["warningType"];
|
||||
// 绑定表格
|
||||
BindGrid();
|
||||
|
||||
if (!string.IsNullOrEmpty(UnitId))
|
||||
{
|
||||
var unit = BLL.UnitService.GetUnitByUnitId(UnitId); //单位
|
||||
if (unit != null)
|
||||
{
|
||||
this.lUnit.Text = unit.UnitName;
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(UnitWorkId))
|
||||
{
|
||||
var unitWork = BLL.UnitWorkService.GetUnitWorkByUnitWorkId(UnitWorkId); //单位工程(装置)
|
||||
if (unitWork != null)
|
||||
{
|
||||
this.lUnitWork.Text = unitWork.UnitWorkName;
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(WorkPostId))
|
||||
{
|
||||
var workPost = BLL.WorkPostService.GetWorkPostById(WorkPostId); //岗位
|
||||
if (workPost != null)
|
||||
{
|
||||
this.lWorkPost.Text = workPost.WorkPostName;
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(PlanDate))
|
||||
{
|
||||
this.lPlanDate.Text = PlanDate;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(Quantity))
|
||||
{
|
||||
this.lQuantity.Text = Quantity;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(Num))
|
||||
{
|
||||
this.lNumber.Text = Num;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void BindGrid()
|
||||
{
|
||||
string strSql =
|
||||
@"SELECT * from SGManPower_WarningResult where 1=1 ";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
|
||||
if (!string.IsNullOrEmpty(this.ProjectId))
|
||||
{
|
||||
strSql += " AND ProjectId = @ProjectId ";
|
||||
listStr.Add(new SqlParameter("@ProjectId", this.ProjectId));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(this.WarningType))
|
||||
{
|
||||
strSql += " AND WarningType = @WarningType ";
|
||||
listStr.Add(new SqlParameter("@WarningType", this.WarningType));
|
||||
}
|
||||
|
||||
strSql += " ORDER BY UnitId";
|
||||
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
Grid1.RecordCount = tb.Rows.Count;
|
||||
var table = this.GetPagedDataTable(Grid1, tb);
|
||||
Grid1.DataSource = table;
|
||||
Grid1.DataBind();
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 右键编辑事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnMenuView_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.EditData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 编辑数据方法
|
||||
/// </summary>
|
||||
private void EditData()
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||||
{
|
||||
Alert.ShowInTop("请选择一条记录!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
var result = Funs.DB.SGManPower_WarningResult.FirstOrDefault(x => x.WarningId == Grid1.SelectedRowID);
|
||||
|
||||
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("SGWarningDetailsEdit.aspx?projectId={0}&unitId={1}&unitWorkId={2}&workPostId={3}&startTime={4}&endTime={5}", result.ProjectId, result.UnitId, result.UnitWorkId, result.WorkPostId, result.StartDate, result.EndDate, "编辑 - ")));
|
||||
}
|
||||
|
||||
#region 分页、关闭窗口
|
||||
|
||||
/// <summary>
|
||||
/// 分页
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
||||
{
|
||||
Grid1.PageIndex = e.NewPageIndex;
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 排序
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region 格式化字符串
|
||||
|
||||
/// <summary>
|
||||
/// 格式化受伤情况
|
||||
/// </summary>
|
||||
/// <param name="injury"></param>
|
||||
/// <returns></returns>
|
||||
protected string ConvertWorkPostName(object workPostId)
|
||||
{
|
||||
string name = string.Empty;
|
||||
if (workPostId != null)
|
||||
{
|
||||
name = BLL.WorkPostService.getWorkPostNameById(workPostId.ToString());
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
protected string ConvertUnitName(object unitId)
|
||||
{
|
||||
string name = string.Empty;
|
||||
if (unitId != null)
|
||||
{
|
||||
name = UnitService.GetUnitNameByUnitId(unitId);
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 格式装置
|
||||
/// </summary>
|
||||
/// <param name="injury"></param>
|
||||
/// <returns></returns>
|
||||
protected string ConvertUnitWorkName(object unitWorkId)
|
||||
{
|
||||
string name = string.Empty;
|
||||
if (unitWorkId != null)
|
||||
{
|
||||
name = BLL.UnitWorkService.GetNameById(unitWorkId.ToString());
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
// 在页面中添加格式化方法
|
||||
protected string ConvertBiasPercent(object biasValue)
|
||||
{
|
||||
if (biasValue != null && decimal.TryParse(biasValue.ToString(), out decimal value))
|
||||
{
|
||||
return (value * 100).ToString("F2") + "%";
|
||||
}
|
||||
return "0.00%";
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user