河北专项检查和移动端
This commit is contained in:
@@ -0,0 +1,327 @@
|
||||
using BLL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Linq;
|
||||
|
||||
namespace FineUIPro.Web.HJGL.MaterialManage
|
||||
{
|
||||
public partial class MaterialApply : PageBase
|
||||
{
|
||||
#region 加载
|
||||
/// <summary>
|
||||
/// 加载页面
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
this.ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
||||
Funs.DropDownPageSize(this.ddlPageSize);
|
||||
|
||||
// 绑定表格
|
||||
this.BindGrid();
|
||||
//this.btnNew.Hidden = true;
|
||||
//this.btnMenuEdit.Hidden = true;
|
||||
//this.btnMenuDelete.Hidden = true;
|
||||
//this.Grid1.EnableRowDoubleClickEvent = false;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绑定数据
|
||||
/// </summary>
|
||||
private void BindGrid()
|
||||
{
|
||||
string strSql = @"SELECT [ID]
|
||||
,[ProjectId]
|
||||
,[ApplyUnitId]
|
||||
,[ApplyDate]
|
||||
,[ApplyName]
|
||||
,[ApplyCode]
|
||||
,[ApplyDes]
|
||||
,[CreateMan]
|
||||
,[CreateDate]
|
||||
,[State]
|
||||
FROM [dbo].[HJGL_Material_Apply] where projectid='" + CurrUser.LoginProjectId+"'";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
|
||||
if (!string.IsNullOrEmpty(this.txtApplyName.Text.Trim()))
|
||||
{
|
||||
strSql += " AND ApplyName LIKE @txtApplyName";
|
||||
listStr.Add(new SqlParameter("@txtApplyName", "%" + this.txtApplyName.Text.Trim() + "%"));
|
||||
}
|
||||
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
|
||||
Grid1.RecordCount = tb.Rows.Count;
|
||||
//tb = GetFilteredTable(Grid1.FilteredData, tb);
|
||||
var table = this.GetPagedDataTable(Grid1, tb);
|
||||
Grid1.DataSource = table;
|
||||
Grid1.DataBind();
|
||||
}
|
||||
|
||||
/// <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)
|
||||
{
|
||||
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();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 关闭弹出窗口
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Window1_Close(object sender, EventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 增加按钮事件
|
||||
/// <summary>
|
||||
/// 增加按钮事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnNew_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (GetButtonPower(Const.BtnAdd))
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("MaterialApplyEdit.aspx", "新增 - ")));
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#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;
|
||||
}
|
||||
var app = BLL.HJGL.MaterialManage.HJGL_MaterialApplyService.getCurrMaterialApplyApprove(Grid1.SelectedRowID);
|
||||
var apply = BLL.HJGL.MaterialManage.HJGL_MaterialApplyService.getMaterialApply(Grid1.SelectedRowID);
|
||||
|
||||
if (app != null && app.ApproveMan == CurrUser.UserId)
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("MaterialApplyEdit.aspx?Id={0}", Grid1.SelectedRowID, "编辑 - ")));
|
||||
}
|
||||
else if (app == null&& apply.CreateMan == CurrUser.UserId)
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("MaterialApplyEdit.aspx?Id={0}", Grid1.SelectedRowID, "编辑 - ")));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 删除
|
||||
/// <summary>
|
||||
/// 右键删除事件
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnMenuDelete_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (GetButtonPower(Const.BtnDelete))
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length > 0)
|
||||
{
|
||||
string strShowNotify = string.Empty;
|
||||
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
||||
{
|
||||
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
||||
BLL.HJGL.MaterialManage.HJGL_MaterialApplyService.DeleteElectrodeRecovery(rowID);
|
||||
|
||||
}
|
||||
BindGrid();
|
||||
ShowNotify("删除成功!", MessageBoxIcon.Success);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
#region 查询
|
||||
/// <summary>
|
||||
/// 查询
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnQuery_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.BindGrid();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 查看
|
||||
/// <summary>
|
||||
/// 查看按钮
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnView_Click(object sender, EventArgs e)
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ConsumablesView.aspx?ConsumablesId={0}", Grid1.SelectedRowID, "查看 - ")));
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 格式化字符串
|
||||
/// <summary>
|
||||
/// 获取人员名称
|
||||
/// </summary>
|
||||
/// <param name="ConsumablesType"></param>
|
||||
/// <returns></returns>
|
||||
protected string ConvertUserName(object userid)
|
||||
{
|
||||
string name = string.Empty;
|
||||
if (userid != null)
|
||||
{
|
||||
var user = BLL.UserService.GetUserByUserId( userid.ToString());
|
||||
if (user != null)
|
||||
{
|
||||
name = user.UserName;
|
||||
}
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取人员名称
|
||||
/// </summary>
|
||||
/// <param name="ConsumablesType"></param>
|
||||
/// <returns></returns>
|
||||
protected string ConvertState(object state)
|
||||
{
|
||||
|
||||
if (state != null)
|
||||
{
|
||||
if (state.ToString() == BLL.Const.MaterialApply_ReCompile)
|
||||
{
|
||||
return "重新编制";
|
||||
}
|
||||
else if (state.ToString() == BLL.Const.MaterialApply_Compile)
|
||||
{
|
||||
return "编制";
|
||||
}
|
||||
else if (state.ToString() == BLL.Const.MaterialApply_Audit1)
|
||||
{
|
||||
return "总包负责人审批";
|
||||
}
|
||||
|
||||
else if (state.ToString() == BLL.Const.MaterialApply_Complete)
|
||||
{
|
||||
return "审批完成";
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
/// <summary>
|
||||
/// 获取单位名称
|
||||
/// </summary>
|
||||
/// <param name="SteelType"></param>
|
||||
/// <returns></returns>
|
||||
protected string ConvertUnitName(object unitId)
|
||||
{
|
||||
string name = string.Empty;
|
||||
if (unitId != null)
|
||||
{
|
||||
var unit = BLL.UnitService.GetUnitByUnitId(unitId.ToString());
|
||||
if (unit != null)
|
||||
{
|
||||
name = unit.UnitName;
|
||||
}
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 获取按钮权限
|
||||
/// <summary>
|
||||
/// 获取按钮权限
|
||||
/// </summary>
|
||||
/// <param name="button"></param>
|
||||
/// <returns></returns>
|
||||
private bool GetButtonPower(string button)
|
||||
{
|
||||
return BLL.CommonService.GetAllButtonPowerList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.HJGL_MaterialApplyMenuId, button);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user