积分优化
This commit is contained in:
@@ -3,7 +3,6 @@ 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;
|
||||
|
||||
@@ -26,6 +25,20 @@ namespace FineUIPro.Web.Score
|
||||
ViewState["ProjectId"] = value;
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// 单位主键
|
||||
/// </summary>
|
||||
public string UnitId
|
||||
{
|
||||
get
|
||||
{
|
||||
return (string)ViewState["UnitId"];
|
||||
}
|
||||
set
|
||||
{
|
||||
ViewState["UnitId"] = value;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
#region 加载
|
||||
/// <summary>
|
||||
@@ -43,15 +56,20 @@ namespace FineUIPro.Web.Score
|
||||
{
|
||||
this.ProjectId = Request.Params["projectId"];
|
||||
}
|
||||
////权限按钮方法
|
||||
this.ucTree.UnitId = this.CurrUser.UnitId;
|
||||
this.ucTree.ProjectId = this.ProjectId;
|
||||
if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
|
||||
this.UnitId = this.CurrUser.UnitId;
|
||||
if (CommonService.IsSuperAdminManage(this.CurrUser.UserId) || (!string.IsNullOrWhiteSpace(this.UnitId) && this.UnitId == Const.UnitId_XJYJ))
|
||||
{
|
||||
this.panelLeftRegion.Hidden = true;
|
||||
////权限按钮方法
|
||||
this.GetButtonPower();
|
||||
this.UnitId = !string.IsNullOrWhiteSpace(this.CurrUser.LastUnitId) ? this.CurrUser.LastUnitId : Const.UnitId_XJYJ;
|
||||
}
|
||||
//////权限按钮方法
|
||||
//this.ucTree.UnitId = this.CurrUser.UnitId;
|
||||
//this.ucTree.ProjectId = this.ProjectId;
|
||||
//if (!string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
|
||||
//{
|
||||
// this.panelLeftRegion.Hidden = true;
|
||||
// ////权限按钮方法
|
||||
// this.GetButtonPower();
|
||||
//}
|
||||
|
||||
if (this.CurrUser != null && this.CurrUser.PageSize.HasValue)
|
||||
{
|
||||
@@ -63,49 +81,71 @@ namespace FineUIPro.Web.Score
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 加载树
|
||||
/// </summary>
|
||||
/// <param name="sender"></param>
|
||||
/// <param name="e"></param>
|
||||
protected void changeTree(object sender, EventArgs e)
|
||||
{
|
||||
this.ProjectId = this.ucTree.ProjectId;
|
||||
this.BindGrid();
|
||||
this.GetButtonPower();
|
||||
}
|
||||
///// <summary>
|
||||
///// 加载树
|
||||
///// </summary>
|
||||
///// <param name="sender"></param>
|
||||
///// <param name="e"></param>
|
||||
//protected void changeTree(object sender, EventArgs e)
|
||||
//{
|
||||
// this.ProjectId = this.ucTree.ProjectId;
|
||||
// this.BindGrid();
|
||||
// this.GetButtonPower();
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// 绑定数据
|
||||
/// </summary>
|
||||
private void BindGrid()
|
||||
{
|
||||
if (string.IsNullOrEmpty(this.ProjectId))
|
||||
{
|
||||
return;
|
||||
}
|
||||
string strSql = "select flowLog.Id, flowLog.Year, flowLog.IdentityCard, flowLog.UserName, flowLog.Type, (case when flowLog.Type=0 then '扣分' else '加分' end) as TypeName,flowLog.Score, flowLog.CurrentScore, flowLog.Item, flowLog.LogContent, flowLog.UserId, flowLog.PersonId, flowLog.UnitId, flowLog.ProjectId, flowLog.UnitName, flowLog.ProjectName, flowLog.Remark, flowLog.CompileDate, flowLog.CompileMan, flowLog.CompileManId from ScoreFlowLog flowLog WHERE 1=1 ";
|
||||
//if (string.IsNullOrEmpty(this.ProjectId))
|
||||
//{
|
||||
// return;
|
||||
//}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.Append("SELECT flowLog.Id, flowLog.Year, flowLog.IdentityCard, flowLog.UserName, flowLog.Type, (case when flowLog.Type=0 then '扣分' else '加分' end) as TypeName,flowLog.Score, flowLog.CurrentScore, flowLog.Item, flowLog.LogContent, flowLog.UserId, flowLog.PersonId, flowLog.UnitId, flowLog.ProjectId, flowLog.UnitName, flowLog.ProjectName, flowLog.Remark, flowLog.CompileDate, flowLog.CompileMan, flowLog.CompileManId ");
|
||||
sb.Append("FROM ScoreFlowLog AS flowLog WITH(NOLOCK) ");
|
||||
sb.Append("WHERE 1=1 ");
|
||||
|
||||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||||
|
||||
strSql += " AND flowLog.ProjectId = @ProjectId";
|
||||
listStr.Add(new SqlParameter("@ProjectId", this.ProjectId));
|
||||
if (!string.IsNullOrEmpty(this.ProjectId))
|
||||
{//项目级
|
||||
sb.Append("AND flowLog.ProjectId = @ProjectId ");
|
||||
listStr.Add(new SqlParameter("@ProjectId", this.ProjectId));
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(this.UnitId) && this.UnitId != Const.UnitId_XJYJ)
|
||||
{//分公司
|
||||
sb.Append("AND flowLog.UnitId = @UnitId ");
|
||||
listStr.Add(new SqlParameter("@UnitId", this.UnitId));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.txtName.Text.Trim()))
|
||||
{
|
||||
strSql += " AND flowLog.UserName like @name";
|
||||
sb.Append("AND flowLog.UserName like @name ");
|
||||
listStr.Add(new SqlParameter("@name", "%" + this.txtName.Text.Trim() + "%"));
|
||||
}
|
||||
if (!string.IsNullOrEmpty(this.drpType.SelectedValue))
|
||||
if (!string.IsNullOrEmpty(this.txtIdentityCard.Text.Trim()))
|
||||
{
|
||||
strSql += " AND flowLog.Type = @type";
|
||||
listStr.Add(new SqlParameter("@type", this.drpType.SelectedValue));
|
||||
sb.Append("AND flowLog.IdentityCard like @IdentityCard ");
|
||||
listStr.Add(new SqlParameter("@IdentityCard", "%" + this.txtIdentityCard.Text.Trim() + "%"));
|
||||
}
|
||||
if (BLL.ProjectUnitService.GetProjectUnitTypeByProjectIdUnitId(this.ProjectId, this.CurrUser.UnitId))
|
||||
if (!string.IsNullOrWhiteSpace(this.rbType.SelectedValue))
|
||||
{
|
||||
strSql += " AND flowLog.UnitId =@unitId";
|
||||
listStr.Add(new SqlParameter("@unitId", this.CurrUser.UnitId));
|
||||
sb.Append("AND flowLog.Type = @type ");
|
||||
listStr.Add(new SqlParameter("@type", this.rbType.SelectedValue));
|
||||
}
|
||||
//if (!string.IsNullOrEmpty(this.drpType.SelectedValue))
|
||||
//{
|
||||
// sb.Append("AND flowLog.Type = @type ");
|
||||
// listStr.Add(new SqlParameter("@type", this.drpType.SelectedValue));
|
||||
//}
|
||||
//if (BLL.ProjectUnitService.GetProjectUnitTypeByProjectIdUnitId(this.ProjectId, this.CurrUser.UnitId))
|
||||
//{
|
||||
// sb.Append("AND flowLog.UnitId =@unitId ");
|
||||
// listStr.Add(new SqlParameter("@unitId", this.CurrUser.UnitId));
|
||||
//}
|
||||
SqlParameter[] parameter = listStr.ToArray();
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
||||
DataTable tb = SQLHelper.GetDataTableRunText(sb.ToString(), parameter);
|
||||
|
||||
Grid1.RecordCount = tb.Rows.Count;
|
||||
var table = this.GetPagedDataTable(Grid1, tb);
|
||||
@@ -201,7 +241,7 @@ namespace FineUIPro.Web.Score
|
||||
{
|
||||
Response.ClearContent();
|
||||
string filename = Funs.GetNewFileName();
|
||||
Response.AddHeader("content-disposition", "attachment; filename=" + System.Web.HttpUtility.UrlEncode("人员记分流水日志表" + filename, System.Text.Encoding.UTF8) + ".xls");
|
||||
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;
|
||||
|
||||
Reference in New Issue
Block a user