287 lines
9.4 KiB
C#
287 lines
9.4 KiB
C#
using Aspose.Words.Lists;
|
|
using BLL;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using System.Linq;
|
|
|
|
namespace FineUIPro.Web.ProjectData
|
|
{
|
|
public partial class PreProjectApplyList : PageBase
|
|
{
|
|
|
|
#region 加载
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
////权限按钮方法
|
|
//this.GetButtonPower();
|
|
|
|
this.btnApply.Hidden = false;
|
|
this.btnMenuEdit.Hidden = false;
|
|
this.btnMenuDelete.Hidden = false;
|
|
|
|
Funs.DropDownPageSize(this.ddlPageSize);
|
|
// 绑定表格
|
|
this.BindGrid();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 项目预立项申请
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnApply_Click(object sender, EventArgs e)
|
|
{
|
|
string projectName = this.txtProjectName.Text.Trim();
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PreProjectApply.aspx?ProjectName={0}", projectName, "项目预立项申请")));
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 绑定数据
|
|
|
|
/// <summary>
|
|
/// 查询
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSearch_Click(object sender, EventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 绑定数据
|
|
/// </summary>
|
|
private void BindGrid()
|
|
{
|
|
string strSql = @"SELECT (CASE State WHEN 1 THEN '通过' WHEN 2 THEN '不通过' ELSE '待审核' END) AS StateStr,* FROM DataGovernance_PreProjectApply WHERE 1=1 ";
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
string unitName = this.txtUnitName.Text.Trim();
|
|
string projectName = this.txtProjectName.Text.Trim();
|
|
if (!string.IsNullOrEmpty(unitName))
|
|
{
|
|
strSql += " AND UnitName LIKE @UnitName";
|
|
listStr.Add(new SqlParameter("@UnitName", "%" + unitName + "%"));
|
|
}
|
|
if (!string.IsNullOrEmpty(projectName))
|
|
{
|
|
strSql += " AND ProjectName LIKE @ProjectName";
|
|
listStr.Add(new SqlParameter("@ProjectName", "%" + projectName + "%"));
|
|
}
|
|
int state = int.Parse(this.rblState.SelectedValue);
|
|
if (state >= 0)
|
|
{
|
|
strSql += " AND State = @State";
|
|
listStr.Add(new SqlParameter("@State", state));
|
|
}
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
Grid1.RecordCount = tb.Rows.Count;
|
|
Grid1.DataSource = this.GetPagedDataTable(Grid1, tb);
|
|
Grid1.DataBind();
|
|
}
|
|
#endregion
|
|
|
|
#region 操作 Events
|
|
|
|
/// <summary>
|
|
/// 右键删除事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnMenuDelete_Click(object sender, EventArgs e)
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length > 0)
|
|
{
|
|
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
|
|
{
|
|
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
|
|
BLL.PreProjectApplyService.DeletePreProjectApply(rowID);
|
|
}
|
|
BindGrid();
|
|
ShowNotify("操作完成!", MessageBoxIcon.Success);
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
/// <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();
|
|
}
|
|
|
|
protected void Grid1_Sort(object sender, FineUIPro.GridSortEventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
|
|
/// <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 apply = BLL.PreProjectApplyService.GetPreProjectApplyById(Grid1.SelectedRowID);
|
|
if (apply != null)
|
|
{
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("PreProjectApply.aspx?Id={0}", apply.Id, "项目预立项申请")));
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查看
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnView_Click(object sender, EventArgs e)
|
|
{
|
|
if (!string.IsNullOrEmpty(Grid1.SelectedRowID))
|
|
{ PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ProjectSetMap.aspx?projectId={0}&value=0", Grid1.SelectedRowID, "查看 - "))); }
|
|
}
|
|
|
|
#region 获取按钮权限
|
|
///// <summary>
|
|
///// 获取按钮权限
|
|
///// </summary>
|
|
///// <param name="button"></param>
|
|
///// <returns></returns>
|
|
//private void GetButtonPower()
|
|
//{
|
|
// if (Request.Params["value"] == "0")
|
|
// {
|
|
// return;
|
|
// }
|
|
// string menuId = Const.SeverProjectSetMenuId;
|
|
// if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
|
|
// {
|
|
// menuId = BLL.Const.ProjectSetMenuId;
|
|
// }
|
|
// var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, menuId);
|
|
// if (buttonList.Count() > 0)
|
|
// {
|
|
// if (buttonList.Contains(BLL.Const.BtnAdd))
|
|
// {
|
|
// this.btnApply.Hidden = false;
|
|
// }
|
|
// if (buttonList.Contains(BLL.Const.BtnModify) || buttonList.Contains(BLL.Const.BtnSave))
|
|
// {
|
|
// this.btnMenuEdit.Hidden = false;
|
|
// }
|
|
// if (buttonList.Contains(BLL.Const.BtnDelete))
|
|
// {
|
|
// this.btnMenuDelete.Hidden = false;
|
|
// }
|
|
// }
|
|
//}
|
|
#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>
|
|
/// <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();
|
|
}
|
|
#endregion
|
|
|
|
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
|
|
{
|
|
object[] keys = Grid1.DataKeys[e.RowIndex];
|
|
string fileId = string.Empty;
|
|
if (keys == null)
|
|
{
|
|
return;
|
|
}
|
|
else
|
|
{
|
|
fileId = keys[0].ToString();
|
|
}
|
|
if (e.CommandName == "ProjectUnit")
|
|
{
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ProjectUnit.aspx?projectId={0}&type=project", fileId)));
|
|
}
|
|
else if (e.CommandName == "ProjectUser")
|
|
{
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ProjectUser.aspx?projectId={0}&type=project", fileId)));
|
|
}
|
|
}
|
|
|
|
}
|
|
} |