first commit
This commit is contained in:
@@ -0,0 +1,242 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web.UI.WebControls;
|
||||
using System.Data;
|
||||
using BLL;
|
||||
using System.Data.SqlClient;
|
||||
|
||||
namespace FineUIPro.Web.CQMS.WBS
|
||||
{
|
||||
public partial class ProjectControlPointAuditRecord : PageBase
|
||||
{
|
||||
public bool Editable
|
||||
{
|
||||
get
|
||||
{
|
||||
return (bool)ViewState["Editable"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["Editable"] = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#region 页面加载
|
||||
/// <summary>
|
||||
/// 页面加载
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
Editable = false;
|
||||
|
||||
GetButtonPower();
|
||||
BindGrid();
|
||||
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 修改关闭窗口
|
||||
/// <summary>
|
||||
/// 关闭窗口
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 删除
|
||||
/// <summary>
|
||||
/// 删除
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnMenuDel_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||||
{
|
||||
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
BLL.BreakdownProjectAuditRecordService.DeleteBreakdown(Grid1.SelectedRowID);
|
||||
Grid1.DataBind();
|
||||
BindGrid();
|
||||
Alert.ShowInTop("删除数据成功!", MessageBoxIcon.Success);
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region 绑定数据
|
||||
/// <summary>
|
||||
/// 绑定数据
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Grid1_FilterChange(object sender, EventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
||||
{
|
||||
Grid1.PageIndex = e.NewPageIndex;
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Grid1排序
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Grid1_Sort(object sender, GridSortEventArgs e)
|
||||
{
|
||||
Grid1.SortDirection = e.SortDirection;
|
||||
Grid1.SortField = e.SortField;
|
||||
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>
|
||||
/// 加载Grid
|
||||
/// </summary>
|
||||
private void BindGrid()
|
||||
{
|
||||
string strSql = @"SELECT AuditId
|
||||
,WBS_BreakdownProjectAuditRecord.ProjectId
|
||||
,AuditCode
|
||||
,AuditDate
|
||||
,AuditName
|
||||
,Auditer
|
||||
,Sys_User.UserName
|
||||
,Remark
|
||||
,Creater
|
||||
,CreateDate
|
||||
FROM dbo.WBS_BreakdownProjectAuditRecord left join Sys_User on Auditer = UserId ";
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
strSql += " where WBS_BreakdownProjectAuditRecord.ProjectId=@ProjectId";
|
||||
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
|
||||
if (!string.IsNullOrEmpty(txtAuditCode.Text))
|
||||
{
|
||||
strSql += " and AuditCode like '%" + txtAuditCode.Text + "%'";
|
||||
}
|
||||
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();
|
||||
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
|
||||
#region 行点击事件
|
||||
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
|
||||
{
|
||||
string id = e.RowID;
|
||||
if (e.CommandName.Equals("download"))
|
||||
{
|
||||
string menuId = Const.ProjectControlPointAuditMenuId;
|
||||
PageContext.RegisterStartupScript(Windowtt.GetShowReference(
|
||||
String.Format("../../AttachFile/webuploader.aspx?type={0}&source=1&toKeyId={1}&path=FileUpload/BreakdownProject&menuId={2}",Editable?"1":"0", id, menuId)));
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// 增加
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnNew_Click(object sender, EventArgs e)
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference("ProjectControlPointAuditRecordEdit.aspx", "新增 - "));
|
||||
|
||||
}
|
||||
protected void btnMenuEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||||
{
|
||||
Alert.ShowInTop("请至少选择一条记录", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ProjectControlPointAuditRecordEdit.aspx?AuditId={0}", this.Grid1.SelectedRowID, "新增 - ")));
|
||||
|
||||
}
|
||||
#region 获取按钮权限
|
||||
/// <summary>
|
||||
/// 获取按钮权限
|
||||
/// </summary>
|
||||
/// <param name="button"></param>
|
||||
/// <returns></returns>
|
||||
private void GetButtonPower()
|
||||
{
|
||||
if (Request.Params["value"] == "0")
|
||||
{
|
||||
return;
|
||||
}
|
||||
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.ProjectControlPointAuditMenuId);
|
||||
if (buttonList.Count() > 0)
|
||||
{
|
||||
if (buttonList.Contains(BLL.Const.BtnAdd))
|
||||
{
|
||||
this.btnNew.Hidden = false;
|
||||
Editable = true;
|
||||
}
|
||||
if (buttonList.Contains(BLL.Const.BtnModify))
|
||||
{
|
||||
this.Grid1.EnableRowDoubleClickEvent = true;
|
||||
this.btnMenuEdit.Hidden = false;
|
||||
Editable = true;
|
||||
|
||||
}
|
||||
|
||||
if (buttonList.Contains(BLL.Const.BtnDelete))
|
||||
{
|
||||
this.btnMenuDelete.Hidden = false;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region 查询
|
||||
/// <summary>
|
||||
/// 查询
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnSearch_Click(object sender, EventArgs e)
|
||||
{
|
||||
BindGrid();
|
||||
}
|
||||
#endregion
|
||||
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
||||
{
|
||||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ProjectControlPointAuditRecordEdit.aspx?AuditId={0}", e.RowID, "新增 - ")));
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user