InitBasfTcc11
This commit is contained in:
@@ -0,0 +1,136 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Data.SqlClient;
|
||||
using System.Web;
|
||||
using BLL;
|
||||
|
||||
namespace FineUIPro.Web.common.BaseInfo
|
||||
{
|
||||
public partial class SelectProject : PageBase
|
||||
{
|
||||
protected void Page_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (!IsPostBack)
|
||||
{
|
||||
BindGrid();
|
||||
|
||||
string projectId = Request.QueryString["projectId"];
|
||||
if (projectId != null)
|
||||
{
|
||||
Grid1.SelectedRowIDArray = new string[] { projectId };
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#region 绑定数据/查询
|
||||
|
||||
private void BindGrid()
|
||||
{
|
||||
string projectIds = BLL.Base_ProjectService.GetStrProjectIds(this.CurrUser.UserId, Const._False);
|
||||
string strSql = @"select * from Base_Project
|
||||
where IsClosed=0 AND ProjectArea=@ProjectArea
|
||||
AND CHARINDEX(ProjectId,@ProjectIds)>0 ";
|
||||
|
||||
List<SqlParameter> parms = new List<SqlParameter>();
|
||||
parms.Add(new SqlParameter("@ProjectIds", projectIds));
|
||||
|
||||
if (this.CurrUser.LoginProjectArea != null)
|
||||
{
|
||||
parms.Add(new SqlParameter("@ProjectArea", this.CurrUser.LoginProjectArea));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(this.txtProjectCode.Text))
|
||||
{
|
||||
strSql += " and ProjectCode LIKE @ProjectCode";
|
||||
parms.Add(new SqlParameter("@ProjectCode", "%" + this.txtProjectCode.Text.Trim() + "%"));
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(this.txtProjectName.Text))
|
||||
{
|
||||
strSql += " and ProjectName LIKE @ProjectName";
|
||||
parms.Add(new SqlParameter("@ProjectName", "%" + this.txtProjectName.Text.Trim() + "%"));
|
||||
}
|
||||
strSql += " order by ProjectCode";
|
||||
|
||||
SqlParameter[] parameter = parms.ToArray();
|
||||
DataTable dt = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
|
||||
Grid1.RecordCount = dt.Rows.Count;
|
||||
var table = this.GetPagedDataTable(Grid1, dt);
|
||||
|
||||
Grid1.DataSource = table;
|
||||
Grid1.DataBind();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查询
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void btnQuery_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.BindGrid();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
||||
{
|
||||
if (Grid1.SelectedRowIDArray.Length > 0)
|
||||
{
|
||||
string https = ConfigurationManager.AppSettings["Https"];
|
||||
string projectId = e.RowID;
|
||||
HttpCookie projectCookie = new HttpCookie("SelectProject");
|
||||
projectCookie["projectId"] = projectId;
|
||||
projectCookie.Expires = DateTime.Now.AddYears(1);
|
||||
if (https == "true")
|
||||
{
|
||||
projectCookie.Secure = true;
|
||||
}
|
||||
Response.Cookies.Add(projectCookie);
|
||||
}
|
||||
|
||||
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
||||
}
|
||||
|
||||
#region 分页/排序
|
||||
/// <summary>
|
||||
/// 分页
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
||||
{
|
||||
Grid1.PageIndex = e.NewPageIndex;
|
||||
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)
|
||||
{
|
||||
Grid1.SortDirection = e.SortDirection;
|
||||
Grid1.SortField = e.SortField;
|
||||
BindGrid();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user