SGGL_JT/SUBQHSE/FineUIPro.Web/Customization/CNCCG/HSSE/InApproveManager/EquipmentManage.aspx.cs

196 lines
6.0 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using BLL;
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using AspNet = System.Web.UI.WebControls;
namespace FineUIPro.Web.Customization.CNCCG.HSSE.InApproveManager
{
public partial class EquipmentManage : PageBase
{
#region
/// <summary>
/// 项目主键
/// </summary>
public string ProjectId
{
get
{
return (string)ViewState["ProjectId"];
}
set
{
ViewState["ProjectId"] = value;
}
}
#endregion
#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);
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
this.Panel1.Title = "设备管理(" + BLL.UnitService.GetUnitNameByUnitId(BLL.CommonService.GetThisUnitId()) + "";
this.ProjectId = this.CurrUser.LoginProjectId;
if (!string.IsNullOrEmpty(Request.Params["projectId"]) && Request.Params["projectId"] != this.CurrUser.LoginProjectId)
{
this.ProjectId = Request.Params["projectId"];
}
this.ucTree.UnitId = this.CurrUser.UnitId;
this.ucTree.ProjectId = this.ProjectId;
if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
{
this.panelLeftRegion.Hidden = true;
//////权限按钮方法
//this.GetButtonPower();
}
// 绑定表格t
BindGrid();
}
}
protected void changeTree(object sender, EventArgs e)
{
this.ProjectId = this.ucTree.ProjectId;
this.BindGrid();
//this.GetButtonPower();
//if (string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
//{
// btnNew.Hidden = true;
//}
}
private void BindGrid()
{
if (string.IsNullOrEmpty(this.ProjectId))
{
return;
}
if (this.rbCom.SelectedValue == "0")
{//一般设备
var model = GeneralEquipmentInItemService.GetGeneralEquipmentIn();
Grid1.RecordCount = model.Count;
Grid1.DataSource = this.GetPagedDataTable(Grid1, Funs.LINQToDataTable(model));
Grid1.DataBind();
}
else if (this.rbCom.SelectedValue == "1")
{//特种设备
var model = GeneralEquipmentInItemService.GetEquipmentIn();
Grid1.RecordCount = model.Count;
Grid1.DataSource = this.GetPagedDataTable(Grid1, Funs.LINQToDataTable(model));
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();
}
/// <summary>
/// 关闭弹出窗
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window1_Close(object sender, WindowCloseEventArgs e)
{
BindGrid();
}
#endregion
#region Grid双击事件
/// <summary>
/// Grid行双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
EditData();
}
/// <summary>
///
/// </summary>
private void EditData()
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
return;
}
if (this.rbCom.SelectedValue == "0")
{
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("GeneralEquipmentInView.aspx?GeneralEquipmentInItemId={0}", Grid1.SelectedRowID, "查看 - ")));
}
else if (this.rbCom.SelectedValue == "1")
{
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("EquipmentInView.aspx?EquipmentInItemId={0}", Grid1.SelectedRowID, "查看 - ")));
}
}
#endregion
/// <summary>
///
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnView_Click(object sender, EventArgs e)
{
EditData();
}
}
}