244 lines
8.5 KiB
C#
244 lines
8.5 KiB
C#
using BLL;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using System.Linq;
|
|
|
|
namespace FineUIPro.Web.Personal
|
|
{
|
|
public partial class TestRunMonthSummary : PageBase
|
|
{
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
Funs.DropDownPageSize(this.ddlPageSize);
|
|
if (this.CurrUser != null && this.CurrUser.PageSize.HasValue)
|
|
{
|
|
Grid1.PageSize = this.CurrUser.PageSize.Value;
|
|
}
|
|
this.ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
|
// 绑定表格
|
|
this.BindGrid();
|
|
////权限按钮方法
|
|
this.GetButtonPower();
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 绑定数据
|
|
/// </summary>
|
|
private void BindGrid()
|
|
{
|
|
string strSql = @"SELECT summary.TestRunMonthSummaryId,summary.ProjectId,summary.UserId,summary.RaiseDate,summary.Major,summary.ProcessName,summary.ProblemDescription,summary.HandleMethod,summary.ExperienceOrSuggestion,Users.UserName,case when summary.ProjectId='0' then '本部' else Project.ProjectName end as ProjectName "
|
|
+ @" From dbo.Person_TestRunMonthSummary AS summary"
|
|
+ @" LEFT JOIN Sys_User AS Users ON Users.UserId=summary.UserId"
|
|
+ @" LEFT JOIN Base_Project AS Project ON Project.ProjectId=summary.ProjectId"
|
|
+ @" WHERE 1=1";
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
if (this.CurrUser.UserId != BLL.Const.sysglyId && this.CurrUser.UserId != BLL.Const.hfnbdId)
|
|
{
|
|
strSql += " AND summary.UserId = @UserId";
|
|
listStr.Add(new SqlParameter("@UserId", this.CurrUser.UserId));
|
|
}
|
|
if (!string.IsNullOrEmpty(this.txtUserName.Text.Trim()))
|
|
{
|
|
strSql += " AND UserName LIKE @UserName";
|
|
listStr.Add(new SqlParameter("@UserName", "%" + this.txtUserName.Text.Trim() + "%"));
|
|
}
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
Grid1.RecordCount = tb.Rows.Count;
|
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|
Grid1.DataSource = table;
|
|
Grid1.DataBind();
|
|
}
|
|
|
|
|
|
#region 分页
|
|
/// <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();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region 删除数据
|
|
/// <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();
|
|
var summary = Person_TestRunMonthSummaryService.GetPersonTestRunMonthSummaryById(rowID);
|
|
if (summary != null)
|
|
{
|
|
BLL.Person_TestRunMonthSummaryService.DeletePersonTestRunMonthSummary(rowID);
|
|
}
|
|
}
|
|
BindGrid();
|
|
ShowNotify("删除数据成功!", MessageBoxIcon.Success);
|
|
}
|
|
else
|
|
{
|
|
ShowNotify("请至少选中一行!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
protected void btnNew_Click(object sender, EventArgs e)
|
|
{
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TestRunMonthSummaryEdit.aspx", "编辑 - ")));
|
|
}
|
|
|
|
#region 编辑
|
|
/// <summary>
|
|
/// 编辑
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnMenuEdit_Click(object sender, EventArgs e)
|
|
{
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
{
|
|
Alert.ShowInParent("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
string Id = Grid1.SelectedRowID;
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("TestRunMonthSummaryEdit.aspx?TestRunMonthSummaryId={0}", Id, "编辑 - ")));
|
|
}
|
|
|
|
/// <summary>
|
|
/// Grid行双击事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
|
{
|
|
btnMenuEdit_Click(null, null);
|
|
}
|
|
#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>
|
|
/// 获取按钮权限
|
|
/// </summary>
|
|
/// <param name="button"></param>
|
|
/// <returns></returns>
|
|
private void GetButtonPower()
|
|
{
|
|
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.TestRunMonthSummaryMenuId);
|
|
if (buttonList.Count() > 0)
|
|
{
|
|
if (buttonList.Contains(BLL.Const.BtnAdd))
|
|
{
|
|
this.btnNew.Hidden = false;
|
|
}
|
|
if (buttonList.Contains(BLL.Const.BtnModify))
|
|
{
|
|
this.btnMenuEdit.Hidden = false;
|
|
}
|
|
if (buttonList.Contains(BLL.Const.BtnDelete))
|
|
{
|
|
this.btnMenuDelete.Hidden = false;
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
protected void Window1_Close(object sender, EventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取整改前图片(放于Img中)
|
|
/// </summary>
|
|
/// <param name="TestRunMonthSummaryId"></param>
|
|
/// <returns></returns>
|
|
protected string ConvertImageUrlByImage(object TestRunMonthSummaryId)
|
|
{
|
|
string url = string.Empty;
|
|
string httpUrl = string.Empty;
|
|
if (TestRunMonthSummaryId != null)
|
|
{
|
|
var file = BLL.AttachFileService.GetAttachFileByToKeyId(TestRunMonthSummaryId.ToString());
|
|
if (file != null)
|
|
{
|
|
url = BLL.UploadAttachmentService.ShowImage(Funs.SGGLUrl, file.AttachUrl);
|
|
}
|
|
}
|
|
return url;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 获取整改前图片(放于Img中)
|
|
/// </summary>
|
|
/// <param name="TestRunMonthSummaryId"></param>
|
|
/// <returns></returns>
|
|
protected string ConvertImageUrlByImage2(object TestRunMonthSummaryId)
|
|
{
|
|
string url = string.Empty;
|
|
string httpUrl = string.Empty;
|
|
if (TestRunMonthSummaryId != null)
|
|
{
|
|
var file = BLL.AttachFileService.GetAttachFileByToKeyId(TestRunMonthSummaryId.ToString() + "R");
|
|
if (file != null)
|
|
{
|
|
url = BLL.UploadAttachmentService.ShowImage(Funs.SGGLUrl, file.AttachUrl);
|
|
}
|
|
}
|
|
return url;
|
|
}
|
|
}
|
|
} |