2022-09-05 16:36:31 +08:00
|
|
|
|
using BLL;
|
|
|
|
|
|
using System;
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using System.Text;
|
2023-11-15 16:11:07 +08:00
|
|
|
|
using System.Web;
|
2022-09-05 16:36:31 +08:00
|
|
|
|
using AspNet = System.Web.UI.WebControls;
|
|
|
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.HSSE.OccupationHealth
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class PhysicalExamination : 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.GetButtonPower();
|
|
|
|
|
|
|
|
|
|
|
|
// 绑定表格
|
|
|
|
|
|
this.BindGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region GV绑定数据
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 绑定数据
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private void BindGrid()
|
|
|
|
|
|
{
|
2023-11-15 16:11:07 +08:00
|
|
|
|
var getData = PhysicalExaminationService.getListData(this.CurrUser.LoginProjectId, this.txtPersonName.Text.Trim(), Grid1);
|
|
|
|
|
|
Grid1.RecordCount = PhysicalExaminationService.count;
|
|
|
|
|
|
Grid1.DataSource = getData;
|
2022-09-05 16:36:31 +08:00
|
|
|
|
Grid1.DataBind();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#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 ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.Grid1.PageSize = Convert.ToInt32(this.ddlPageSize.SelectedValue);
|
|
|
|
|
|
BindGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 排序
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.BindGrid();
|
|
|
|
|
|
}
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
#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_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.EditData();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 右键编辑事件
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
|
protected void btnMenuEdit_Click(object sender, EventArgs e)
|
|
|
|
|
|
{
|
|
|
|
|
|
this.EditData();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 编辑数据方法
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
private void EditData()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
|
|
|
|
{
|
|
|
|
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
string id = Grid1.SelectedRowID;
|
2023-11-15 16:11:07 +08:00
|
|
|
|
if (!this.btnMenuEdit.Hidden) ////双击事件 编辑权限有:编辑页面,无:查看页面 或者状态是完成时查看页面
|
2022-09-05 16:36:31 +08:00
|
|
|
|
{
|
2023-11-15 16:11:07 +08:00
|
|
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("PhysicalExaminationEdit.aspx?SitePersonId={0}", id, "编辑 - ")));
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-11-15 16:11:07 +08:00
|
|
|
|
#endregion
|
2022-09-05 16:36:31 +08:00
|
|
|
|
|
|
|
|
|
|
#region 获取按钮权限
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取按钮权限
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="button"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
private void GetButtonPower()
|
|
|
|
|
|
{
|
|
|
|
|
|
if (Request.Params["value"] == "0")
|
|
|
|
|
|
{
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
string menuId = BLL.Const.ServerPhysicalExaminationMenuId;
|
|
|
|
|
|
if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
|
|
|
|
|
|
{
|
|
|
|
|
|
menuId = BLL.Const.PhysicalExaminationMenuId;
|
|
|
|
|
|
}
|
|
|
|
|
|
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.PersonId, menuId);
|
|
|
|
|
|
if (buttonList.Count() > 0)
|
2025-10-10 14:33:21 +08:00
|
|
|
|
{
|
2022-09-05 16:36:31 +08:00
|
|
|
|
if (buttonList.Contains(BLL.Const.BtnModify))
|
|
|
|
|
|
{
|
|
|
|
|
|
this.btnMenuEdit.Hidden = false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
this.drpProject.Hidden = false;
|
|
|
|
|
|
BLL.ProjectService.InitAllProjectDropDownList(this.drpProject, true);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
#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 = 500;
|
|
|
|
|
|
this.BindGrid();
|
|
|
|
|
|
Response.Write(GetGridTableHtml(Grid1));
|
|
|
|
|
|
Response.End();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#pragma warning disable CS0108 // “PhysicalExamination.GetGridTableHtml(Grid)”隐藏继承的成员“PageBase.GetGridTableHtml(Grid)”。如果是有意隐藏,请使用关键字 new。
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 导出方法
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="grid"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
private string GetGridTableHtml(Grid grid)
|
|
|
|
|
|
#pragma warning restore CS0108 // “PhysicalExamination.GetGridTableHtml(Grid)”隐藏继承的成员“PageBase.GetGridTableHtml(Grid)”。如果是有意隐藏,请使用关键字 new。
|
|
|
|
|
|
{
|
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
|
sb.Append("<meta http-equiv=\"content-type\" content=\"application/excel; charset=UTF-8\"/>");
|
|
|
|
|
|
sb.Append("<table cellspacing=\"0\" rules=\"all\" border=\"1\" style=\"border-collapse:collapse;\">");
|
|
|
|
|
|
sb.Append("<tr>");
|
|
|
|
|
|
foreach (GridColumn column in grid.Columns)
|
|
|
|
|
|
{
|
|
|
|
|
|
sb.AppendFormat("<td>{0}</td>", column.HeaderText);
|
|
|
|
|
|
}
|
|
|
|
|
|
sb.Append("</tr>");
|
|
|
|
|
|
foreach (GridRow row in grid.Rows)
|
|
|
|
|
|
{
|
|
|
|
|
|
sb.Append("<tr>");
|
|
|
|
|
|
foreach (GridColumn column in grid.Columns)
|
|
|
|
|
|
{
|
|
|
|
|
|
string html = row.Values[column.ColumnIndex].ToString();
|
|
|
|
|
|
if (column.ColumnID == "tfNumber")
|
|
|
|
|
|
{
|
|
|
|
|
|
html = (row.FindControl("lblNumber") as AspNet.Label).Text;
|
|
|
|
|
|
}
|
|
|
|
|
|
sb.AppendFormat("<td>{0}</td>", html);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sb.Append("</tr>");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sb.Append("</table>");
|
|
|
|
|
|
|
|
|
|
|
|
return sb.ToString();
|
|
|
|
|
|
}
|
2023-11-15 16:11:07 +08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// 获取整改前图片(放于Img中)
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
/// <param name="registrationId"></param>
|
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
|
protected string ConvertImageUrlByImage(object personId)
|
|
|
|
|
|
{
|
|
|
|
|
|
string url = string.Empty;
|
|
|
|
|
|
if (personId != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
var attach = BLL.AttachFileService.GetAttachFile(personId.ToString() + "#3", BLL.Const.PersonListMenuId);
|
|
|
|
|
|
if (attach != null)
|
|
|
|
|
|
{
|
|
|
|
|
|
url = HttpUtility.HtmlDecode(BLL.UploadAttachmentService.ShowImage("../../", attach.AttachUrl));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return url;
|
|
|
|
|
|
}
|
2022-09-05 16:36:31 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|