717 lines
32 KiB
C#
717 lines
32 KiB
C#
using BLL;
|
||
using NPOI.SS.UserModel;
|
||
using NPOI.XSSF.UserModel;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data.SqlClient;
|
||
using System.Data;
|
||
using System.IO;
|
||
using System.Linq;
|
||
using System.Web;
|
||
using System.Web.UI;
|
||
using System.Web.UI.WebControls;
|
||
using static System.Windows.Forms.AxHost;
|
||
using System.Windows.Forms;
|
||
using Microsoft.ReportingServices.ReportProcessing.ReportObjectModel;
|
||
|
||
namespace FineUIPro.Web.ContractorQuality
|
||
{
|
||
public partial class IncidentInvestigation : PageBase
|
||
{
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
if (!IsPostBack)
|
||
{
|
||
GetButtonPower();//权限设置
|
||
|
||
btnNew.OnClientClick = Window1.GetShowReference("IncidentInvestigationEdit.aspx") + "return false;";
|
||
btnDelete.OnClientClick = Grid1.GetNoSelectionAlertReference("请选择一条记录!");
|
||
btnDelete.ConfirmText = String.Format("Are you sure you want to delete the selected <b><script>{0}</script></b> rows?", Grid1.GetSelectedCountReference());
|
||
|
||
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
||
// 绑定表格
|
||
BindGrid();
|
||
}
|
||
}
|
||
|
||
private void BindGrid()
|
||
{
|
||
string strSql = string.Empty;
|
||
strSql = @"select p.PunishmentId,
|
||
p.PunishDate,
|
||
p.Description,
|
||
p.Violation_Inspector,
|
||
p.CreateDate,
|
||
p.Flag,
|
||
p.States,
|
||
u.UserName as CreateName,
|
||
d.DepartLeader
|
||
from EMC_Punishment p
|
||
left join Sys_User as u on u.UserId = p.Violation_Inspector
|
||
left join Base_Depart as d on d.DepartId = u.DepartId
|
||
left join Sys_User as du on du.UserId = d.DepartLeader
|
||
where Flag='2' ";
|
||
List<SqlParameter> listStr = new List<SqlParameter>();
|
||
var role = BLL.Sys_RoleService.GetRole(CurrUser.RoleId);
|
||
if (this.CurrUser.UserId == BLL.Const.GlyId || role.RoleName.Contains("Contractor_Leader") || role.RoleName.Contains("CTE/D Manager"))
|
||
{
|
||
this.rblState.Hidden = true;
|
||
}
|
||
else
|
||
{
|
||
if (rblState.SelectedValue == "1")
|
||
{
|
||
if (role != null)
|
||
{
|
||
if (role.RoleName == "SSRC")
|
||
{
|
||
strSql += " and p.PunishmentId in (select PunishmentId from EMC_PunishmentAudit where AuditMan='SSR' and AuditDate is null)";
|
||
}
|
||
else
|
||
{
|
||
var user = BLL.Sys_UserService.GetUsersByUserId(this.CurrUser.UserId);
|
||
if (user != null)
|
||
{
|
||
strSql += " and p.PunishmentId in (select PunishmentId from EMC_PunishmentAudit where (AuditMan='" + user.DepartId + "' or AuditMan='" + this.CurrUser.UserId + "') and AuditDate is null)";
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|
||
else if (rblState.SelectedValue == "2")
|
||
{
|
||
strSql += " and p.PunishmentId in (select PunishmentId from EMC_PunishmentAudit where AuditMan=@userid and AuditDate is not null)";
|
||
listStr.Add(new SqlParameter("@userid", this.CurrUser.UserId));
|
||
}
|
||
else if (rblState.SelectedValue == "3")
|
||
{
|
||
strSql += " AND p.Violation_Inspector=@userid";
|
||
listStr.Add(new SqlParameter("@userid", this.CurrUser.UserId));
|
||
}
|
||
}
|
||
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();
|
||
|
||
//for (int i = 0; i < Grid1.Rows.Count; i++)
|
||
//{
|
||
// System.Web.UI.WebControls.LinkButton lbtnUrl = ((System.Web.UI.WebControls.LinkButton)(Grid1.Rows[i].FindControl("lbtnUrl")));
|
||
// string url = lbtnUrl.CommandArgument.ToString();
|
||
// if (!string.IsNullOrEmpty(url))
|
||
// {
|
||
// url = url.Replace('\\', '/');
|
||
// lbtnUrl.Text = BLL.UploadAttachmentService.ShowAttachment("../", url);
|
||
// }
|
||
//}
|
||
}
|
||
|
||
#region 编辑
|
||
/// <summary>
|
||
/// 编辑
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnEdit_Click(object sender, EventArgs e)
|
||
{
|
||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||
{
|
||
Alert.ShowInParent("Please select at least one record!");
|
||
return;
|
||
}
|
||
string rowID = Grid1.SelectedRowID;
|
||
var pun = BLL.PunishmentService.GetPunishmentById(rowID);
|
||
if (pun != null)
|
||
{
|
||
if (this.CurrUser.UserId == BLL.Const.GlyId)
|
||
{
|
||
if (pun.States == "6")
|
||
{
|
||
ShowAlert("流程已结束,不能操作!", MessageBoxIcon.Warning);
|
||
}
|
||
else if (pun.States == "7")
|
||
{
|
||
ShowAlert("已拒绝,不能操作!", MessageBoxIcon.Warning);
|
||
}
|
||
else
|
||
{
|
||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("IncidentInvestigationEdit.aspx?punishmentId={0}", rowID, "编辑 - ")));
|
||
}
|
||
}
|
||
else
|
||
{
|
||
var role = BLL.Sys_RoleService.GetRole(CurrUser.RoleId);
|
||
if (this.CurrUser.UserId == pun.Violation_Inspector && pun.States == "0")//当前用户等于发起人
|
||
{
|
||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("IncidentInvestigationEdit.aspx?punishmentId={0}", rowID, "编辑 - ")));
|
||
}
|
||
else if (pun.States == "1")
|
||
{
|
||
if (role != null && role.RoleName.Trim() == "SSRC")
|
||
{
|
||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("IncidentInvestigationEdit.aspx?punishmentId={0}", rowID, "编辑 - ")));
|
||
}
|
||
else
|
||
{
|
||
ShowAlert("您不是SSR,不能操作!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
else if (pun.States == "2")
|
||
{
|
||
if (pun.SeType == "1")//服务
|
||
{
|
||
if (pun.IsFrame == true)//合同框架
|
||
{
|
||
Model.FC_SESRelatedData fc = BLL.SESRelatedDataService.GetSESRelatedDataByFoNo(pun.FO_NO);
|
||
if (fc != null)
|
||
{
|
||
if (this.CurrUser.UserId == fc.Main_Coordinator)//当前用户等于主协调员
|
||
{
|
||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("IncidentInvestigationEdit.aspx?punishmentId={0}", rowID, "编辑 - ")));
|
||
}
|
||
else
|
||
{
|
||
ShowAlert("您不是" + BLL.Sys_UserService.GetUserNameByUserId(fc.Main_Coordinator) + ",不能操作!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (this.CurrUser.UserId == pun.ContractRequester)//非合同框架,当前用户等于合同需求人
|
||
{
|
||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("IncidentInvestigationEdit.aspx?punishmentId={0}", rowID, "编辑 - ")));
|
||
}
|
||
else
|
||
{
|
||
ShowAlert("您不是" + BLL.Sys_UserService.GetUserNameByUserId(pun.ContractRequester) + ",不能操作!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
}
|
||
else //物资
|
||
{
|
||
if (this.CurrUser.UserId == pun.PVTRequester)//物资,当前用户等于PVT小组组长/请购员
|
||
{
|
||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("IncidentInvestigationEdit.aspx?punishmentId={0}", rowID, "编辑 - ")));
|
||
}
|
||
else
|
||
{
|
||
ShowAlert("您不是" + BLL.Sys_UserService.GetUserNameByUserId(pun.PVTRequester) + ",不能操作!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
}
|
||
else if (pun.States == "3")//用户部门
|
||
{
|
||
var user = BLL.Sys_UserService.GetUsersByUserId(this.CurrUser.UserId);
|
||
if (user != null)
|
||
{
|
||
if (pun.IsFrame == true && user.DepartId == pun.UserDep)
|
||
{
|
||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("IncidentInvestigationEdit.aspx?punishmentId={0}", rowID, "编辑 - ")));
|
||
}
|
||
else
|
||
{
|
||
var depart = BLL.DepartService.GetDepartNameById(pun.UserDep);
|
||
ShowAlert("您不是" + depart + "部门用户,不能操作!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
}
|
||
else if (pun.States == "4")//合同管理员
|
||
{
|
||
if (pun.IsFrame == true && this.CurrUser.UserId == pun.ContractAdmin)
|
||
{
|
||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("IncidentInvestigationEdit.aspx?punishmentId={0}", rowID, "编辑 - ")));
|
||
}
|
||
else
|
||
{
|
||
ShowAlert("您不是" + BLL.Sys_UserService.GetUserNameByUserId(pun.ContractAdmin) + ",不能操作!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
else if (pun.States == "5")
|
||
{
|
||
if (((pun.SeType == "1" && pun.IsFrame == false) || pun.SeType == "2") && this.CurrUser.UserId == pun.Buyer)
|
||
{
|
||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("IncidentInvestigationEdit.aspx?punishmentId={0}", rowID, "编辑 - ")));
|
||
}
|
||
else
|
||
{
|
||
ShowAlert("您不是" + BLL.Sys_UserService.GetUserNameByUserId(pun.Buyer) + ",不能操作!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
else if (pun.States == "6")
|
||
{
|
||
ShowAlert("流程已结束,不能操作!", MessageBoxIcon.Warning);
|
||
}
|
||
else if (pun.States == "7")
|
||
{
|
||
ShowAlert("已拒绝,不能操作!", MessageBoxIcon.Warning);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 右键编辑事件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnMenuEdit_Click(object sender, EventArgs e)
|
||
{
|
||
btnEdit_Click(null, null);
|
||
}
|
||
|
||
/// <summary>
|
||
/// Grid行双击事件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
||
{
|
||
btnEdit_Click(null, null);
|
||
}
|
||
#endregion
|
||
|
||
#region 删除数据
|
||
/// <summary>
|
||
/// 批量删除数据
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnDelete_Click(object sender, EventArgs e)
|
||
{
|
||
this.DeleteData();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 右键删除事件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnMenuDelete_Click(object sender, EventArgs e)
|
||
{
|
||
this.DeleteData();
|
||
}
|
||
|
||
/// <summary>
|
||
/// 删除方法
|
||
/// </summary>
|
||
private void DeleteData()
|
||
{
|
||
if (!string.IsNullOrEmpty(Grid1.SelectedRowID))
|
||
{
|
||
string rowID = Grid1.SelectedRowID;
|
||
var pun = BLL.PunishmentService.GetPunishmentById(rowID);
|
||
if (pun != null)
|
||
{
|
||
if (judgementDelete(rowID, false))
|
||
{
|
||
BLL.PunishmentAuditService.DeletePunishmentAuditByPunishmentId(rowID);
|
||
BLL.PunishmentService.DeletePunishmentById(rowID);
|
||
}
|
||
}
|
||
BindGrid();
|
||
BLL.Sys_LogService.AddLog(this.CurrUser.UserId, "删除承包商质量事件调查");
|
||
ShowNotify("删除成功!");
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 查询
|
||
/// <summary>
|
||
/// 查询
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
//protected void btnSearch_Click(object sender, EventArgs e)
|
||
//{
|
||
// BindGrid();
|
||
//}
|
||
#endregion
|
||
|
||
#region 查看
|
||
protected void btnMenuView_Click(object sender, EventArgs e)
|
||
{
|
||
if (Grid1.SelectedRowIndexArray.Length == 0)
|
||
{
|
||
Alert.ShowInParent("请选择一行记录!");
|
||
return;
|
||
}
|
||
string Id = Grid1.SelectedRowID;
|
||
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("IncidentInvestigationEdit.aspx?punishmentId={0}&view=1", Id, "查看 - ")));
|
||
}
|
||
#endregion
|
||
|
||
#region 判断是否可删除
|
||
/// <summary>
|
||
/// 判断是否可以删除
|
||
/// </summary>
|
||
/// <returns></returns>
|
||
private bool judgementDelete(string id, bool isShow)
|
||
{
|
||
string content = string.Empty;
|
||
|
||
if (string.IsNullOrEmpty(content))
|
||
{
|
||
return true;
|
||
}
|
||
else
|
||
{
|
||
if (isShow)
|
||
{
|
||
Alert.ShowInTop(content);
|
||
}
|
||
return false;
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
#region 关闭弹出窗口
|
||
/// <summary>
|
||
/// 关闭窗口
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void Window1_Close(object sender, EventArgs e)
|
||
{
|
||
BindGrid();
|
||
}
|
||
#endregion
|
||
|
||
#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
|
||
|
||
#region 导出
|
||
/// <summary>
|
||
/// 导出按钮
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
//protected void btnExport_Click(object sender, EventArgs e)
|
||
//{
|
||
// string rootPath = Server.MapPath("~/") + Const.ExcelUrl;
|
||
// //模板文件
|
||
// string TempletFileName = rootPath + "Punishment.xlsx";
|
||
// //导出文件
|
||
// string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\";
|
||
// if (!Directory.Exists(filePath))
|
||
// {
|
||
// Directory.CreateDirectory(filePath);
|
||
// }
|
||
// string ReportFileName = filePath + "out.xlsx";
|
||
|
||
// FileStream file = new FileStream(TempletFileName, FileMode.Open, FileAccess.Read);
|
||
// XSSFWorkbook hssfworkbook = new XSSFWorkbook(file);
|
||
|
||
// #region FC_List
|
||
// XSSFSheet reportModel = (XSSFSheet)hssfworkbook.GetSheet("Sheet1");
|
||
|
||
// IDataFormat dataformat = hssfworkbook.CreateDataFormat();
|
||
// ICellStyle styleQfw = hssfworkbook.CreateCellStyle();
|
||
// styleQfw.DataFormat = dataformat.GetFormat("#,##0.00");
|
||
|
||
// ICellStyle styleDate = hssfworkbook.CreateCellStyle();
|
||
// styleDate.DataFormat = dataformat.GetFormat("yyyy/m/d");
|
||
|
||
// ICellStyle styleTime = hssfworkbook.CreateCellStyle();
|
||
// styleTime.DataFormat = dataformat.GetFormat("yyyy/m/d HH:mm:ss");
|
||
|
||
// XSSFFont cs_content_Font = (XSSFFont)hssfworkbook.CreateFont(); //创建字体
|
||
// cs_content_Font.FontName = "等线";//字体
|
||
// cs_content_Font.FontHeightInPoints = 10; //字体大小
|
||
|
||
// Grid1.PageSize = 1000000;
|
||
// BindGrid();
|
||
|
||
// if (Grid1.Rows.Count() > 0)
|
||
// {
|
||
// for (int i = 1; i <= Grid1.Rows.Count(); i++)
|
||
// {
|
||
// if (reportModel.GetRow(i) == null) reportModel.CreateRow(i);
|
||
|
||
// #region 列赋值
|
||
// //Date
|
||
// if (reportModel.GetRow(i).GetCell(0) == null) reportModel.GetRow(i).CreateCell(0);
|
||
// if (Grid1.Rows[i - 1].Values[1] != null && Grid1.Rows[i - 1].Values[1].ToString() != "")
|
||
// {
|
||
// DateTime date = Convert.ToDateTime(Grid1.Rows[i - 1].Values[1]);
|
||
// reportModel.GetRow(i).GetCell(0).SetCellValue(date.ToString("yyyy/MM/dd"));
|
||
// // reportModel.GetRow(i).GetCell(0).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
|
||
// }
|
||
|
||
// //Time
|
||
// if (reportModel.GetRow(i).GetCell(1) == null) reportModel.GetRow(i).CreateCell(1);
|
||
// reportModel.GetRow(i).GetCell(1).SetCellValue(Grid1.Rows[i - 1].Values[2].ToString());
|
||
// // Contract No.
|
||
// if (reportModel.GetRow(i).GetCell(2) == null) reportModel.GetRow(i).CreateCell(2);
|
||
// reportModel.GetRow(i).GetCell(2).SetCellValue(Grid1.Rows[i - 1].Values[3].ToString());
|
||
// //是否框架合格
|
||
// if (reportModel.GetRow(i).GetCell(3) == null) reportModel.GetRow(i).CreateCell(3);
|
||
// reportModel.GetRow(i).GetCell(3).SetCellValue(Grid1.Rows[i - 1].Values[4].ToString() == "True" ? "是" : "否");
|
||
|
||
// // Discipline
|
||
// if (reportModel.GetRow(i).GetCell(4) == null) reportModel.GetRow(i).CreateCell(4);
|
||
// reportModel.GetRow(i).GetCell(4).SetCellValue(Grid1.Rows[i - 1].Values[5].ToString());
|
||
// // Contractor
|
||
// if (reportModel.GetRow(i).GetCell(5) == null) reportModel.GetRow(i).CreateCell(5);
|
||
// reportModel.GetRow(i).GetCell(5).SetCellValue(Grid1.Rows[i - 1].Values[6].ToString());
|
||
// // Location
|
||
// if (reportModel.GetRow(i).GetCell(6) == null) reportModel.GetRow(i).CreateCell(6);
|
||
// reportModel.GetRow(i).GetCell(6).SetCellValue(Grid1.Rows[i - 1].Values[7].ToString());
|
||
// //Violation Person
|
||
// if (reportModel.GetRow(i).GetCell(7) == null) reportModel.GetRow(i).CreateCell(7);
|
||
// reportModel.GetRow(i).GetCell(7).SetCellValue(Grid1.Rows[i - 1].Values[8].ToString());
|
||
// // Violation Description
|
||
// if (reportModel.GetRow(i).GetCell(8) == null) reportModel.GetRow(i).CreateCell(8);
|
||
// reportModel.GetRow(i).GetCell(8).SetCellValue(Grid1.Rows[i - 1].Values[9].ToString());
|
||
// //Violation Clause
|
||
// if (reportModel.GetRow(i).GetCell(9) == null) reportModel.GetRow(i).CreateCell(9);
|
||
// reportModel.GetRow(i).GetCell(9).SetCellValue(Grid1.Rows[i - 1].Values[10].ToString());
|
||
|
||
// // Company(RMB)
|
||
// if (reportModel.GetRow(i).GetCell(10) == null) reportModel.GetRow(i).CreateCell(10);
|
||
// reportModel.GetRow(i).GetCell(10).SetCellValue(Grid1.Rows[i - 1].Values[11].ToString());
|
||
// // Individual(RMB)
|
||
// if (reportModel.GetRow(i).GetCell(11) == null) reportModel.GetRow(i).CreateCell(11);
|
||
// reportModel.GetRow(i).GetCell(11).SetCellValue(Grid1.Rows[i - 1].Values[12].ToString());
|
||
// // Backcharge(RMB)
|
||
// if (reportModel.GetRow(i).GetCell(12) == null) reportModel.GetRow(i).CreateCell(12);
|
||
// reportModel.GetRow(i).GetCell(12).SetCellValue(Grid1.Rows[i - 1].Values[13].ToString());
|
||
|
||
// // Violation Degree
|
||
// if (reportModel.GetRow(i).GetCell(13) == null) reportModel.GetRow(i).CreateCell(13);
|
||
// reportModel.GetRow(i).GetCell(13).SetCellValue(Grid1.Rows[i - 1].Values[14].ToString());
|
||
// // Contract Admin
|
||
// if (reportModel.GetRow(i).GetCell(14) == null) reportModel.GetRow(i).CreateCell(14);
|
||
// reportModel.GetRow(i).GetCell(14).SetCellValue(Grid1.Rows[i - 1].Values[15].ToString());
|
||
// // Main Coordinator
|
||
// if (reportModel.GetRow(i).GetCell(15) == null) reportModel.GetRow(i).CreateCell(15);
|
||
// reportModel.GetRow(i).GetCell(15).SetCellValue(Grid1.Rows[i - 1].Values[16].ToString());
|
||
// // M.C.Dept
|
||
// if (reportModel.GetRow(i).GetCell(16) == null) reportModel.GetRow(i).CreateCell(16);
|
||
// reportModel.GetRow(i).GetCell(16).SetCellValue(Grid1.Rows[i - 1].Values[17].ToString());
|
||
// // User Representative
|
||
// if (reportModel.GetRow(i).GetCell(17) == null) reportModel.GetRow(i).CreateCell(17);
|
||
// reportModel.GetRow(i).GetCell(17).SetCellValue(Grid1.Rows[i - 1].Values[18].ToString());
|
||
// // BYC RU
|
||
// if (reportModel.GetRow(i).GetCell(18) == null) reportModel.GetRow(i).CreateCell(18);
|
||
// reportModel.GetRow(i).GetCell(18).SetCellValue(Grid1.Rows[i - 1].Values[19].ToString());
|
||
// // Violation Inspector
|
||
// if (reportModel.GetRow(i).GetCell(19) == null) reportModel.GetRow(i).CreateCell(19);
|
||
// reportModel.GetRow(i).GetCell(19).SetCellValue(Grid1.Rows[i - 1].Values[20].ToString());
|
||
// // Inspection Department
|
||
// if (reportModel.GetRow(i).GetCell(20) == null) reportModel.GetRow(i).CreateCell(20);
|
||
// reportModel.GetRow(i).GetCell(20).SetCellValue(Grid1.Rows[i - 1].Values[21].ToString());
|
||
// //Requistioner
|
||
// if (reportModel.GetRow(i).GetCell(21) == null) reportModel.GetRow(i).CreateCell(21);
|
||
// reportModel.GetRow(i).GetCell(21).SetCellValue(Grid1.Rows[i - 1].Values[22].ToString());
|
||
|
||
// // Backcharge SES No.
|
||
// if (reportModel.GetRow(i).GetCell(22) == null) reportModel.GetRow(i).CreateCell(22);
|
||
// reportModel.GetRow(i).GetCell(22).SetCellValue(Grid1.Rows[i - 1].Values[23].ToString());
|
||
// // Backcharge Completion Date
|
||
// if (reportModel.GetRow(i).GetCell(23) == null) reportModel.GetRow(i).CreateCell(23);
|
||
// if (Grid1.Rows[i - 1].Values[24] != null && Grid1.Rows[i - 1].Values[24].ToString() != "")
|
||
// {
|
||
// DateTime date = Convert.ToDateTime(Grid1.Rows[i - 1].Values[24]);
|
||
// reportModel.GetRow(i).GetCell(23).SetCellValue(date.ToString("yyyy/MM/dd"));
|
||
// // reportModel.GetRow(i).GetCell(0).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
|
||
// }
|
||
// #endregion
|
||
// }
|
||
// }
|
||
// #endregion
|
||
// reportModel.ForceFormulaRecalculation = true;
|
||
|
||
// using (FileStream filess = File.OpenWrite(ReportFileName))
|
||
// {
|
||
// hssfworkbook.Write(filess);
|
||
// }
|
||
// FileInfo filet = new FileInfo(ReportFileName);
|
||
// Response.Clear();
|
||
// Response.Charset = "GB2312";
|
||
// Response.ContentEncoding = System.Text.Encoding.UTF8;
|
||
// // 添加头信息,为"文件下载/另存为"对话框指定默认文件名
|
||
// Response.AddHeader("Content-Disposition", "attachment; filename=CQuality_Punishment_" + Server.UrlEncode(DateTime.Now.ToString("yyyyMMddhhmmss") + ".xlsx"));
|
||
// // 添加头信息,指定文件大小,让浏览器能够显示下载进度
|
||
// Response.AddHeader("Content-Length", filet.Length.ToString());
|
||
// // 指定返回的是一个不能被客户端读取的流,必须被下载
|
||
// Response.ContentType = "application/ms-excel";
|
||
// // 把文件流发送到客户端
|
||
// Response.WriteFile(filet.FullName);
|
||
// // 停止页面的执行
|
||
// Response.End();
|
||
|
||
//}
|
||
#endregion
|
||
|
||
#region 权限设置
|
||
/// <summary>
|
||
/// 菜单按钮权限
|
||
/// </summary>
|
||
private void GetButtonPower()
|
||
{
|
||
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.UserId, BLL.Const.IncidentInvestigationMenuId);
|
||
if (buttonList.Count() > 0)
|
||
{
|
||
if (buttonList.Contains(BLL.Const.BtnAdd))
|
||
{
|
||
this.btnNew.Hidden = false;
|
||
}
|
||
//if (buttonList.Contains(BLL.Const.BtnModify))
|
||
//{
|
||
// this.btnEdit.Hidden = false;
|
||
// this.btnMenuEdit.Hidden = false;
|
||
//}
|
||
if (buttonList.Contains(BLL.Const.BtnDelete))
|
||
{
|
||
this.btnDelete.Hidden = false;
|
||
this.btnMenuDelete.Hidden = false;
|
||
}
|
||
//if (buttonList.Contains(BLL.Const.BtnModify))
|
||
//{
|
||
// this.Grid1.EnableRowDoubleClickEvent = true;
|
||
//}
|
||
//else
|
||
//{
|
||
// this.Grid1.EnableRowDoubleClickEvent = false;
|
||
//}
|
||
}
|
||
}
|
||
#endregion
|
||
|
||
/// <summary>
|
||
/// 审批人
|
||
/// </summary>
|
||
/// <param name="punishmentId"></param>
|
||
/// <returns></returns>
|
||
protected string ConvertAudit(object punishmentId)
|
||
{
|
||
string name = string.Empty;
|
||
if (!string.IsNullOrEmpty(punishmentId.ToString()))
|
||
{
|
||
var pun = BLL.PunishmentService.GetPunishmentById(punishmentId.ToString());
|
||
if (pun != null)
|
||
{
|
||
if (pun.States == "1")
|
||
{
|
||
name = "SSR";
|
||
}
|
||
else if (pun.States == "2")
|
||
{
|
||
if (pun.SeType == "1")//服务
|
||
{
|
||
if (pun.IsFrame == true)//合同框架
|
||
{
|
||
Model.FC_SESRelatedData fc = BLL.SESRelatedDataService.GetSESRelatedDataByFoNo(pun.FO_NO);
|
||
if (fc != null)
|
||
{
|
||
name = BLL.Sys_UserService.GetUserNameByUserId(fc.Main_Coordinator);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
name = BLL.Sys_UserService.GetUserNameByUserId(pun.ContractRequester);
|
||
}
|
||
}
|
||
else//物资
|
||
{
|
||
name = BLL.Sys_UserService.GetUserNameByUserId(pun.PVTRequester);
|
||
}
|
||
}
|
||
else if (pun.States == "3" && pun.IsFrame == true)
|
||
{
|
||
name = BLL.DepartService.GetDepartNameById(pun.UserDep);
|
||
}
|
||
else if (pun.States == "4" && pun.IsFrame == true)
|
||
{
|
||
name = BLL.Sys_UserService.GetUserNameByUserId(pun.ContractAdmin);
|
||
}
|
||
else if (pun.States == "5")
|
||
{
|
||
name = BLL.Sys_UserService.GetUserNameByUserId(pun.Buyer);
|
||
}
|
||
}
|
||
}
|
||
return name;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 当期状态
|
||
/// </summary>
|
||
/// <param name="punishmentId"></param>
|
||
/// <returns></returns>
|
||
protected string ConvertState(object punishmentId)
|
||
{
|
||
string s = string.Empty;
|
||
if (!string.IsNullOrEmpty(punishmentId.ToString()))
|
||
{
|
||
var pun = BLL.PunishmentService.GetPunishmentById(punishmentId.ToString());
|
||
if (pun != null)
|
||
{
|
||
if (pun.States == "0")
|
||
{
|
||
s = "发起";
|
||
}
|
||
else if (pun.States == "6")
|
||
{
|
||
s = "已审批";
|
||
}
|
||
else if (pun.States == "7")
|
||
{
|
||
s = "已拒绝";
|
||
}
|
||
else
|
||
{
|
||
s = "进行中";
|
||
}
|
||
}
|
||
}
|
||
return s;
|
||
}
|
||
|
||
/// <summary>
|
||
/// 筛选
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void rblState_SelectedIndexChanged(object sender, EventArgs e)
|
||
{
|
||
BindGrid();
|
||
}
|
||
}
|
||
} |