494 lines
20 KiB
C#
494 lines
20 KiB
C#
using BLL;
|
|
using FineUIPro.Web.DataShow;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Data.SqlClient;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using NPOI.SS.UserModel;
|
|
using System.Security.Policy;
|
|
|
|
namespace FineUIPro.Web.CQMS.DesignDrawing
|
|
{
|
|
public partial class ArchivesLib : PageBase
|
|
{
|
|
/// <summary>
|
|
/// 项目id
|
|
/// </summary>
|
|
public string ProjectId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["ProjectId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["ProjectId"] = value;
|
|
}
|
|
}
|
|
|
|
#region 加载页面
|
|
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
this.ProjectId = this.CurrUser.LoginProjectId;
|
|
this.InitDropDownList();
|
|
|
|
////权限按钮方法
|
|
//UnitService.InitUnitByProjectIdUnitTypeDropDownList(drpSponsorUnit, this.CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_2, true);
|
|
//UnitWorkService.InitUnitWorkDownList(drpUnitWork, this.CurrUser.LoginProjectId, true);
|
|
//CNProfessionalService.InitCNProfessionalDownList(drpCNProfessional, true);
|
|
//QualityQuestionTypeService.InitQualityQuestionTypeDownList(drpQuestionType, true);
|
|
//Funs.FineUIPleaseSelect(this.dpHandelStatus);
|
|
//btnNew.OnClientClick = Window1.GetShowReference("ChecklistEdit.aspx") + "return false;";
|
|
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
|
|
//if (ProjectUnitService.GetProjectUnitTypeByProjectIdUnitId(this.CurrUser.LoginProjectId, CurrUser.UnitId))
|
|
//{
|
|
// drpSponsorUnit.SelectedValue = CurrUser.UnitId;
|
|
// drpSponsorUnit.Readonly = true;
|
|
//}
|
|
// 绑定表格
|
|
BindGrid();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// 下拉加载
|
|
/// </summary>
|
|
private void InitDropDownList()
|
|
{
|
|
BLL.DesignDrawingService.InitWbsFullPathDropDownList(this.ddlWbsFullPath, this.CurrUser.LoginProjectId, false);
|
|
BLL.DesignDrawingService.InitFileVersionDropDownList(this.ddlFileVersion, this.CurrUser.LoginProjectId, false);
|
|
BLL.DesignDrawingService.InitMajorNameDropDownList(this.ddlMajorName, this.CurrUser.LoginProjectId, false);
|
|
//BLL.DesignDrawingService.InitMajorNoDropDownList(this.ddlMajorNo, this.CurrUser.LoginProjectId, false);
|
|
BLL.DesignDrawingService.InitStatusNameDropDownList(this.ddlStatus, this.CurrUser.LoginProjectId, false);
|
|
BLL.DesignDrawingService.InitClassDropDownList(this.ddlClass, this.CurrUser.LoginProjectId, false);
|
|
|
|
BLL.DesignDrawingService.InitDesignUserNameDropDownList(this.ddlDesignUserName, this.CurrUser.LoginProjectId, false);
|
|
BLL.DesignDrawingService.InitJiaoheUserNameDropDownList(this.ddlJiaoheUserName, this.CurrUser.LoginProjectId, false);
|
|
BLL.DesignDrawingService.InitShenheUserNameDropDownList(this.ddlShenheUserName, this.CurrUser.LoginProjectId, false);
|
|
BLL.DesignDrawingService.InitShendingUserNameDropDownList(this.ddlShendingUserName, this.CurrUser.LoginProjectId, false);
|
|
BLL.DesignDrawingService.InitMajorResponsibleUserNameDropDownList(this.ddlMajorResponsibleUserName, this.CurrUser.LoginProjectId, false);
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
/// <summary>
|
|
/// 获取数据
|
|
/// </summary>
|
|
/// <returns></returns>
|
|
protected DataTable BindData()
|
|
{
|
|
string strSql = $@"SELECT * FROM IDP_DesignDrawing as lib WHERE lib.ProjectId=@ProjectId ";
|
|
//ORDER BY lib.updatetime DESC
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
listStr.Add(new SqlParameter("@ProjectId", this.CurrUser.LoginProjectId));
|
|
|
|
if (!string.IsNullOrEmpty(txtStartUpdateTime.Text.Trim()))
|
|
{
|
|
strSql += " AND UpdateTime >= @startUpdateTime ";
|
|
listStr.Add(new SqlParameter("@startUpdateTime", Funs.GetNewDateTime(txtStartUpdateTime.Text.Trim())));
|
|
}
|
|
if (!string.IsNullOrEmpty(txtEndUpdateTime.Text.Trim()))
|
|
{
|
|
strSql += " AND UpdateTime <= @endUpdatTime ";
|
|
listStr.Add(new SqlParameter("@endUpdatTime", $"{Funs.GetNewDateTime(txtEndUpdateTime.Text.Trim())} 23:59:59"));
|
|
}
|
|
if (!string.IsNullOrEmpty(txtStartSendTime.Text.Trim()))
|
|
{
|
|
strSql += " AND Sendtime >= @startSendTime ";
|
|
listStr.Add(new SqlParameter("@startSendTime", Funs.GetNewDateTime(txtStartSendTime.Text.Trim())));
|
|
}
|
|
if (!string.IsNullOrEmpty(txtEndSendTime.Text.Trim()))
|
|
{
|
|
strSql += " AND Sendtime <= @endSendTime ";
|
|
listStr.Add(new SqlParameter("@endSendTime", $"{Funs.GetNewDateTime(txtEndSendTime.Text.Trim())} 23:59:59"));
|
|
}
|
|
if (!string.IsNullOrEmpty(txtStartPrintTime.Text.Trim()))
|
|
{
|
|
strSql += " AND Printtime >= @startPrintTime ";
|
|
listStr.Add(new SqlParameter("@startPrintTime", Funs.GetNewDateTime(txtStartPrintTime.Text.Trim())));
|
|
}
|
|
if (!string.IsNullOrEmpty(txtEndPrintTime.Text.Trim()))
|
|
{
|
|
strSql += " AND Printtime <= @endPrintTime ";
|
|
listStr.Add(new SqlParameter("@endPrintTime", $"{Funs.GetNewDateTime(txtEndPrintTime.Text.Trim())} 23:59:59"));
|
|
}
|
|
if (this.ddlWbsFullPath.SelectedItemArray.Count() > 1 || (this.ddlWbsFullPath.SelectedValue != BLL.Const._Null && this.ddlWbsFullPath.SelectedItemArray.Count() == 1))
|
|
{
|
|
strSql += " AND (1=2 ";
|
|
int i = 0;
|
|
foreach (var item in this.ddlWbsFullPath.SelectedValueArray)
|
|
{
|
|
if (!string.IsNullOrEmpty(item) && item != BLL.Const._Null)
|
|
{
|
|
strSql += " OR WbsFullPath = @WbsFullPath" + i.ToString();
|
|
listStr.Add(new SqlParameter("@WbsFullPath" + i.ToString(), item));
|
|
}
|
|
i++;
|
|
}
|
|
strSql += ")";
|
|
}
|
|
if (this.ddlFileVersion.SelectedItemArray.Count() > 1 || (this.ddlFileVersion.SelectedValue != BLL.Const._Null && this.ddlFileVersion.SelectedItemArray.Count() == 1))
|
|
{
|
|
strSql += " AND (1=2 ";
|
|
int i = 0;
|
|
foreach (var item in this.ddlFileVersion.SelectedValueArray)
|
|
{
|
|
if (!string.IsNullOrEmpty(item) && item != BLL.Const._Null)
|
|
{
|
|
strSql += " OR FileVersion = @FileVersion" + i.ToString();
|
|
listStr.Add(new SqlParameter("@FileVersion" + i.ToString(), item));
|
|
}
|
|
i++;
|
|
}
|
|
strSql += ")";
|
|
}
|
|
if (this.ddlMajorName.SelectedItemArray.Count() > 1 || (this.ddlMajorName.SelectedValue != BLL.Const._Null && this.ddlMajorName.SelectedItemArray.Count() == 1))
|
|
{
|
|
strSql += " AND (1=2 ";
|
|
int i = 0;
|
|
foreach (var item in this.ddlMajorName.SelectedValueArray)
|
|
{
|
|
if (!string.IsNullOrEmpty(item) && item != BLL.Const._Null)
|
|
{
|
|
strSql += " OR MajorName = @MajorName" + i.ToString();
|
|
listStr.Add(new SqlParameter("@MajorName" + i.ToString(), item));
|
|
}
|
|
i++;
|
|
}
|
|
strSql += ")";
|
|
}
|
|
if (this.ddlStatus.SelectedItemArray.Count() > 1 || (this.ddlStatus.SelectedValue != BLL.Const._Null && this.ddlStatus.SelectedItemArray.Count() == 1))
|
|
{
|
|
strSql += " AND (1=2 ";
|
|
int i = 0;
|
|
foreach (var item in this.ddlStatus.SelectedValueArray)
|
|
{
|
|
if (!string.IsNullOrEmpty(item) && item != BLL.Const._Null)
|
|
{
|
|
strSql += " OR Status = @Status" + i.ToString();
|
|
listStr.Add(new SqlParameter("@Status" + i.ToString(), item));
|
|
}
|
|
i++;
|
|
}
|
|
strSql += ")";
|
|
}
|
|
if (this.ddlClass.SelectedItemArray.Count() > 1 || (this.ddlClass.SelectedValue != BLL.Const._Null && this.ddlClass.SelectedItemArray.Count() == 1))
|
|
{
|
|
strSql += " AND (1=2 ";
|
|
int i = 0;
|
|
foreach (var item in this.ddlClass.SelectedValueArray)
|
|
{
|
|
if (!string.IsNullOrEmpty(item) && item != BLL.Const._Null)
|
|
{
|
|
strSql += " OR ClassificationLevelInProject = @Class" + i.ToString();
|
|
listStr.Add(new SqlParameter("@Class" + i.ToString(), item));
|
|
}
|
|
i++;
|
|
}
|
|
strSql += ")";
|
|
}
|
|
if (!string.IsNullOrEmpty(ddlIfmail.SelectedValue.Trim()))
|
|
{
|
|
strSql += " AND ifmail = @ifmail";
|
|
listStr.Add(new SqlParameter("@ifmail", ddlIfmail.SelectedValue.Trim()));
|
|
}
|
|
if (this.ddlDesignUserName.SelectedItemArray.Count() > 1 || (this.ddlDesignUserName.SelectedValue != BLL.Const._Null && this.ddlDesignUserName.SelectedItemArray.Count() == 1))
|
|
{
|
|
strSql += " AND (1=2 ";
|
|
int i = 0;
|
|
foreach (var item in this.ddlDesignUserName.SelectedValueArray)
|
|
{
|
|
if (!string.IsNullOrEmpty(item) && item != BLL.Const._Null)
|
|
{
|
|
strSql += " OR DesignUserName = @DesignUserName" + i.ToString();
|
|
listStr.Add(new SqlParameter("@DesignUserName" + i.ToString(), item));
|
|
}
|
|
i++;
|
|
}
|
|
strSql += ")";
|
|
}
|
|
if (this.ddlJiaoheUserName.SelectedItemArray.Count() > 1 || (this.ddlJiaoheUserName.SelectedValue != BLL.Const._Null && this.ddlJiaoheUserName.SelectedItemArray.Count() == 1))
|
|
{
|
|
strSql += " AND (1=2 ";
|
|
int i = 0;
|
|
foreach (var item in this.ddlJiaoheUserName.SelectedValueArray)
|
|
{
|
|
if (!string.IsNullOrEmpty(item) && item != BLL.Const._Null)
|
|
{
|
|
strSql += " OR JiaoheUserName = @JiaoheUserName" + i.ToString();
|
|
listStr.Add(new SqlParameter("@JiaoheUserName" + i.ToString(), item));
|
|
}
|
|
i++;
|
|
}
|
|
strSql += ")";
|
|
}
|
|
if (this.ddlShenheUserName.SelectedItemArray.Count() > 1 || (this.ddlShenheUserName.SelectedValue != BLL.Const._Null && this.ddlShenheUserName.SelectedItemArray.Count() == 1))
|
|
{
|
|
strSql += " AND (1=2 ";
|
|
int i = 0;
|
|
foreach (var item in this.ddlShenheUserName.SelectedValueArray)
|
|
{
|
|
if (!string.IsNullOrEmpty(item) && item != BLL.Const._Null)
|
|
{
|
|
strSql += " OR ShenheUserName = @ShenheUserName" + i.ToString();
|
|
listStr.Add(new SqlParameter("@ShenheUserName" + i.ToString(), item));
|
|
}
|
|
i++;
|
|
}
|
|
strSql += ")";
|
|
}
|
|
if (this.ddlShendingUserName.SelectedItemArray.Count() > 1 || (this.ddlShendingUserName.SelectedValue != BLL.Const._Null && this.ddlShendingUserName.SelectedItemArray.Count() == 1))
|
|
{
|
|
strSql += " AND (1=2 ";
|
|
int i = 0;
|
|
foreach (var item in this.ddlShendingUserName.SelectedValueArray)
|
|
{
|
|
if (!string.IsNullOrEmpty(item) && item != BLL.Const._Null)
|
|
{
|
|
strSql += " OR ShendingUserName = @ShendingUserName" + i.ToString();
|
|
listStr.Add(new SqlParameter("@ShendingUserName" + i.ToString(), item));
|
|
}
|
|
i++;
|
|
}
|
|
strSql += ")";
|
|
}
|
|
if (this.ddlMajorResponsibleUserName.SelectedItemArray.Count() > 1 || (this.ddlMajorResponsibleUserName.SelectedValue != BLL.Const._Null && this.ddlMajorResponsibleUserName.SelectedItemArray.Count() == 1))
|
|
{
|
|
strSql += " AND (1=2 ";
|
|
int i = 0;
|
|
foreach (var item in this.ddlMajorResponsibleUserName.SelectedValueArray)
|
|
{
|
|
if (!string.IsNullOrEmpty(item) && item != BLL.Const._Null)
|
|
{
|
|
strSql += " OR MajorResponsibleUserName = @MajorResponsibleUserName" + i.ToString();
|
|
listStr.Add(new SqlParameter("@MajorResponsibleUserName" + i.ToString(), item));
|
|
}
|
|
i++;
|
|
}
|
|
strSql += ")";
|
|
}
|
|
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
return tb;
|
|
}
|
|
|
|
/// <summary>
|
|
/// 绑定数据
|
|
/// </summary>
|
|
|
|
public void BindGrid()
|
|
{
|
|
DataTable tb = BindData();
|
|
|
|
// 2.获取当前分页数据
|
|
//var table = this.GetPagedDataTable(Grid1, tb1);
|
|
|
|
Grid1.RecordCount = tb.Rows.Count;
|
|
tb = GetFilteredTable(Grid1.FilteredData, tb);
|
|
var table = this.GetPagedDataTable(Grid1, tb);
|
|
|
|
Grid1.DataSource = table;
|
|
Grid1.DataBind();
|
|
|
|
//for (int i = 0; i < Grid1.Rows.Count; i++)
|
|
//{
|
|
// string rowID = Grid1.Rows[i].DataKeys[0].ToString();
|
|
// if (rowID.Count() > 0)
|
|
// {
|
|
// Model.Check_CheckControl checkControl = BLL.CheckControlService.GetCheckControl(rowID);
|
|
// if (checkControl.State.Equals("5") || checkControl.State.Equals("6"))
|
|
// {
|
|
// Grid1.Rows[i].CellCssClasses[11] = "LightGreen";//未确认
|
|
// }
|
|
// else if (checkControl.State == Const.CheckControl_Complete)
|
|
// { //闭环
|
|
// Grid1.Rows[i].CellCssClasses[11] = "Green";
|
|
|
|
// }
|
|
// else if (Convert.ToDateTime(checkControl.LimitDate).AddDays(1) < DateTime.Now) //延期未整改
|
|
// {
|
|
// Grid1.Rows[i].CellCssClasses[11] = "Red";
|
|
// }
|
|
// else //期内未整改
|
|
// {
|
|
// Grid1.Rows[i].CellCssClasses[11] = " Yellow ";
|
|
// }
|
|
// }
|
|
//}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 查看文件
|
|
/// </summary>
|
|
/// <param name="fileid"></param>
|
|
/// <param name="maintitle"></param>
|
|
/// <returns></returns>
|
|
public static string GetFileUrl(object fid, object maintitle)
|
|
{
|
|
string fileUrl = string.Empty;
|
|
string fileid = fid.ToString();
|
|
string filename = maintitle.ToString();
|
|
if (!string.IsNullOrWhiteSpace(fileid))
|
|
{
|
|
maintitle = !string.IsNullOrWhiteSpace(filename) ? filename : "查看";
|
|
string url = $"https://arch.cwcec.com/preview.html?fileid={fileid}";
|
|
fileUrl = ShowAttachment(url, filename);
|
|
}
|
|
return fileUrl;
|
|
}
|
|
|
|
public static string ShowAttachment(string path, string filename)
|
|
{
|
|
string htmlStr = string.Empty;
|
|
if (!string.IsNullOrEmpty(path))
|
|
{
|
|
htmlStr = "<table runat='server' cellpadding='5' cellspacing='5' style=\"width: 100%\">";
|
|
htmlStr += "<tr><td style=\"width: 60%\" align=\"left\"><span style='cursor:pointer;cursor:pointer;cursor:pointer;TEXT-DECORATION: underline;color:blue' onclick=\"window.open('" + path + "')\">" + filename + "</span></td>";
|
|
htmlStr += "</table>";
|
|
}
|
|
return htmlStr;
|
|
}
|
|
|
|
#region 获取按钮权限
|
|
/// <summary>
|
|
/// 获取按钮权限
|
|
/// </summary>
|
|
/// <param name="button"></param>
|
|
/// <returns></returns>
|
|
private void GetButtonPower()
|
|
{
|
|
if (Request.Params["value"] == "0")
|
|
{
|
|
return;
|
|
}
|
|
var buttonList = BLL.CommonService.GetAllButtonList(this.ProjectId, this.CurrUser.UserId, BLL.Const.ArchivesLibMenuId);
|
|
if (buttonList.Count() > 0)
|
|
{
|
|
if (buttonList.Contains(BLL.Const.BtnAdd))
|
|
{
|
|
//this.btnNew.Hidden = false;
|
|
}
|
|
//if (buttonList.Contains(BLL.Const.BtnModify))
|
|
//{
|
|
// this.btnMenuModify.Hidden = false;
|
|
//}
|
|
//if (buttonList.Contains(BLL.Const.BtnDelete))
|
|
//{
|
|
// this.btnMenuDel.Hidden = false;
|
|
//}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 查询
|
|
|
|
protected void btnQuery_Click(object sender, EventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
|
|
/// <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="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_FilterChange(object sender, EventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
|
|
/// <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 Grid1_Sort(object sender, GridSortEventArgs e)
|
|
{
|
|
//Grid1.SortDirection = e.SortDirection;
|
|
//Grid1.SortField = e.SortField;
|
|
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 Window1_Close(object sender, WindowCloseEventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
#endregion
|
|
|
|
#region Grid双击事件
|
|
/// <summary>
|
|
/// Grid行双击事件
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
|
{
|
|
//btnMenuModify_Click(null, null);
|
|
}
|
|
#endregion
|
|
|
|
|
|
#region 编辑
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
}
|
|
} |