Basf_FCL/FCL/FineUIPro.Web/SES/SESRelatedData.aspx.cs

5213 lines
259 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using BLL;
using BLL.Common;
using FineUIPro.Web.common;
using ICSharpCode.SharpZipLib.Zip;
using Model;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Mail;
using System.Web;
namespace FineUIPro.Web.SES
{
public partial class SESRelatedData : PageBase
{
public string selectedList
{
get
{
return (string)ViewState["selectedList"];
}
set
{
ViewState["selectedList"] = value;
}
}
#region
/// <summary>
/// 加载页面
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Page_Load(object sender, EventArgs e)
{
// 表头过滤
FilterDataRowItem = FilterDataRowItemImplement;
if (!IsPostBack)
{
//StartTime.Text = DateTime.Now.AddMonths(-1).ToString(StartTime.DateFormatString);
//EndTime.Text = DateTime.Now.ToString(EndTime.DateFormatString);
GetButtonPower();//权限设置
BLL.ContractorService.InitDropDownList(this.drpContractor, true);
//是否需要交工资料
//this.drpConstRecords.DataTextField = "ConstText";
//this.drpConstRecords.DataValueField = "ConstValue";
//this.drpConstRecords.DataSource = BLL.ConstValue.drpConstItemList(ConstValue.Group_YesOrNo);
//this.drpConstRecords.DataBind();
//this.drpConstRecords.SelectedValue = "N";
//文件类型
this.drpFileType2.DataTextField = "Text";
this.drpFileType2.DataValueField = "Value";
this.drpFileType2.DataSource = BLL.DropListService.getFileTypeDropList();
this.drpFileType2.DataBind();
Funs.FineUIPleaseSelect(this.drpFileType2);
this.drpFileType2Select.DataTextField = "Text";
this.drpFileType2Select.DataValueField = "Value";
this.drpFileType2Select.DataSource = BLL.DropListService.getFileTypeDropList();
this.drpFileType2Select.DataBind();
Funs.FineUIPleaseSelect(this.drpFileType2Select);
//文件类型
//BLL.FileTypeService.InitFileTypeDropDownList(this.drpFileType, true);
//BLL.FileTypeService.InitFileTypeDropDownList(this.drpFileType3Select, true);
//BLL.FileTypeService.InitFileTypeDropDownList(this.drpExportFileType, true);
this.drpExportFileType.DataTextField = "Text";
this.drpExportFileType.DataValueField = "Value";
this.drpExportFileType.DataSource = BLL.DropListService.getConFileTypeDropList();
this.drpExportFileType.DataBind();
Funs.FineUIPleaseSelect(this.drpExportFileType);
btnNew.OnClientClick = Window1.GetShowReference("SESRelatedDataEdit.aspx") + "return false;";
btnDelete.OnClientClick = Grid1.GetNoSelectionAlertReference("Please select at least one item!");
btnDelete.ConfirmText = String.Format("Are you sure you want to delete the selected &nbsp;<b><script>{0}</script></b>&nbsp;rows?", Grid1.GetSelectedCountReference());
ddlPageSize.SelectedValue = Grid1.PageSize.ToString();
// 绑定表格
BindGrid();
}
else if (GetRequestEventArgument() == "FilterChange")
{
BindGrid();
}
}
/// <summary>
/// 绑定数据
/// </summary>
private void BindGrid()
{
//var sesdata = from x in Funs.DB.FC_SESRelatedData select x;
//var u = string.Join(",", sesdata.Where(p => p.User_Representative != null).Select(p => p.User_Representative).Distinct());
//var m = string.Join(",", sesdata.Where(p => p.Main_Coordinator != null).Select(p => p.Main_Coordinator).Distinct());
string cruUser = CurrUser.UserId;
string strSql = @"SELECT * from View_FC_SESRelatedData WHERE 1=1 ";
List<SqlParameter> listStr = new List<SqlParameter>();
if (!string.IsNullOrEmpty(hdConstRecords.Text.Trim()))
{
strSql += " AND ConstRecords =@ConstRecords";
listStr.Add(new SqlParameter("@ConstRecords", this.hdConstRecords.Text.Trim()));
}
if (!string.IsNullOrEmpty(hdFoNo.Text.Trim()))
{
strSql += " AND FO_NO LIKE @FO_NO";
listStr.Add(new SqlParameter("@FO_NO", "%" + this.hdFoNo.Text.Trim() + "%"));
}
if (!string.IsNullOrEmpty(txtFO.Text.Trim()))
{
strSql += " AND FO_NO LIKE @FO";
listStr.Add(new SqlParameter("@FO", "%" + this.txtFO.Text.Trim() + "%"));
}
if (!string.IsNullOrEmpty(hdDiscipline.Text.Trim()))
{
strSql += " AND DisciplineId =@disciplineId";
listStr.Add(new SqlParameter("@disciplineId", hdDiscipline.Text.Trim()));
}
if (!string.IsNullOrEmpty(this.hdContractor.Text.Trim()))
{
strSql += " AND ContractorId =@ContractorId";
listStr.Add(new SqlParameter("@ContractorId", this.hdContractor.Text.Trim()));
}
if (drpContractor.SelectedValue != Const._Null)
{
strSql += " AND ContractorId =@con";
listStr.Add(new SqlParameter("@con", drpContractor.SelectedValue));
}
if (!string.IsNullOrEmpty(this.hdContractAdmin.Text.Trim()))
{
strSql += " AND Contract_AdminId =@Contract_Admin";
listStr.Add(new SqlParameter("@Contract_Admin", this.hdContractAdmin.Text.Trim()));
}
if (!string.IsNullOrEmpty(this.hdBuyer.Text.Trim()))
{
strSql += " AND Buyer=@Buyer";
listStr.Add(new SqlParameter("@Buyer", this.hdBuyer.Text.Trim()));
}
if (!string.IsNullOrEmpty(this.hdMainCoord.Text.Trim()))
{
strSql += " AND Main_CoordinatorId =@Main_Coordinator";
listStr.Add(new SqlParameter("@Main_Coordinator", this.hdMainCoord.Text.Trim()));
}
if (!string.IsNullOrEmpty(this.hdMCDepartment.Text.Trim()))
{
strSql += " AND MCDept=@MCDept";
listStr.Add(new SqlParameter("@MCDept", this.hdMCDepartment.Text.Trim()));
}
if (!string.IsNullOrEmpty(this.hdFCStatus.Text.Trim()))
{
strSql += " AND FC_Status=@FC_Status";
listStr.Add(new SqlParameter("@FC_Status", this.hdFCStatus.Text.Trim()));
//if (this.hdFCStatus.Text.Trim() == "Valid")
//{
// strSql += " AND Expire_Date > GETDATE()";
//}
//else if (this.hdFCStatus.Text.Trim() == "Expired Soon")
//{
// strSql += " AND DATEADD(MONTH,-6,Expire_Date) <= GETDATE() AND Expire_Date > GETDATE() ";
//}
//else if (this.hdFCStatus.Text.Trim() == "Expired")
//{
// strSql += " AND Expire_Date < GETDATE()";
//}
}
if (!string.IsNullOrEmpty(this.hdFoType.Text.Trim()))
{
strSql += " AND FOTypeId=@FOTypeId";
listStr.Add(new SqlParameter("@FOTypeId", this.hdFoType.Text.Trim()));
}
//if (u.Contains(cruUser) || m.Contains(cruUser))
//{
// strSql += " AND (Main_CoordinatorId=@Main_Coordinator or User_RepresentativeId=@User_Representative)";
// listStr.Add(new SqlParameter("@Main_Coordinator", cruUser));
// listStr.Add(new SqlParameter("@User_Representative", cruUser));
//}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid1.RecordCount = tb.Rows.Count;
tb = GetFilteredTable(Grid1.FilteredData, tb);
var table = this.GetPagedDataTable(Grid1, tb);
Grid1.DataSource = table.DefaultView;
Grid1.DataBind();
if (!string.IsNullOrEmpty(selectedList))
{
string[] selectedIds = selectedList.Split(',');
List<string> selectId = new List<string>();
foreach (var id in selectedIds)
{
foreach (DataRow row in tb.Rows)
{
if (id == row["ID"].ToString())
{
selectId.Add(id);
}
}
}
Grid1.SelectedRowIDArray = selectId.ToArray();
}
}
#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 (Grid1.SelectedRowIndexArray.Length > 0)
{
foreach (int rowIndex in Grid1.SelectedRowIndexArray)
{
string rowID = Grid1.DataKeys[rowIndex][0].ToString();
var SESRelatedData = BLL.SESRelatedDataService.GetSESRelatedDataById(rowID);
if (SESRelatedData != null)
{
if (judgementDelete(rowID, false))
{
var signedContractsList = BLL.SignedContractsService.GetSignedContractsByDataId(rowID);
if (signedContractsList != null)
{
BLL.SignedContractsService.DeleteSignedContractsByDataId(rowID);
}
var contractManagement = BLL.ContractManagementService.GetContractManagementByDataId(rowID);
if (contractManagement != null)
{
BLL.ContractManagementService.DeleteContractManagementByDataId(rowID);
}
BLL.SESRelatedDataService.DeleteSESRelatedDataById(rowID);
}
}
}
BindGrid();
BLL.Sys_LogService.AddLog(this.CurrUser.UserId, "Delete SES related data");
ShowNotify("Deleted successfully!");
}
}
#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="sourceObj"></param>
/// <param name="fillteredOperator"></param>
/// <param name="fillteredObj"></param>
/// <param name="column"></param>
/// <returns></returns>
private bool FilterDataRowItemImplement(object sourceObj, string fillteredOperator, object fillteredObj, string column)
{
bool valid = false;
if (column == "FO_NO")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "FOType")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "Contract_Title")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "Pricing_Scheme")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "Contractor")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "Vendor_NO")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "Item")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "Discipline")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "DisciplineCategory")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "Currency")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "Material_Group")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "Purchase_Group")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "Cost_Element")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "Type")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "Contract_Admin")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "Buyer")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "Main_Coordinator")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "MCDept")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "User_Representative")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "Valid_Date")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "Expire_Date")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "FC_Status")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "Contract_Person")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "Cost_Checker")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "Contract_Tel")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "VolumeAllocation")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "Actual_Budget")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ConnectedTransaction")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "CheckedValue")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "RemainingBudget")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "RemainingBudgetRate")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "RemainingDuration")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "Email")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "MainHead")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "MainHeadPosition")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "MainHeadContact")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "SafetyOfficer")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "SafetyOfficerPosition")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "SafetyOfficerContact")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectManager")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectManagerPosition")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ProjectManagerContact")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
if (column == "ConstRecords")
{
string sourceValue = sourceObj.ToString();
string fillteredValue = fillteredObj.ToString();
if (fillteredOperator == "equal" && sourceValue == fillteredValue)
{
valid = true;
}
else if (fillteredOperator == "contain" && sourceValue.Contains(fillteredValue))
{
valid = true;
}
}
return valid;
}
#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 Text_TextChanged(object sender, EventArgs e)
{
BindGrid();
}
protected void btnFind_Click(object sender, EventArgs e)
{
BindGrid();
}
#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 btnSendEmail_Click(object sender, EventArgs e)
{
bool IsComplite = false;
string errorMsg = string.Empty;
string compMsg = string.Empty;
// 过期提示,30天范围
var foList = from x in Funs.DB.FC_SESRelatedData
where x.Expire_Date != null
&& x.Expire_Date.Value.AddMonths(-6).Date <= DateTime.Now.Date
&& x.Expire_Date.Value.Date >= DateTime.Now.Date
select x;
if (foList.Count() > 0)
{
foreach (var fo in foList)
{
List<Model.Sys_User> userList = new List<Sys_User>();
EmailPop pops = Funs.DB.EmailPop.FirstOrDefault(x => x.EmailID == BLL.Const.EmailPopId);
if (pops == null)
{
return;
}
string[] mailTo = null;
string mailBody = string.Empty;
string mailAttch = string.Empty;
string mailCode = string.Empty;
string mailPriority = string.Empty;
string[] mailCC = null;
string resultMessage = "";
string departId = string.Empty;
var contractor = BLL.ContractorService.GetContractorById(fo.Contractor);
var discipline = BLL.DisciplineService.GetDisciplineById(fo.DisciplineId);
string disc = discipline.Discipline.Replace("\r\n", " ");
if (!string.IsNullOrEmpty(discipline.DisciplineCN))
{
disc = disc + " " + discipline.DisciplineCN;
}
mailCode = fo.FO_NO + "|" + disc + "|" + contractor.Contractor + " " + contractor.ContractorCN;
var contractAdmin = from x in Funs.DB.Sys_User where x.UserId == fo.Contract_Admin && x.Email != null && x.Email != "" select x;
var buyer = from x in Funs.DB.Sys_User where x.UserName == fo.Buyer && x.Email != null && x.Email != "" select x;
if (buyer.Count() > 0)
{
userList.Add(buyer.First());
mailCode = mailCode + "|" + buyer.First().UserName;
}
else
{
mailCode = mailCode + "|" + "";
}
if (contractAdmin.Count() > 0)
{
userList.Add(contractAdmin.First());
mailCode = mailCode + "|" + contractAdmin.First().UserName;
}
else
{
mailCode = mailCode + "|" + "";
}
var mainCoor = from x in Funs.DB.Sys_User where x.UserId == fo.Main_Coordinator && x.Email != null && x.Email != "" select x;
if (mainCoor.Count() > 0)
{
userList.Add(mainCoor.First());
mailCode = mailCode + "|" + mainCoor.First().UserName;
string depId = mainCoor.First().DepartId;
if (!string.IsNullOrEmpty(depId))
{
string dep = BLL.DepartService.GetDepartNameById(depId);
if (dep.Length >= 3)
{
string departName = dep.Substring(0, 3);
var d = BLL.DepartService.GetDepartByName(departName);
departId = d.DepartId;
}
}
}
else
{
mailCode = mailCode + "|" + "";
}
var userRepresentative = from x in Funs.DB.Sys_User where x.UserId == fo.User_Representative && x.Email != null && x.Email != "" select x;
if (userRepresentative.Count() > 0)
{
userList.Add(userRepresentative.First());
mailCode = mailCode + "|" + userRepresentative.First().UserName;
}
else
{
mailCode = mailCode + "|" + "";
}
var cost = from x in Funs.DB.Sys_User
join y in Funs.DB.Sys_Role on x.RoleId equals y.RoleId
join z in Funs.DB.Base_Depart on x.DepartId equals z.DepartId
where (y.RoleName == "Cost Engineer Leader" || y.RoleName == "Contractor_Leader" || z.DepartCode == "CT/K") && x.Email != null && x.Email != ""
select x;
if (cost.Count() > 0)
{
foreach (var c in cost)
{
userList.Add(c);
}
}
mailCode = mailCode + "|" + fo.Expire_Date.Value.ToShortDateString();
var cc = from x in Funs.DB.Sys_User
join y in Funs.DB.Sys_Role on x.RoleId equals y.RoleId
where x.Email != null && x.Email != ""
&& (y.RoleName == "CTE/D Manager" || y.RoleName == "Purchasing Manager" || y.RoleName == "CGP Director" || (y.RoleName == "CT Director" && x.DepartId == departId))
select x;
mailTo = userList.Select(x => x.Email).ToArray();
mailCC = cc.Select(x => x.Email).ToArray();
//var nowDate = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00");
//&& p.CreateTime.Value >= nowDate
var email = Funs.DB.SendEmail.Where(p => p.EmailStatus == "发送成功"
&& p.EmailTile.Contains("到期提醒") && p.EmailTile.Contains(discipline.Discipline.Replace("\r\n", ""))
&& p.EmailTile.Contains(fo.FO_NO) && mailTo.Contains(p.EmailURL)).ToList();
if (email.Count > 0)
{
var emailurl = email.Select(p => p.EmailURL).ToList();
mailTo = mailTo.Where(p => !emailurl.Contains(p)).ToArray();
}
if (mailTo != null && mailTo.Length > 0)
{
var EmailTemplate = Funs.DB.SendEmailTemplate.Where(x => x.EmailName.Contains("ExpiredSoon"));
if (EmailTemplate.Count() > 0)
{
string templetpath = EmailTemplate.Select(p => p.EmailContext).FirstOrDefault();
NameValueCollection myCol = new NameValueCollection();
mailBody = TemplateHelper.BulidByFile2(templetpath, myCol);
IsComplite = MailHelper.SendNetMail1(pops, pops.EmailYx, mailTo, "工程维修施工合同-" + fo.FO_NO + ":" + discipline.Discipline.Replace("\r\n", "") + " 到期提醒", mailBody, mailAttch, mailCode, mailPriority, mailCC, null, out resultMessage);
if (IsComplite)
{
compMsg = compMsg + "合同:" + fo.FO_NO + ",专业:" + discipline.Discipline.Replace("\r\n", "") + ",到期提醒邮件发送成功!";
}
else
{
errorMsg = errorMsg + "合同:" + fo.FO_NO + ",专业:" + discipline.Discipline.Replace("\r\n", "") + ",到期提醒邮件发送失败!";
}
}
}
}
if (compMsg == string.Empty && errorMsg == string.Empty)
{
Alert.ShowInParent("过期提醒邮件已发送!");
}
else
{
Alert.ShowInParent(compMsg + errorMsg);
}
}
else
{
Alert.ShowInParent("无过期提醒邮件需发送!");
return;
}
}
#endregion
#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 Id = Grid1.SelectedRowID;
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("SESRelatedDataEdit.aspx?id={0}", Id, "编辑 - ")));
}
/// <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>
/// <returns></returns>
private bool judgementDelete(string id, bool isShow)
{
string content = string.Empty;
//if (Funs.DB.Sys_User.FirstOrDefault(x => x.RoleId == id) != null)
//{
// content = "This role is already in use in [user information] and cannot be deleted!";
//}
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 btnExport_Click(object sender, EventArgs e)
{
string rootPath = Server.MapPath("~/") + Const.ExcelUrl;
//模板文件
string TempletFileName = rootPath + "FC_List.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("FC_List");
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");
XSSFFont cs_content_Font = (XSSFFont)hssfworkbook.CreateFont(); //创建字体
cs_content_Font.FontName = "sans-serif";//字体
cs_content_Font.FontHeightInPoints = 10; //字体大小
var list = (from x in Funs.DB.View_FC_SESRelatedData orderby x.FC_Status descending select x).ToList();
if (!string.IsNullOrEmpty(hdConstRecords.Text.Trim()))
{
list = list.Where(x => x.ConstRecords == hdConstRecords.Text.Trim()).ToList();
}
if (!string.IsNullOrEmpty(hdFoNo.Text.Trim()))
{
list = list.Where(x => x.FO_NO.Contains(hdFoNo.Text.Trim())).ToList();
}
if (!string.IsNullOrEmpty(hdDiscipline.Text.Trim()))
{
list = list.Where(x => x.DisciplineId == hdDiscipline.Text.Trim()).ToList();
}
if (!string.IsNullOrEmpty(this.hdContractor.Text.Trim()))
{
list = list.Where(x => x.ContractorId.Contains(hdContractor.Text.Trim())).ToList();
}
if (!string.IsNullOrEmpty(this.hdContractAdmin.Text.Trim()))
{
list = list.Where(x => x.Contract_AdminId.Contains(hdContractAdmin.Text.Trim())).ToList();
}
if (!string.IsNullOrEmpty(this.hdBuyer.Text.Trim()))
{
list = list.Where(x => x.Buyer.Contains(hdBuyer.Text.Trim())).ToList();
}
if (!string.IsNullOrEmpty(this.hdMainCoord.Text.Trim()))
{
list = list.Where(x => x.Main_CoordinatorId.Contains(hdMainCoord.Text.Trim())).ToList();
}
if (!string.IsNullOrEmpty(this.hdMCDepartment.Text.Trim()))
{
list = list.Where(x => x.MCDept.Contains(hdMCDepartment.Text.Trim())).ToList();
}
if (!string.IsNullOrEmpty(this.hdFCStatus.Text.Trim()))
{
if (this.hdFCStatus.Text.Trim() == "Valid")
{
list = list.Where(x => x.Expire_Date > DateTime.Now).ToList();
}
else if (this.hdFCStatus.Text.Trim() == "Expired Soon")
{
list = list.Where(x => x.Expire_Date.Value.AddMonths(-6) <= DateTime.Now && x.Expire_Date > DateTime.Now).ToList();
}
else if (this.hdFCStatus.Text.Trim() == "Expired")
{
list = list.Where(x => x.Expire_Date < DateTime.Now).ToList();
}
}
if (list.Count > 0)
{
var rowIndex = 1;
foreach (var itemOver in list)
{
if (reportModel.GetRow(rowIndex) == null) reportModel.CreateRow(rowIndex);
#region
//FO No.
if (reportModel.GetRow(rowIndex).GetCell(0) == null) reportModel.GetRow(rowIndex).CreateCell(0);
reportModel.GetRow(rowIndex).GetCell(0).SetCellValue(itemOver.FO_NO.ToString());
reportModel.GetRow(rowIndex).GetCell(0).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
//Discipline
if (reportModel.GetRow(rowIndex).GetCell(1) == null) reportModel.GetRow(rowIndex).CreateCell(1);
reportModel.GetRow(rowIndex).GetCell(1).SetCellValue(itemOver.Discipline);
//Fo Type
if (reportModel.GetRow(rowIndex).GetCell(2) == null) reportModel.GetRow(rowIndex).CreateCell(2);
reportModel.GetRow(rowIndex).GetCell(2).SetCellValue(itemOver.FOType);
//Pricing Scheme
if (reportModel.GetRow(rowIndex).GetCell(3) == null) reportModel.GetRow(rowIndex).CreateCell(3);
reportModel.GetRow(rowIndex).GetCell(3).SetCellValue(itemOver.Pricing_Scheme);
//Contractor
if (reportModel.GetRow(rowIndex).GetCell(4) == null) reportModel.GetRow(rowIndex).CreateCell(4);
reportModel.GetRow(rowIndex).GetCell(4).SetCellValue(itemOver.Contractor);
//Vendor NO.
if (reportModel.GetRow(rowIndex).GetCell(5) == null) reportModel.GetRow(rowIndex).CreateCell(5);
reportModel.GetRow(rowIndex).GetCell(5).SetCellValue(itemOver.Vendor_NO);
//Item
if (reportModel.GetRow(rowIndex).GetCell(6) == null) reportModel.GetRow(rowIndex).CreateCell(6);
reportModel.GetRow(rowIndex).GetCell(6).SetCellValue(itemOver.Item);
//Discipline Category
if (reportModel.GetRow(rowIndex).GetCell(7) == null) reportModel.GetRow(rowIndex).CreateCell(7);
reportModel.GetRow(rowIndex).GetCell(7).SetCellValue(itemOver.DisciplineCategory);
//Currency
if (reportModel.GetRow(rowIndex).GetCell(8) == null) reportModel.GetRow(rowIndex).CreateCell(8);
reportModel.GetRow(rowIndex).GetCell(8).SetCellValue(itemOver.Currency);
//Material Group
if (reportModel.GetRow(rowIndex).GetCell(9) == null) reportModel.GetRow(rowIndex).CreateCell(9);
reportModel.GetRow(rowIndex).GetCell(9).SetCellValue(itemOver.Material_Group);
//Purchase Group
if (reportModel.GetRow(rowIndex).GetCell(10) == null) reportModel.GetRow(rowIndex).CreateCell(10);
reportModel.GetRow(rowIndex).GetCell(10).SetCellValue(itemOver.Purchase_Group);
//Cost Element
if (reportModel.GetRow(rowIndex).GetCell(11) == null) reportModel.GetRow(rowIndex).CreateCell(11);
reportModel.GetRow(rowIndex).GetCell(11).SetCellValue(itemOver.Cost_Element);
//Service Type
if (reportModel.GetRow(rowIndex).GetCell(12) == null) reportModel.GetRow(rowIndex).CreateCell(12);
reportModel.GetRow(rowIndex).GetCell(12).SetCellValue(itemOver.Type);
//Contract Admin
if (reportModel.GetRow(rowIndex).GetCell(13) == null) reportModel.GetRow(rowIndex).CreateCell(13);
reportModel.GetRow(rowIndex).GetCell(13).SetCellValue(itemOver.Contract_Admin);
//Cost_Checker
if (reportModel.GetRow(rowIndex).GetCell(14) == null) reportModel.GetRow(rowIndex).CreateCell(14);
reportModel.GetRow(rowIndex).GetCell(14).SetCellValue(itemOver.Cost_Checker);
//Buyer
if (reportModel.GetRow(rowIndex).GetCell(15) == null) reportModel.GetRow(rowIndex).CreateCell(15);
reportModel.GetRow(rowIndex).GetCell(15).SetCellValue(itemOver.Buyer);
//Main Coordinator
if (reportModel.GetRow(rowIndex).GetCell(16) == null) reportModel.GetRow(rowIndex).CreateCell(16);
reportModel.GetRow(rowIndex).GetCell(16).SetCellValue(itemOver.Main_Coordinator);
//M.C.Dept.
if (reportModel.GetRow(rowIndex).GetCell(17) == null) reportModel.GetRow(rowIndex).CreateCell(17);
reportModel.GetRow(rowIndex).GetCell(17).SetCellValue(itemOver.MCDept);
//User Representative
if (reportModel.GetRow(rowIndex).GetCell(18) == null) reportModel.GetRow(rowIndex).CreateCell(18);
reportModel.GetRow(rowIndex).GetCell(18).SetCellValue(itemOver.User_Representative);
//Validate Date
if (reportModel.GetRow(rowIndex).GetCell(19) == null) reportModel.GetRow(rowIndex).CreateCell(19);
if (itemOver.Validate_Date.HasValue)
{
reportModel.GetRow(rowIndex).GetCell(19).SetCellValue((DateTime)itemOver.Validate_Date.Value); //string.Format("{0:yyyy/MM/dd}", itemOver.Validate_Date)
reportModel.GetRow(rowIndex).GetCell(19).CellStyle = styleDate;
}
//Expire Date
if (reportModel.GetRow(rowIndex).GetCell(20) == null) reportModel.GetRow(rowIndex).CreateCell(20);
if (itemOver.Expire_Date.HasValue)
{
reportModel.GetRow(rowIndex).GetCell(20).SetCellValue((DateTime)itemOver.Expire_Date.Value); // string.Format("{0:yyyy/MM/dd}", itemOver.Expire_Date)
reportModel.GetRow(rowIndex).GetCell(20).CellStyle = styleDate;
}
//FC Status
if (reportModel.GetRow(rowIndex).GetCell(21) == null) reportModel.GetRow(rowIndex).CreateCell(21);
reportModel.GetRow(rowIndex).GetCell(21).SetCellValue(itemOver.FC_Status);
//Contact Person
if (reportModel.GetRow(rowIndex).GetCell(22) == null) reportModel.GetRow(rowIndex).CreateCell(22);
reportModel.GetRow(rowIndex).GetCell(22).SetCellValue(itemOver.Contract_Person);
//Tel.
if (reportModel.GetRow(rowIndex).GetCell(23) == null) reportModel.GetRow(rowIndex).CreateCell(23);
reportModel.GetRow(rowIndex).GetCell(23).SetCellValue(itemOver.Contract_Tel);
// Allocation
if (reportModel.GetRow(rowIndex).GetCell(24) == null) reportModel.GetRow(rowIndex).CreateCell(24);
reportModel.GetRow(rowIndex).GetCell(24).SetCellValue(itemOver.Allocation != null ? itemOver.Allocation : "");
//Volume Allocation
if (reportModel.GetRow(rowIndex).GetCell(25) == null) reportModel.GetRow(rowIndex).CreateCell(25);
reportModel.GetRow(rowIndex).GetCell(25).SetCellValue(itemOver.VolumeAllocation != null ? ((double)itemOver.VolumeAllocation.Value * 100.0).ToString("0.00") + "%" : "");
//Contract Budget
if (reportModel.GetRow(rowIndex).GetCell(26) == null) reportModel.GetRow(rowIndex).CreateCell(26);
reportModel.GetRow(rowIndex).GetCell(26).SetCellValue(itemOver.Actual_Budget != null ? (double)itemOver.Actual_Budget.Value : 0);
reportModel.GetRow(rowIndex).GetCell(26).CellStyle = styleQfw;
//Connected Transaction
if (reportModel.GetRow(rowIndex).GetCell(27) == null) reportModel.GetRow(rowIndex).CreateCell(27);
reportModel.GetRow(rowIndex).GetCell(27).SetCellValue(itemOver.Connectedtransaction);
//Checked Value
if (reportModel.GetRow(rowIndex).GetCell(28) == null) reportModel.GetRow(rowIndex).CreateCell(28);
reportModel.GetRow(rowIndex).GetCell(28).SetCellValue(itemOver.CheckedValue != null ? (double)itemOver.CheckedValue.Value : 0);
reportModel.GetRow(rowIndex).GetCell(28).CellStyle = styleQfw;
////Remaining Budget
//if (reportModel.GetRow(rowIndex).GetCell(29) == null) reportModel.GetRow(rowIndex).CreateCell(29);
//reportModel.GetRow(rowIndex).GetCell(29).SetCellValue(itemOver.RemainingBudget != null ? (double)itemOver.RemainingBudget.Value : 0);
//reportModel.GetRow(rowIndex).GetCell(29).CellStyle = styleQfw;
////Remaining Budget%
//if (reportModel.GetRow(rowIndex).GetCell(30) == null) reportModel.GetRow(rowIndex).CreateCell(30);
//reportModel.GetRow(rowIndex).GetCell(30).SetCellValue(itemOver.RemainingBudgetRate);
//Remaining Duration%
if (reportModel.GetRow(rowIndex).GetCell(29) == null) reportModel.GetRow(rowIndex).CreateCell(29);
reportModel.GetRow(rowIndex).GetCell(29).SetCellValue(itemOver.RemainingDuration);
//Email
if (reportModel.GetRow(rowIndex).GetCell(30) == null) reportModel.GetRow(rowIndex).CreateCell(30);
reportModel.GetRow(rowIndex).GetCell(30).SetCellValue(itemOver.Email);
//主要负责人
if (reportModel.GetRow(rowIndex).GetCell(31) == null) reportModel.GetRow(rowIndex).CreateCell(31);
reportModel.GetRow(rowIndex).GetCell(31).SetCellValue(itemOver.MainHead);
//主要负责人联系方式
if (reportModel.GetRow(rowIndex).GetCell(32) == null) reportModel.GetRow(rowIndex).CreateCell(32);
reportModel.GetRow(rowIndex).GetCell(32).SetCellValue(itemOver.MainHeadContact);
//安全负责人
if (reportModel.GetRow(rowIndex).GetCell(33) == null) reportModel.GetRow(rowIndex).CreateCell(33);
reportModel.GetRow(rowIndex).GetCell(33).SetCellValue(itemOver.SafetyOfficer);
//安全负责人联系方式
if (reportModel.GetRow(rowIndex).GetCell(34) == null) reportModel.GetRow(rowIndex).CreateCell(34);
reportModel.GetRow(rowIndex).GetCell(34).SetCellValue(itemOver.SafetyOfficerContact);
//项目经理
if (reportModel.GetRow(rowIndex).GetCell(35) == null) reportModel.GetRow(rowIndex).CreateCell(35);
reportModel.GetRow(rowIndex).GetCell(35).SetCellValue(itemOver.ProjectManager);
//项目经理联系方式
if (reportModel.GetRow(rowIndex).GetCell(36) == null) reportModel.GetRow(rowIndex).CreateCell(36);
reportModel.GetRow(rowIndex).GetCell(36).SetCellValue(itemOver.ProjectManagerContact);
//Const.Records
if (reportModel.GetRow(rowIndex).GetCell(37) == null) reportModel.GetRow(rowIndex).CreateCell(37);
reportModel.GetRow(rowIndex).GetCell(37).SetCellValue(itemOver.ConstRecords);
//Const.Records
if (reportModel.GetRow(rowIndex).GetCell(38) == null) reportModel.GetRow(rowIndex).CreateCell(38);
reportModel.GetRow(rowIndex).GetCell(38).SetCellValue(itemOver.Remark);
#endregion
rowIndex++;
}
}
#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=FC_List" + 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();
}
// 人员导出
protected void btnExport1_Click(object sender, EventArgs e)
{
string rootPath = Server.MapPath("~/") + Const.ExcelUrl;
//模板文件
string TempletFileName = rootPath + "FC_Contractor_Contact_Person_List.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");
XSSFFont cs_content_Font = (XSSFFont)hssfworkbook.CreateFont(); //创建字体
cs_content_Font.FontName = "sans-serif";//字体
cs_content_Font.FontHeightInPoints = 10; //字体大小
var list = (from x in Funs.DB.View_FC_SESRelatedData where x.Type == "现场服务类" && (x.FC_Status == "Valid" || x.FC_Status == "Expired Soon") orderby x.FO_NO descending select x).ToList();
if (!string.IsNullOrEmpty(hdConstRecords.Text.Trim()))
{
list = list.Where(x => x.ConstRecords == hdConstRecords.Text.Trim()).ToList();
}
if (!string.IsNullOrEmpty(hdFoNo.Text.Trim()))
{
list = list.Where(x => x.FO_NO.Contains(hdFoNo.Text.Trim())).ToList();
}
if (!string.IsNullOrEmpty(hdDiscipline.Text.Trim()))
{
list = list.Where(x => x.DisciplineId == hdDiscipline.Text.Trim()).ToList();
}
if (!string.IsNullOrEmpty(this.hdContractor.Text.Trim()))
{
list = list.Where(x => x.ContractorId.Contains(hdContractor.Text.Trim())).ToList();
}
if (!string.IsNullOrEmpty(this.hdContractAdmin.Text.Trim()))
{
list = list.Where(x => x.Contract_AdminId.Contains(hdContractAdmin.Text.Trim())).ToList();
}
if (!string.IsNullOrEmpty(this.hdBuyer.Text.Trim()))
{
list = list.Where(x => x.Buyer.Contains(hdBuyer.Text.Trim())).ToList();
}
if (!string.IsNullOrEmpty(this.hdMainCoord.Text.Trim()))
{
list = list.Where(x => x.Main_CoordinatorId.Contains(hdMainCoord.Text.Trim())).ToList();
}
if (!string.IsNullOrEmpty(this.hdMCDepartment.Text.Trim()))
{
list = list.Where(x => x.MCDept.Contains(hdMCDepartment.Text.Trim())).ToList();
}
if (!string.IsNullOrEmpty(this.hdFCStatus.Text.Trim()))
{
if (this.hdFCStatus.Text.Trim() == "Valid")
{
list = list.Where(x => x.Expire_Date > DateTime.Now).ToList();
}
else if (this.hdFCStatus.Text.Trim() == "Expired Soon")
{
list = list.Where(x => x.Expire_Date.Value.AddMonths(-6) <= DateTime.Now && x.Expire_Date > DateTime.Now).ToList();
}
else if (this.hdFCStatus.Text.Trim() == "Expired")
{
list = list.Where(x => x.Expire_Date < DateTime.Now).ToList();
}
}
if (list.Count > 0)
{
var rowIndex = 1;
foreach (var itemOver in list)
{
if (reportModel.GetRow(rowIndex) == null) reportModel.CreateRow(rowIndex);
#region
//Discipline
if (reportModel.GetRow(rowIndex).GetCell(0) == null) reportModel.GetRow(rowIndex).CreateCell(0);
reportModel.GetRow(rowIndex).GetCell(0).SetCellValue(itemOver.Discipline);
reportModel.GetRow(rowIndex).GetCell(0).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
//Contractor
if (reportModel.GetRow(rowIndex).GetCell(1) == null) reportModel.GetRow(rowIndex).CreateCell(1);
reportModel.GetRow(rowIndex).GetCell(1).SetCellValue(itemOver.Contractor);
reportModel.GetRow(rowIndex).GetCell(1).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
//FO No.
if (reportModel.GetRow(rowIndex).GetCell(2) == null) reportModel.GetRow(rowIndex).CreateCell(2);
reportModel.GetRow(rowIndex).GetCell(2).SetCellValue(itemOver.FO_NO.ToString());
reportModel.GetRow(rowIndex).GetCell(2).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
//Contract Admin
if (reportModel.GetRow(rowIndex).GetCell(3) == null) reportModel.GetRow(rowIndex).CreateCell(3);
reportModel.GetRow(rowIndex).GetCell(3).SetCellValue(itemOver.Contract_Admin);
reportModel.GetRow(rowIndex).GetCell(3).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
//Buyer
if (reportModel.GetRow(rowIndex).GetCell(4) == null) reportModel.GetRow(rowIndex).CreateCell(4);
reportModel.GetRow(rowIndex).GetCell(4).SetCellValue(itemOver.Buyer);
reportModel.GetRow(rowIndex).GetCell(4).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
//Main Coordinator
if (reportModel.GetRow(rowIndex).GetCell(5) == null) reportModel.GetRow(rowIndex).CreateCell(5);
reportModel.GetRow(rowIndex).GetCell(5).SetCellValue(itemOver.Main_Coordinator);
reportModel.GetRow(rowIndex).GetCell(5).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
//User Representative
if (reportModel.GetRow(rowIndex).GetCell(6) == null) reportModel.GetRow(rowIndex).CreateCell(6);
reportModel.GetRow(rowIndex).GetCell(6).SetCellValue(itemOver.User_Representative);
reportModel.GetRow(rowIndex).GetCell(6).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
//Service Type
if (reportModel.GetRow(rowIndex).GetCell(7) == null) reportModel.GetRow(rowIndex).CreateCell(7);
reportModel.GetRow(rowIndex).GetCell(7).SetCellValue(itemOver.Type);
reportModel.GetRow(rowIndex).GetCell(7).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
//合同联系人
if (reportModel.GetRow(rowIndex).GetCell(8) == null) reportModel.GetRow(rowIndex).CreateCell(8);
reportModel.GetRow(rowIndex).GetCell(8).SetCellValue(itemOver.Contract_Person);
reportModel.GetRow(rowIndex).GetCell(8).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
//联系方式
if (reportModel.GetRow(rowIndex).GetCell(9) == null) reportModel.GetRow(rowIndex).CreateCell(9);
reportModel.GetRow(rowIndex).GetCell(9).SetCellValue(itemOver.Contract_Tel);
reportModel.GetRow(rowIndex).GetCell(9).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
//eMail
if (reportModel.GetRow(rowIndex).GetCell(10) == null) reportModel.GetRow(rowIndex).CreateCell(10);
reportModel.GetRow(rowIndex).GetCell(10).SetCellValue(itemOver.Email);
reportModel.GetRow(rowIndex).GetCell(10).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
//主要负责人
if (reportModel.GetRow(rowIndex).GetCell(11) == null) reportModel.GetRow(rowIndex).CreateCell(11);
reportModel.GetRow(rowIndex).GetCell(11).SetCellValue(itemOver.MainHead);
reportModel.GetRow(rowIndex).GetCell(11).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
//主要负责人联系方式
if (reportModel.GetRow(rowIndex).GetCell(12) == null) reportModel.GetRow(rowIndex).CreateCell(12);
reportModel.GetRow(rowIndex).GetCell(12).SetCellValue(itemOver.MainHeadContact);
reportModel.GetRow(rowIndex).GetCell(12).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
//安全负责人
if (reportModel.GetRow(rowIndex).GetCell(13) == null) reportModel.GetRow(rowIndex).CreateCell(13);
reportModel.GetRow(rowIndex).GetCell(13).SetCellValue(itemOver.SafetyOfficer);
reportModel.GetRow(rowIndex).GetCell(13).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
//安全负责人联系方式
if (reportModel.GetRow(rowIndex).GetCell(14) == null) reportModel.GetRow(rowIndex).CreateCell(14);
reportModel.GetRow(rowIndex).GetCell(14).SetCellValue(itemOver.SafetyOfficerContact);
reportModel.GetRow(rowIndex).GetCell(14).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
//项目经理
if (reportModel.GetRow(rowIndex).GetCell(15) == null) reportModel.GetRow(rowIndex).CreateCell(15);
reportModel.GetRow(rowIndex).GetCell(15).SetCellValue(itemOver.ProjectManager);
reportModel.GetRow(rowIndex).GetCell(15).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
//项目经理联系方式
if (reportModel.GetRow(rowIndex).GetCell(16) == null) reportModel.GetRow(rowIndex).CreateCell(16);
reportModel.GetRow(rowIndex).GetCell(16).SetCellValue(itemOver.ProjectManagerContact);
reportModel.GetRow(rowIndex).GetCell(16).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
#endregion
rowIndex++;
}
}
#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=FC_Contractor_Contact_Person_List" + 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();
}
protected void btnFoExport_Click(object sender, EventArgs e)
{
string rootPath = Server.MapPath("~/") + Const.ExcelUrl;
//模板文件
string TempletFileName = rootPath + "FO Report.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 FO Report
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");
XSSFFont cs_content_Font = (XSSFFont)hssfworkbook.CreateFont(); //创建字体
cs_content_Font.FontName = "sans-serif";//字体
cs_content_Font.FontHeightInPoints = 10; //字体大小
var list = (from x in Funs.DB.View_FC_Report orderby x.FC_Status descending select x).ToList();
if (!string.IsNullOrEmpty(hdConstRecords.Text.Trim()))
{
list = list.Where(x => x.ConstRecords == hdConstRecords.Text.Trim()).ToList();
}
if (!string.IsNullOrEmpty(hdFoNo.Text.Trim()))
{
list = list.Where(x => x.FO_NO.Contains(hdFoNo.Text.Trim())).ToList();
}
if (!string.IsNullOrEmpty(hdDiscipline.Text.Trim()))
{
list = list.Where(x => x.DisciplineId == hdDiscipline.Text.Trim()).ToList();
}
if (!string.IsNullOrEmpty(this.hdContractor.Text.Trim()))
{
list = list.Where(x => x.ContractorId.Contains(hdContractor.Text.Trim())).ToList();
}
if (!string.IsNullOrEmpty(this.hdContractAdmin.Text.Trim()))
{
list = list.Where(x => x.Contract_AdminId.Contains(hdContractAdmin.Text.Trim())).ToList();
}
if (!string.IsNullOrEmpty(this.hdBuyer.Text.Trim()))
{
list = list.Where(x => x.Buyer.Contains(hdBuyer.Text.Trim())).ToList();
}
if (!string.IsNullOrEmpty(this.hdMainCoord.Text.Trim()))
{
list = list.Where(x => x.Main_CoordinatorId.Contains(hdMainCoord.Text.Trim())).ToList();
}
if (!string.IsNullOrEmpty(this.hdMCDepartment.Text.Trim()))
{
list = list.Where(x => x.MCDept.Contains(hdMCDepartment.Text.Trim())).ToList();
}
if (!string.IsNullOrEmpty(this.hdFCStatus.Text.Trim()))
{
if (this.hdFCStatus.Text.Trim() == "Valid")
{
list = list.Where(x => x.Expire_Date > DateTime.Now).ToList();
}
else if (this.hdFCStatus.Text.Trim() == "Expired Soon")
{
list = list.Where(x => x.Expire_Date.Value.AddMonths(-6) <= DateTime.Now && x.Expire_Date > DateTime.Now).ToList();
}
else if (this.hdFCStatus.Text.Trim() == "Expired")
{
list = list.Where(x => x.Expire_Date < DateTime.Now).ToList();
}
}
if (list.Count > 0)
{
var rowIndex = 1;
foreach (var itemOver in list)
{
if (reportModel.GetRow(rowIndex) == null) reportModel.CreateRow(rowIndex);
#region
//FO No.
if (reportModel.GetRow(rowIndex).GetCell(0) == null) reportModel.GetRow(rowIndex).CreateCell(0);
reportModel.GetRow(rowIndex).GetCell(0).SetCellValue(itemOver.FO_NO.ToString());
reportModel.GetRow(rowIndex).GetCell(0).CellStyle.SetFont(cs_content_Font);//将字体绑定到样式
//Contractor
if (reportModel.GetRow(rowIndex).GetCell(1) == null) reportModel.GetRow(rowIndex).CreateCell(1);
reportModel.GetRow(rowIndex).GetCell(1).SetCellValue(itemOver.Contractor);
//Discipline
if (reportModel.GetRow(rowIndex).GetCell(2) == null) reportModel.GetRow(rowIndex).CreateCell(2);
reportModel.GetRow(rowIndex).GetCell(2).SetCellValue(itemOver.Discipline);
//Contract_Admin
if (reportModel.GetRow(rowIndex).GetCell(3) == null) reportModel.GetRow(rowIndex).CreateCell(3);
reportModel.GetRow(rowIndex).GetCell(3).SetCellValue(itemOver.Contract_Admin);
//Buyer
if (reportModel.GetRow(rowIndex).GetCell(4) == null) reportModel.GetRow(rowIndex).CreateCell(4);
reportModel.GetRow(rowIndex).GetCell(4).SetCellValue(itemOver.Buyer);
//Main_Coordinator
if (reportModel.GetRow(rowIndex).GetCell(5) == null) reportModel.GetRow(rowIndex).CreateCell(5);
reportModel.GetRow(rowIndex).GetCell(5).SetCellValue(itemOver.Main_Coordinator);
//M.C.Dept
if (reportModel.GetRow(rowIndex).GetCell(6) == null) reportModel.GetRow(rowIndex).CreateCell(6);
reportModel.GetRow(rowIndex).GetCell(6).SetCellValue(itemOver.MCDept);
//Budget
if (reportModel.GetRow(rowIndex).GetCell(7) == null) reportModel.GetRow(rowIndex).CreateCell(7);
reportModel.GetRow(rowIndex).GetCell(7).SetCellValue(itemOver.Budget != null ? (double)itemOver.Budget.Value : 0);
//Actual_Cost
if (reportModel.GetRow(rowIndex).GetCell(8) == null) reportModel.GetRow(rowIndex).CreateCell(8);
reportModel.GetRow(rowIndex).GetCell(8).SetCellValue(itemOver.Actual_Cost != null ? (double)itemOver.Actual_Cost.Value : 0);
//Commitment
if (reportModel.GetRow(rowIndex).GetCell(9) == null) reportModel.GetRow(rowIndex).CreateCell(9);
reportModel.GetRow(rowIndex).GetCell(9).SetCellValue(itemOver.Commitment != null ? (double)itemOver.Commitment.Value : 0);
//Spending_commitment
if (reportModel.GetRow(rowIndex).GetCell(10) == null) reportModel.GetRow(rowIndex).CreateCell(10);
reportModel.GetRow(rowIndex).GetCell(10).SetCellValue(itemOver.Spending_commitment != null ? (double)itemOver.Spending_commitment.Value : 0);
//Validate Date
if (reportModel.GetRow(rowIndex).GetCell(11) == null) reportModel.GetRow(rowIndex).CreateCell(11);
if (itemOver.Validate_Date.HasValue)
{
reportModel.GetRow(rowIndex).GetCell(11).SetCellValue((DateTime)itemOver.Validate_Date.Value); //string.Format("{0:yyyy/MM/dd}", itemOver.Validate_Date)
reportModel.GetRow(rowIndex).GetCell(11).CellStyle = styleDate;
}
//Expire Date
if (reportModel.GetRow(rowIndex).GetCell(12) == null) reportModel.GetRow(rowIndex).CreateCell(12);
if (itemOver.Expire_Date.HasValue)
{
reportModel.GetRow(rowIndex).GetCell(12).SetCellValue((DateTime)itemOver.Expire_Date.Value); // string.Format("{0:yyyy/MM/dd}", itemOver.Expire_Date)
reportModel.GetRow(rowIndex).GetCell(12).CellStyle = styleDate;
}
//UnusedBudget
if (reportModel.GetRow(rowIndex).GetCell(13) == null) reportModel.GetRow(rowIndex).CreateCell(13);
reportModel.GetRow(rowIndex).GetCell(13).SetCellValue(itemOver.UnusedBudget != null ? (double)itemOver.UnusedBudget.Value : 0);
//UnusedBudgetRate
if (reportModel.GetRow(rowIndex).GetCell(14) == null) reportModel.GetRow(rowIndex).CreateCell(14);
reportModel.GetRow(rowIndex).GetCell(14).SetCellValue(itemOver.UnusedBudgetRate);
//Volume_Allocation
if (reportModel.GetRow(rowIndex).GetCell(15) == null) reportModel.GetRow(rowIndex).CreateCell(15);
reportModel.GetRow(rowIndex).GetCell(15).SetCellValue(itemOver.Volume_Allocation);
//Target_Volume
if (reportModel.GetRow(rowIndex).GetCell(16) == null) reportModel.GetRow(rowIndex).CreateCell(16);
reportModel.GetRow(rowIndex).GetCell(16).SetCellValue(itemOver.Target_Volume);
//Actual_Volume
if (reportModel.GetRow(rowIndex).GetCell(17) == null) reportModel.GetRow(rowIndex).CreateCell(17);
reportModel.GetRow(rowIndex).GetCell(17).SetCellValue(itemOver.Actual_Volume);
//Volume_Deviation
if (reportModel.GetRow(rowIndex).GetCell(18) == null) reportModel.GetRow(rowIndex).CreateCell(18);
reportModel.GetRow(rowIndex).GetCell(18).SetCellValue(itemOver.Volume_Deviation);
//Volume_allocation_deviation
if (reportModel.GetRow(rowIndex).GetCell(19) == null) reportModel.GetRow(rowIndex).CreateCell(19);
reportModel.GetRow(rowIndex).GetCell(19).SetCellValue(itemOver.Volume_allocation_deviation);
//Budget_Running_out
if (reportModel.GetRow(rowIndex).GetCell(20) == null) reportModel.GetRow(rowIndex).CreateCell(20);
reportModel.GetRow(rowIndex).GetCell(20).SetCellValue(itemOver.Budget_Running_out);
//Budget_progress_VS_Time
if (reportModel.GetRow(rowIndex).GetCell(21) == null) reportModel.GetRow(rowIndex).CreateCell(21);
reportModel.GetRow(rowIndex).GetCell(21).SetCellValue(itemOver.Budget_progress_VS_Time);
#endregion
rowIndex++;
}
}
#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=FO Report" + 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();
}
protected void btnNCRExport_Click(object sender, EventArgs e)
{
string rootPath = Server.MapPath("~/") + Const.ExcelUrl;
//导出文件
string filePath = rootPath + DateTime.Now.ToString("yyyyMMddhhmmss") + "\\";
if (!Directory.Exists(filePath))
{
Directory.CreateDirectory(filePath);
}
string ReportFileName = filePath + "out1.xlsx";
int rowIndex = 0;
XSSFWorkbook hssfworkbook = new XSSFWorkbook();
//XSSFSheet ws = (XSSFSheet)hssfworkbook.CreateSheet("NCR报表");
string reportName = string.Empty;
//var foList = from x in Funs.DB.FC_SESRelatedData orderby x.FC_Status descending select x;
//var fileType = from x in Funs.DB.Base_FileType orderby x.FileType select x;
if (drpExportFileType.SelectedValue != Const._Null)
{
XSSFSheet ws = (XSSFSheet)hssfworkbook.CreateSheet(drpExportFileType.SelectedText);
reportName = drpExportFileType.SelectedText;
ws.SetColumnWidth(0, (12 * 256));
ws.SetColumnWidth(1, (15 * 256));
ws.SetColumnWidth(2, (28 * 256));
ws.SetColumnWidth(3, (20 * 256));
ws.SetColumnWidth(4, (50 * 256));
ws.SetColumnWidth(5, (20 * 256));
ws.SetColumnWidth(6, (20 * 256));
//var fy = BLL.FileTypeService.GetFileTypeById(drpExportFileType.SelectedValue);
// 头部 第0行
if (this.drpExportFileType.SelectedText == "合同续签")
{
if (ws.GetRow(rowIndex) == null) ws.CreateRow(rowIndex);
if (ws.GetRow(rowIndex).GetCell(0) == null) ws.GetRow(rowIndex).CreateCell(0);
ws.GetRow(rowIndex).GetCell(0).SetCellValue("FO合同号");
if (ws.GetRow(rowIndex).GetCell(1) == null) ws.GetRow(rowIndex).CreateCell(1);
ws.GetRow(rowIndex).GetCell(1).SetCellValue("文件类型");
if (ws.GetRow(rowIndex).GetCell(2) == null) ws.GetRow(rowIndex).CreateCell(2);
ws.GetRow(rowIndex).GetCell(2).SetCellValue("文件编号");
if (ws.GetRow(rowIndex).GetCell(3) == null) ws.GetRow(rowIndex).CreateCell(3);
ws.GetRow(rowIndex).GetCell(3).SetCellValue("上传人");
if (ws.GetRow(rowIndex).GetCell(4) == null) ws.GetRow(rowIndex).CreateCell(4);
ws.GetRow(rowIndex).GetCell(4).SetCellValue("承包商名称");
if (ws.GetRow(rowIndex).GetCell(5) == null) ws.GetRow(rowIndex).CreateCell(5);
ws.GetRow(rowIndex).GetCell(5).SetCellValue("上一轮合同号");
if (ws.GetRow(rowIndex).GetCell(6) == null) ws.GetRow(rowIndex).CreateCell(6);
ws.GetRow(rowIndex).GetCell(6).SetCellValue("备注");
}
else if (this.drpExportFileType.SelectedText == "费用增补")
{
if (ws.GetRow(rowIndex) == null) ws.CreateRow(rowIndex);
if (ws.GetRow(rowIndex).GetCell(0) == null) ws.GetRow(rowIndex).CreateCell(0);
ws.GetRow(rowIndex).GetCell(0).SetCellValue("合同号");
if (ws.GetRow(rowIndex).GetCell(1) == null) ws.GetRow(rowIndex).CreateCell(1);
ws.GetRow(rowIndex).GetCell(1).SetCellValue("文件类型");
if (ws.GetRow(rowIndex).GetCell(2) == null) ws.GetRow(rowIndex).CreateCell(2);
ws.GetRow(rowIndex).GetCell(2).SetCellValue("文件编号");
if (ws.GetRow(rowIndex).GetCell(3) == null) ws.GetRow(rowIndex).CreateCell(3);
ws.GetRow(rowIndex).GetCell(3).SetCellValue("上传人");
if (ws.GetRow(rowIndex).GetCell(4) == null) ws.GetRow(rowIndex).CreateCell(4);
ws.GetRow(rowIndex).GetCell(4).SetCellValue("承包商名称");
if (ws.GetRow(rowIndex).GetCell(5) == null) ws.GetRow(rowIndex).CreateCell(5);
ws.GetRow(rowIndex).GetCell(5).SetCellValue("Initial budget");
if (ws.GetRow(rowIndex).GetCell(6) == null) ws.GetRow(rowIndex).CreateCell(6);
ws.GetRow(rowIndex).GetCell(6).SetCellValue("Supplemented Budget");
if (ws.GetRow(rowIndex).GetCell(7) == null) ws.GetRow(rowIndex).CreateCell(7);
ws.GetRow(rowIndex).GetCell(7).SetCellValue("Total Budget");
if (ws.GetRow(rowIndex).GetCell(8) == null) ws.GetRow(rowIndex).CreateCell(8);
ws.GetRow(rowIndex).GetCell(8).SetCellValue("备注");
}
else if (this.drpExportFileType.SelectedText == "份额变更")
{
if (ws.GetRow(rowIndex) == null) ws.CreateRow(rowIndex);
if (ws.GetRow(rowIndex).GetCell(0) == null) ws.GetRow(rowIndex).CreateCell(0);
ws.GetRow(rowIndex).GetCell(0).SetCellValue("合同号");
if (ws.GetRow(rowIndex).GetCell(1) == null) ws.GetRow(rowIndex).CreateCell(1);
ws.GetRow(rowIndex).GetCell(1).SetCellValue("文件类型");
if (ws.GetRow(rowIndex).GetCell(2) == null) ws.GetRow(rowIndex).CreateCell(2);
ws.GetRow(rowIndex).GetCell(2).SetCellValue("文件编号");
if (ws.GetRow(rowIndex).GetCell(3) == null) ws.GetRow(rowIndex).CreateCell(3);
ws.GetRow(rowIndex).GetCell(3).SetCellValue("上传人");
if (ws.GetRow(rowIndex).GetCell(4) == null) ws.GetRow(rowIndex).CreateCell(4);
ws.GetRow(rowIndex).GetCell(4).SetCellValue("承包商名称");
if (ws.GetRow(rowIndex).GetCell(5) == null) ws.GetRow(rowIndex).CreateCell(5);
ws.GetRow(rowIndex).GetCell(5).SetCellValue("Initial budget");
if (ws.GetRow(rowIndex).GetCell(6) == null) ws.GetRow(rowIndex).CreateCell(6);
ws.GetRow(rowIndex).GetCell(6).SetCellValue("Current allocation(%)");
if (ws.GetRow(rowIndex).GetCell(7) == null) ws.GetRow(rowIndex).CreateCell(7);
ws.GetRow(rowIndex).GetCell(7).SetCellValue("备注");
}
else if (this.drpExportFileType.SelectedText == "短期续延")
{
if (ws.GetRow(rowIndex) == null) ws.CreateRow(rowIndex);
if (ws.GetRow(rowIndex).GetCell(0) == null) ws.GetRow(rowIndex).CreateCell(0);
ws.GetRow(rowIndex).GetCell(0).SetCellValue("合同号");
if (ws.GetRow(rowIndex).GetCell(1) == null) ws.GetRow(rowIndex).CreateCell(1);
ws.GetRow(rowIndex).GetCell(1).SetCellValue("文件类型");
if (ws.GetRow(rowIndex).GetCell(2) == null) ws.GetRow(rowIndex).CreateCell(2);
ws.GetRow(rowIndex).GetCell(2).SetCellValue("文件编号");
if (ws.GetRow(rowIndex).GetCell(3) == null) ws.GetRow(rowIndex).CreateCell(3);
ws.GetRow(rowIndex).GetCell(3).SetCellValue("上传人");
if (ws.GetRow(rowIndex).GetCell(4) == null) ws.GetRow(rowIndex).CreateCell(4);
ws.GetRow(rowIndex).GetCell(4).SetCellValue("承包商名称");
if (ws.GetRow(rowIndex).GetCell(5) == null) ws.GetRow(rowIndex).CreateCell(5);
ws.GetRow(rowIndex).GetCell(5).SetCellValue("开始时间");
if (ws.GetRow(rowIndex).GetCell(6) == null) ws.GetRow(rowIndex).CreateCell(6);
ws.GetRow(rowIndex).GetCell(6).SetCellValue("结束时间");
if (ws.GetRow(rowIndex).GetCell(7) == null) ws.GetRow(rowIndex).CreateCell(7);
ws.GetRow(rowIndex).GetCell(7).SetCellValue("备注");
}
else if (this.drpExportFileType.SelectedText == "承包商EHSQ审计报告")
{
if (ws.GetRow(rowIndex) == null) ws.CreateRow(rowIndex);
if (ws.GetRow(rowIndex).GetCell(0) == null) ws.GetRow(rowIndex).CreateCell(0);
ws.GetRow(rowIndex).GetCell(0).SetCellValue("合同号");
if (ws.GetRow(rowIndex).GetCell(1) == null) ws.GetRow(rowIndex).CreateCell(1);
ws.GetRow(rowIndex).GetCell(1).SetCellValue("审计编号");
if (ws.GetRow(rowIndex).GetCell(2) == null) ws.GetRow(rowIndex).CreateCell(2);
ws.GetRow(rowIndex).GetCell(2).SetCellValue("承包商类型");
if (ws.GetRow(rowIndex).GetCell(3) == null) ws.GetRow(rowIndex).CreateCell(3);
ws.GetRow(rowIndex).GetCell(3).SetCellValue("承包商名称");
if (ws.GetRow(rowIndex).GetCell(4) == null) ws.GetRow(rowIndex).CreateCell(4);
ws.GetRow(rowIndex).GetCell(4).SetCellValue("审计日期");
if (ws.GetRow(rowIndex).GetCell(5) == null) ws.GetRow(rowIndex).CreateCell(5);
ws.GetRow(rowIndex).GetCell(5).SetCellValue("审计结果");
if (ws.GetRow(rowIndex).GetCell(6) == null) ws.GetRow(rowIndex).CreateCell(6);
ws.GetRow(rowIndex).GetCell(6).SetCellValue("上传人");
}
else if (this.drpExportFileType.SelectedText == "NCR" || this.drpExportFileType.SelectedText == "合同约谈" || this.drpExportFileType.SelectedText == "开工会" || this.drpExportFileType.SelectedText == "会议纪要" || this.drpExportFileType.SelectedText == "停工整改报告" || this.drpExportFileType.SelectedText == "合同终止" || this.drpExportFileType.SelectedText == "组织架构" || this.drpExportFileType.SelectedText == "框架承包商评估表")
{
if (ws.GetRow(rowIndex) == null) ws.CreateRow(rowIndex);
if (ws.GetRow(rowIndex).GetCell(0) == null) ws.GetRow(rowIndex).CreateCell(0);
ws.GetRow(rowIndex).GetCell(0).SetCellValue("合同号");
if (ws.GetRow(rowIndex).GetCell(1) == null) ws.GetRow(rowIndex).CreateCell(1);
ws.GetRow(rowIndex).GetCell(1).SetCellValue("文件编号");
if (ws.GetRow(rowIndex).GetCell(2) == null) ws.GetRow(rowIndex).CreateCell(2);
ws.GetRow(rowIndex).GetCell(2).SetCellValue("文件类型");
if (ws.GetRow(rowIndex).GetCell(3) == null) ws.GetRow(rowIndex).CreateCell(3);
ws.GetRow(rowIndex).GetCell(3).SetCellValue("发生日期");
if (ws.GetRow(rowIndex).GetCell(4) == null) ws.GetRow(rowIndex).CreateCell(4);
ws.GetRow(rowIndex).GetCell(4).SetCellValue("BYC负责部门");
if (ws.GetRow(rowIndex).GetCell(5) == null) ws.GetRow(rowIndex).CreateCell(5);
ws.GetRow(rowIndex).GetCell(5).SetCellValue("上传人");
if (ws.GetRow(rowIndex).GetCell(6) == null) ws.GetRow(rowIndex).CreateCell(6);
ws.GetRow(rowIndex).GetCell(6).SetCellValue("备注");
}
//数据行
int selectedRowsCount = this.Grid1.SelectedRowIndexArray.Count();
if (selectedRowsCount > 0)
{
foreach (var q in this.Grid1.SelectedRowIDArray)
{
var fo = BLL.SESRelatedDataService.GetSESRelatedDataById(q.ToString());
var contractManage = BLL.ContractManagementService.GetContractManagementByDataIdFileType(q.ToString(), this.drpExportFileType.SelectedValue);
if (contractManage.Count > 0)
{
var conFiles = (from x in Funs.DB.View_FC_ContractManagementLists where x.FC_ID == fo.ID && x.FileTypeId == drpExportFileType.SelectedValue select x).ToList();
foreach (var item in conFiles)
{
rowIndex = rowIndex + 1;
if (ws.GetRow(rowIndex) == null) ws.CreateRow(rowIndex);
if (ws.GetRow(rowIndex).GetCell(0) == null) ws.GetRow(rowIndex).CreateCell(0);
ws.GetRow(rowIndex).GetCell(0).SetCellValue(item.FO_NO);
if (this.drpExportFileType.SelectedText == "合同续签")
{
if (ws.GetRow(rowIndex).GetCell(1) == null) ws.GetRow(rowIndex).CreateCell(1);
ws.GetRow(rowIndex).GetCell(1).SetCellValue("合同续签");
if (ws.GetRow(rowIndex).GetCell(2) == null) ws.GetRow(rowIndex).CreateCell(2);
ws.GetRow(rowIndex).GetCell(2).SetCellValue(item.FileName);
if (ws.GetRow(rowIndex).GetCell(3) == null) ws.GetRow(rowIndex).CreateCell(3);
ws.GetRow(rowIndex).GetCell(3).SetCellValue(item.UploadManName);
if (ws.GetRow(rowIndex).GetCell(4) == null) ws.GetRow(rowIndex).CreateCell(4);
ws.GetRow(rowIndex).GetCell(4).SetCellValue(item.Contractor);
if (ws.GetRow(rowIndex).GetCell(5) == null) ws.GetRow(rowIndex).CreateCell(5);
ws.GetRow(rowIndex).GetCell(5).SetCellValue(item.PreviousFO);
if (ws.GetRow(rowIndex).GetCell(6) == null) ws.GetRow(rowIndex).CreateCell(6);
ws.GetRow(rowIndex).GetCell(6).SetCellValue(item.Remark);
}
else if (this.drpExportFileType.SelectedText == "费用增补")
{
if (ws.GetRow(rowIndex).GetCell(1) == null) ws.GetRow(rowIndex).CreateCell(1);
ws.GetRow(rowIndex).GetCell(1).SetCellValue("费用增补");
if (ws.GetRow(rowIndex).GetCell(2) == null) ws.GetRow(rowIndex).CreateCell(2);
ws.GetRow(rowIndex).GetCell(2).SetCellValue(item.FileName);
if (ws.GetRow(rowIndex).GetCell(3) == null) ws.GetRow(rowIndex).CreateCell(3);
ws.GetRow(rowIndex).GetCell(3).SetCellValue(item.UploadManName);
if (ws.GetRow(rowIndex).GetCell(4) == null) ws.GetRow(rowIndex).CreateCell(4);
ws.GetRow(rowIndex).GetCell(4).SetCellValue(item.Contractor);
if (ws.GetRow(rowIndex).GetCell(5) == null) ws.GetRow(rowIndex).CreateCell(5);
ws.GetRow(rowIndex).GetCell(5).SetCellValue(item.InitialBudget.HasValue ? item.InitialBudget.ToString() : "");
if (ws.GetRow(rowIndex).GetCell(6) == null) ws.GetRow(rowIndex).CreateCell(6);
ws.GetRow(rowIndex).GetCell(6).SetCellValue(item.SupplementedBudget.HasValue ? item.SupplementedBudget.ToString() : "");
if (ws.GetRow(rowIndex).GetCell(7) == null) ws.GetRow(rowIndex).CreateCell(7);
ws.GetRow(rowIndex).GetCell(7).SetCellValue(item.TotalBudget.HasValue ? item.TotalBudget.ToString() : "");
if (ws.GetRow(rowIndex).GetCell(8) == null) ws.GetRow(rowIndex).CreateCell(8);
ws.GetRow(rowIndex).GetCell(8).SetCellValue(item.Remark);
}
else if (this.drpExportFileType.SelectedText == "份额变更")
{
if (ws.GetRow(rowIndex).GetCell(1) == null) ws.GetRow(rowIndex).CreateCell(1);
ws.GetRow(rowIndex).GetCell(1).SetCellValue("份额变更");
if (ws.GetRow(rowIndex).GetCell(2) == null) ws.GetRow(rowIndex).CreateCell(2);
ws.GetRow(rowIndex).GetCell(2).SetCellValue(item.FileName);
if (ws.GetRow(rowIndex).GetCell(3) == null) ws.GetRow(rowIndex).CreateCell(3);
ws.GetRow(rowIndex).GetCell(3).SetCellValue(item.UploadManName);
if (ws.GetRow(rowIndex).GetCell(4) == null) ws.GetRow(rowIndex).CreateCell(4);
ws.GetRow(rowIndex).GetCell(4).SetCellValue(item.Contractor);
if (ws.GetRow(rowIndex).GetCell(5) == null) ws.GetRow(rowIndex).CreateCell(5);
ws.GetRow(rowIndex).GetCell(5).SetCellValue(item.InitialBudget.HasValue ? item.InitialBudget.ToString() : "");
if (ws.GetRow(rowIndex).GetCell(6) == null) ws.GetRow(rowIndex).CreateCell(6);
ws.GetRow(rowIndex).GetCell(6).SetCellValue(item.CurrentAllocation.HasValue ? item.CurrentAllocation.ToString() : "");
if (ws.GetRow(rowIndex).GetCell(7) == null) ws.GetRow(rowIndex).CreateCell(7);
ws.GetRow(rowIndex).GetCell(7).SetCellValue(item.Remark);
}
else if (this.drpExportFileType.SelectedText == "短期续延")
{
if (ws.GetRow(rowIndex).GetCell(1) == null) ws.GetRow(rowIndex).CreateCell(1);
ws.GetRow(rowIndex).GetCell(1).SetCellValue("短期续延");
if (ws.GetRow(rowIndex).GetCell(2) == null) ws.GetRow(rowIndex).CreateCell(2);
ws.GetRow(rowIndex).GetCell(2).SetCellValue(item.FileName);
if (ws.GetRow(rowIndex).GetCell(3) == null) ws.GetRow(rowIndex).CreateCell(3);
ws.GetRow(rowIndex).GetCell(3).SetCellValue(item.UploadManName);
if (ws.GetRow(rowIndex).GetCell(4) == null) ws.GetRow(rowIndex).CreateCell(4);
ws.GetRow(rowIndex).GetCell(4).SetCellValue(item.Contractor);
if (ws.GetRow(rowIndex).GetCell(5) == null) ws.GetRow(rowIndex).CreateCell(5);
ws.GetRow(rowIndex).GetCell(5).SetCellValue(item.StartDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.StartDate) : "");
if (ws.GetRow(rowIndex).GetCell(6) == null) ws.GetRow(rowIndex).CreateCell(6);
ws.GetRow(rowIndex).GetCell(6).SetCellValue(item.EndDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.EndDate) : "");
if (ws.GetRow(rowIndex).GetCell(7) == null) ws.GetRow(rowIndex).CreateCell(7);
ws.GetRow(rowIndex).GetCell(7).SetCellValue(item.Remark);
}
else if (this.drpExportFileType.SelectedText == "承包商EHSQ审计报告")
{
if (ws.GetRow(rowIndex).GetCell(1) == null) ws.GetRow(rowIndex).CreateCell(1);
ws.GetRow(rowIndex).GetCell(1).SetCellValue(item.FileName);
if (ws.GetRow(rowIndex).GetCell(2) == null) ws.GetRow(rowIndex).CreateCell(2);
ws.GetRow(rowIndex).GetCell(2).SetCellValue(item.ContractorType);
if (ws.GetRow(rowIndex).GetCell(3) == null) ws.GetRow(rowIndex).CreateCell(3);
ws.GetRow(rowIndex).GetCell(3).SetCellValue(item.Contractor);
if (ws.GetRow(rowIndex).GetCell(4) == null) ws.GetRow(rowIndex).CreateCell(4);
ws.GetRow(rowIndex).GetCell(4).SetCellValue(item.AuditDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.AuditDate) : "");
if (ws.GetRow(rowIndex).GetCell(5) == null) ws.GetRow(rowIndex).CreateCell(5);
ws.GetRow(rowIndex).GetCell(5).SetCellValue(item.AuditResult);
if (ws.GetRow(rowIndex).GetCell(6) == null) ws.GetRow(rowIndex).CreateCell(6);
ws.GetRow(rowIndex).GetCell(6).SetCellValue(item.UploadManName);
}
else if (this.drpExportFileType.SelectedText == "NCR")
{
if (ws.GetRow(rowIndex).GetCell(1) == null) ws.GetRow(rowIndex).CreateCell(1);
ws.GetRow(rowIndex).GetCell(1).SetCellValue(item.FileName);
if (ws.GetRow(rowIndex).GetCell(2) == null) ws.GetRow(rowIndex).CreateCell(2);
ws.GetRow(rowIndex).GetCell(2).SetCellValue("NCR");
if (ws.GetRow(rowIndex).GetCell(3) == null) ws.GetRow(rowIndex).CreateCell(3);
ws.GetRow(rowIndex).GetCell(3).SetCellValue(item.OccurDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.OccurDate) : "");
if (ws.GetRow(rowIndex).GetCell(4) == null) ws.GetRow(rowIndex).CreateCell(4);
ws.GetRow(rowIndex).GetCell(4).SetCellValue(item.BycDeptName);
if (ws.GetRow(rowIndex).GetCell(5) == null) ws.GetRow(rowIndex).CreateCell(5);
ws.GetRow(rowIndex).GetCell(5).SetCellValue(item.UploadManName);
if (ws.GetRow(rowIndex).GetCell(6) == null) ws.GetRow(rowIndex).CreateCell(6);
ws.GetRow(rowIndex).GetCell(6).SetCellValue(item.Remark);
}
else if (this.drpExportFileType.SelectedText == "合同约谈")
{
if (ws.GetRow(rowIndex).GetCell(1) == null) ws.GetRow(rowIndex).CreateCell(1);
ws.GetRow(rowIndex).GetCell(1).SetCellValue(item.FileName);
if (ws.GetRow(rowIndex).GetCell(2) == null) ws.GetRow(rowIndex).CreateCell(2);
ws.GetRow(rowIndex).GetCell(2).SetCellValue("合同约谈");
if (ws.GetRow(rowIndex).GetCell(3) == null) ws.GetRow(rowIndex).CreateCell(3);
ws.GetRow(rowIndex).GetCell(3).SetCellValue(item.OccurDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.OccurDate) : "");
if (ws.GetRow(rowIndex).GetCell(4) == null) ws.GetRow(rowIndex).CreateCell(4);
ws.GetRow(rowIndex).GetCell(4).SetCellValue(item.BycDeptName);
if (ws.GetRow(rowIndex).GetCell(5) == null) ws.GetRow(rowIndex).CreateCell(5);
ws.GetRow(rowIndex).GetCell(5).SetCellValue(item.UploadManName);
if (ws.GetRow(rowIndex).GetCell(6) == null) ws.GetRow(rowIndex).CreateCell(6);
ws.GetRow(rowIndex).GetCell(6).SetCellValue(item.Remark);
}
else if (this.drpExportFileType.SelectedText == "开工会")
{
if (ws.GetRow(rowIndex).GetCell(1) == null) ws.GetRow(rowIndex).CreateCell(1);
ws.GetRow(rowIndex).GetCell(1).SetCellValue(item.FileName);
if (ws.GetRow(rowIndex).GetCell(2) == null) ws.GetRow(rowIndex).CreateCell(2);
ws.GetRow(rowIndex).GetCell(2).SetCellValue("开工会");
if (ws.GetRow(rowIndex).GetCell(3) == null) ws.GetRow(rowIndex).CreateCell(3);
ws.GetRow(rowIndex).GetCell(3).SetCellValue(item.OccurDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.OccurDate) : "");
if (ws.GetRow(rowIndex).GetCell(4) == null) ws.GetRow(rowIndex).CreateCell(4);
ws.GetRow(rowIndex).GetCell(4).SetCellValue(item.BycDeptName);
if (ws.GetRow(rowIndex).GetCell(5) == null) ws.GetRow(rowIndex).CreateCell(5);
ws.GetRow(rowIndex).GetCell(5).SetCellValue(item.UploadManName);
if (ws.GetRow(rowIndex).GetCell(6) == null) ws.GetRow(rowIndex).CreateCell(6);
ws.GetRow(rowIndex).GetCell(6).SetCellValue(item.Remark);
}
else if (this.drpExportFileType.SelectedText == "会议纪要")
{
if (ws.GetRow(rowIndex).GetCell(1) == null) ws.GetRow(rowIndex).CreateCell(1);
ws.GetRow(rowIndex).GetCell(1).SetCellValue(item.FileName);
if (ws.GetRow(rowIndex).GetCell(2) == null) ws.GetRow(rowIndex).CreateCell(2);
ws.GetRow(rowIndex).GetCell(2).SetCellValue("会议纪要");
if (ws.GetRow(rowIndex).GetCell(3) == null) ws.GetRow(rowIndex).CreateCell(3);
ws.GetRow(rowIndex).GetCell(3).SetCellValue(item.OccurDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.OccurDate) : "");
if (ws.GetRow(rowIndex).GetCell(4) == null) ws.GetRow(rowIndex).CreateCell(4);
ws.GetRow(rowIndex).GetCell(4).SetCellValue(item.BycDeptName);
if (ws.GetRow(rowIndex).GetCell(5) == null) ws.GetRow(rowIndex).CreateCell(5);
ws.GetRow(rowIndex).GetCell(5).SetCellValue(item.UploadManName);
if (ws.GetRow(rowIndex).GetCell(6) == null) ws.GetRow(rowIndex).CreateCell(6);
ws.GetRow(rowIndex).GetCell(6).SetCellValue(item.Remark);
}
else if (this.drpExportFileType.SelectedText == "停工整改报告")
{
if (ws.GetRow(rowIndex).GetCell(1) == null) ws.GetRow(rowIndex).CreateCell(1);
ws.GetRow(rowIndex).GetCell(1).SetCellValue(item.FileName);
if (ws.GetRow(rowIndex).GetCell(2) == null) ws.GetRow(rowIndex).CreateCell(2);
ws.GetRow(rowIndex).GetCell(2).SetCellValue("停工整改报告");
if (ws.GetRow(rowIndex).GetCell(3) == null) ws.GetRow(rowIndex).CreateCell(3);
ws.GetRow(rowIndex).GetCell(3).SetCellValue(item.OccurDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.OccurDate) : "");
if (ws.GetRow(rowIndex).GetCell(4) == null) ws.GetRow(rowIndex).CreateCell(4);
ws.GetRow(rowIndex).GetCell(4).SetCellValue(item.BycDeptName);
if (ws.GetRow(rowIndex).GetCell(5) == null) ws.GetRow(rowIndex).CreateCell(5);
ws.GetRow(rowIndex).GetCell(5).SetCellValue(item.UploadManName);
if (ws.GetRow(rowIndex).GetCell(6) == null) ws.GetRow(rowIndex).CreateCell(6);
ws.GetRow(rowIndex).GetCell(6).SetCellValue(item.Remark);
}
else if (this.drpExportFileType.SelectedText == "合同终止")
{
if (ws.GetRow(rowIndex).GetCell(1) == null) ws.GetRow(rowIndex).CreateCell(1);
ws.GetRow(rowIndex).GetCell(1).SetCellValue(item.FileName);
if (ws.GetRow(rowIndex).GetCell(2) == null) ws.GetRow(rowIndex).CreateCell(2);
ws.GetRow(rowIndex).GetCell(2).SetCellValue("合同终止");
if (ws.GetRow(rowIndex).GetCell(3) == null) ws.GetRow(rowIndex).CreateCell(3);
ws.GetRow(rowIndex).GetCell(3).SetCellValue(item.OccurDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.OccurDate) : "");
if (ws.GetRow(rowIndex).GetCell(4) == null) ws.GetRow(rowIndex).CreateCell(4);
ws.GetRow(rowIndex).GetCell(4).SetCellValue(item.BycDeptName);
if (ws.GetRow(rowIndex).GetCell(5) == null) ws.GetRow(rowIndex).CreateCell(5);
ws.GetRow(rowIndex).GetCell(5).SetCellValue(item.UploadManName);
if (ws.GetRow(rowIndex).GetCell(6) == null) ws.GetRow(rowIndex).CreateCell(6);
ws.GetRow(rowIndex).GetCell(6).SetCellValue(item.Remark);
}
else if (this.drpExportFileType.SelectedText == "组织架构")
{
if (ws.GetRow(rowIndex).GetCell(1) == null) ws.GetRow(rowIndex).CreateCell(1);
ws.GetRow(rowIndex).GetCell(1).SetCellValue(item.FileName);
if (ws.GetRow(rowIndex).GetCell(2) == null) ws.GetRow(rowIndex).CreateCell(2);
ws.GetRow(rowIndex).GetCell(2).SetCellValue("组织架构");
if (ws.GetRow(rowIndex).GetCell(3) == null) ws.GetRow(rowIndex).CreateCell(3);
ws.GetRow(rowIndex).GetCell(3).SetCellValue(item.OccurDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.OccurDate) : "");
if (ws.GetRow(rowIndex).GetCell(4) == null) ws.GetRow(rowIndex).CreateCell(4);
ws.GetRow(rowIndex).GetCell(4).SetCellValue(item.BycDeptName);
if (ws.GetRow(rowIndex).GetCell(5) == null) ws.GetRow(rowIndex).CreateCell(5);
ws.GetRow(rowIndex).GetCell(5).SetCellValue(item.UploadManName);
if (ws.GetRow(rowIndex).GetCell(6) == null) ws.GetRow(rowIndex).CreateCell(6);
ws.GetRow(rowIndex).GetCell(6).SetCellValue(item.Remark);
}
else if (this.drpExportFileType.SelectedText == "框架承包商评估表")
{
if (ws.GetRow(rowIndex).GetCell(1) == null) ws.GetRow(rowIndex).CreateCell(1);
ws.GetRow(rowIndex).GetCell(1).SetCellValue(item.FileName);
if (ws.GetRow(rowIndex).GetCell(2) == null) ws.GetRow(rowIndex).CreateCell(2);
ws.GetRow(rowIndex).GetCell(2).SetCellValue("框架承包商评估表");
if (ws.GetRow(rowIndex).GetCell(3) == null) ws.GetRow(rowIndex).CreateCell(3);
ws.GetRow(rowIndex).GetCell(3).SetCellValue(item.OccurDate.HasValue ? string.Format("{0:yyyy-MM-dd}", item.OccurDate) : "");
if (ws.GetRow(rowIndex).GetCell(4) == null) ws.GetRow(rowIndex).CreateCell(4);
ws.GetRow(rowIndex).GetCell(4).SetCellValue(item.BycDeptName);
if (ws.GetRow(rowIndex).GetCell(5) == null) ws.GetRow(rowIndex).CreateCell(5);
ws.GetRow(rowIndex).GetCell(5).SetCellValue(item.UploadManName);
if (ws.GetRow(rowIndex).GetCell(6) == null) ws.GetRow(rowIndex).CreateCell(6);
ws.GetRow(rowIndex).GetCell(6).SetCellValue(item.Remark);
}
}
}
else
{
rowIndex = rowIndex + 1;
if (ws.GetRow(rowIndex) == null) ws.CreateRow(rowIndex);
if (ws.GetRow(rowIndex).GetCell(0) == null) ws.GetRow(rowIndex).CreateCell(0);
ws.GetRow(rowIndex).GetCell(0).SetCellValue(fo.FO_NO);
}
}
}
else
{
Alert.ShowInTop("请勾选要导出的合同!", MessageBoxIcon.Warning);
return;
}
}
else
{
XSSFSheet ws = new XSSFSheet();
var fileTypeLists = BLL.DropListService.getConFileTypeDropList();
foreach (var item in fileTypeLists)
{
ws = (XSSFSheet)hssfworkbook.CreateSheet(item.Text);
ws.SetColumnWidth(0, (12 * 256));
ws.SetColumnWidth(1, (15 * 256));
ws.SetColumnWidth(2, (28 * 256));
ws.SetColumnWidth(3, (20 * 256));
ws.SetColumnWidth(4, (50 * 256));
ws.SetColumnWidth(5, (20 * 256));
ws.SetColumnWidth(6, (20 * 256));
if (item.Text == "合同续签")
{
if (ws.GetRow(rowIndex) == null) ws.CreateRow(rowIndex);
if (ws.GetRow(rowIndex).GetCell(0) == null) ws.GetRow(rowIndex).CreateCell(0);
ws.GetRow(rowIndex).GetCell(0).SetCellValue("FO合同号");
if (ws.GetRow(rowIndex).GetCell(1) == null) ws.GetRow(rowIndex).CreateCell(1);
ws.GetRow(rowIndex).GetCell(1).SetCellValue("文件类型");
if (ws.GetRow(rowIndex).GetCell(2) == null) ws.GetRow(rowIndex).CreateCell(2);
ws.GetRow(rowIndex).GetCell(2).SetCellValue("文件编号");
if (ws.GetRow(rowIndex).GetCell(3) == null) ws.GetRow(rowIndex).CreateCell(3);
ws.GetRow(rowIndex).GetCell(3).SetCellValue("上传人");
if (ws.GetRow(rowIndex).GetCell(4) == null) ws.GetRow(rowIndex).CreateCell(4);
ws.GetRow(rowIndex).GetCell(4).SetCellValue("承包商名称");
if (ws.GetRow(rowIndex).GetCell(5) == null) ws.GetRow(rowIndex).CreateCell(5);
ws.GetRow(rowIndex).GetCell(5).SetCellValue("上一轮合同号");
if (ws.GetRow(rowIndex).GetCell(6) == null) ws.GetRow(rowIndex).CreateCell(6);
ws.GetRow(rowIndex).GetCell(6).SetCellValue("备注");
}
else if (item.Text == "费用增补")
{
if (ws.GetRow(rowIndex) == null) ws.CreateRow(rowIndex);
if (ws.GetRow(rowIndex).GetCell(0) == null) ws.GetRow(rowIndex).CreateCell(0);
ws.GetRow(rowIndex).GetCell(0).SetCellValue("合同号");
if (ws.GetRow(rowIndex).GetCell(1) == null) ws.GetRow(rowIndex).CreateCell(1);
ws.GetRow(rowIndex).GetCell(1).SetCellValue("文件类型");
if (ws.GetRow(rowIndex).GetCell(2) == null) ws.GetRow(rowIndex).CreateCell(2);
ws.GetRow(rowIndex).GetCell(2).SetCellValue("文件编号");
if (ws.GetRow(rowIndex).GetCell(3) == null) ws.GetRow(rowIndex).CreateCell(3);
ws.GetRow(rowIndex).GetCell(3).SetCellValue("上传人");
if (ws.GetRow(rowIndex).GetCell(4) == null) ws.GetRow(rowIndex).CreateCell(4);
ws.GetRow(rowIndex).GetCell(4).SetCellValue("承包商名称");
if (ws.GetRow(rowIndex).GetCell(5) == null) ws.GetRow(rowIndex).CreateCell(5);
ws.GetRow(rowIndex).GetCell(5).SetCellValue("Initial budget");
if (ws.GetRow(rowIndex).GetCell(6) == null) ws.GetRow(rowIndex).CreateCell(6);
ws.GetRow(rowIndex).GetCell(6).SetCellValue("Supplemented Budget");
if (ws.GetRow(rowIndex).GetCell(7) == null) ws.GetRow(rowIndex).CreateCell(7);
ws.GetRow(rowIndex).GetCell(7).SetCellValue("Total Budget");
if (ws.GetRow(rowIndex).GetCell(8) == null) ws.GetRow(rowIndex).CreateCell(8);
ws.GetRow(rowIndex).GetCell(8).SetCellValue("备注");
}
else if (item.Text == "份额变更")
{
if (ws.GetRow(rowIndex) == null) ws.CreateRow(rowIndex);
if (ws.GetRow(rowIndex).GetCell(0) == null) ws.GetRow(rowIndex).CreateCell(0);
ws.GetRow(rowIndex).GetCell(0).SetCellValue("合同号");
if (ws.GetRow(rowIndex).GetCell(1) == null) ws.GetRow(rowIndex).CreateCell(1);
ws.GetRow(rowIndex).GetCell(1).SetCellValue("文件类型");
if (ws.GetRow(rowIndex).GetCell(2) == null) ws.GetRow(rowIndex).CreateCell(2);
ws.GetRow(rowIndex).GetCell(2).SetCellValue("文件编号");
if (ws.GetRow(rowIndex).GetCell(3) == null) ws.GetRow(rowIndex).CreateCell(3);
ws.GetRow(rowIndex).GetCell(3).SetCellValue("上传人");
if (ws.GetRow(rowIndex).GetCell(4) == null) ws.GetRow(rowIndex).CreateCell(4);
ws.GetRow(rowIndex).GetCell(4).SetCellValue("承包商名称");
if (ws.GetRow(rowIndex).GetCell(5) == null) ws.GetRow(rowIndex).CreateCell(5);
ws.GetRow(rowIndex).GetCell(5).SetCellValue("Initial budget");
if (ws.GetRow(rowIndex).GetCell(6) == null) ws.GetRow(rowIndex).CreateCell(6);
ws.GetRow(rowIndex).GetCell(6).SetCellValue("Current allocation(%)");
if (ws.GetRow(rowIndex).GetCell(7) == null) ws.GetRow(rowIndex).CreateCell(7);
ws.GetRow(rowIndex).GetCell(7).SetCellValue("备注");
}
else if (item.Text == "短期续延")
{
if (ws.GetRow(rowIndex) == null) ws.CreateRow(rowIndex);
if (ws.GetRow(rowIndex).GetCell(0) == null) ws.GetRow(rowIndex).CreateCell(0);
ws.GetRow(rowIndex).GetCell(0).SetCellValue("合同号");
if (ws.GetRow(rowIndex).GetCell(1) == null) ws.GetRow(rowIndex).CreateCell(1);
ws.GetRow(rowIndex).GetCell(1).SetCellValue("文件类型");
if (ws.GetRow(rowIndex).GetCell(2) == null) ws.GetRow(rowIndex).CreateCell(2);
ws.GetRow(rowIndex).GetCell(2).SetCellValue("文件编号");
if (ws.GetRow(rowIndex).GetCell(3) == null) ws.GetRow(rowIndex).CreateCell(3);
ws.GetRow(rowIndex).GetCell(3).SetCellValue("上传人");
if (ws.GetRow(rowIndex).GetCell(4) == null) ws.GetRow(rowIndex).CreateCell(4);
ws.GetRow(rowIndex).GetCell(4).SetCellValue("承包商名称");
if (ws.GetRow(rowIndex).GetCell(5) == null) ws.GetRow(rowIndex).CreateCell(5);
ws.GetRow(rowIndex).GetCell(5).SetCellValue("开始时间");
if (ws.GetRow(rowIndex).GetCell(6) == null) ws.GetRow(rowIndex).CreateCell(6);
ws.GetRow(rowIndex).GetCell(6).SetCellValue("结束时间");
if (ws.GetRow(rowIndex).GetCell(7) == null) ws.GetRow(rowIndex).CreateCell(7);
ws.GetRow(rowIndex).GetCell(7).SetCellValue("备注");
}
else if (item.Text == "承包商EHSQ审计报告")
{
if (ws.GetRow(rowIndex) == null) ws.CreateRow(rowIndex);
if (ws.GetRow(rowIndex).GetCell(0) == null) ws.GetRow(rowIndex).CreateCell(0);
ws.GetRow(rowIndex).GetCell(0).SetCellValue("合同号");
if (ws.GetRow(rowIndex).GetCell(1) == null) ws.GetRow(rowIndex).CreateCell(1);
ws.GetRow(rowIndex).GetCell(1).SetCellValue("审计编号");
if (ws.GetRow(rowIndex).GetCell(2) == null) ws.GetRow(rowIndex).CreateCell(2);
ws.GetRow(rowIndex).GetCell(2).SetCellValue("承包商类型");
if (ws.GetRow(rowIndex).GetCell(3) == null) ws.GetRow(rowIndex).CreateCell(3);
ws.GetRow(rowIndex).GetCell(3).SetCellValue("承包商名称");
if (ws.GetRow(rowIndex).GetCell(4) == null) ws.GetRow(rowIndex).CreateCell(4);
ws.GetRow(rowIndex).GetCell(4).SetCellValue("审计日期");
if (ws.GetRow(rowIndex).GetCell(5) == null) ws.GetRow(rowIndex).CreateCell(5);
ws.GetRow(rowIndex).GetCell(5).SetCellValue("审计结果");
if (ws.GetRow(rowIndex).GetCell(6) == null) ws.GetRow(rowIndex).CreateCell(6);
ws.GetRow(rowIndex).GetCell(6).SetCellValue("上传人");
}
else if (item.Text == "NCR" || item.Text == "合同约谈" || item.Text == "开工会" || item.Text == "会议纪要" || item.Text == "停工整改报告" || item.Text == "合同终止" || item.Text == "组织架构" || item.Text == "框架承包商评估表")
{
if (ws.GetRow(rowIndex) == null) ws.CreateRow(rowIndex);
if (ws.GetRow(rowIndex).GetCell(0) == null) ws.GetRow(rowIndex).CreateCell(0);
ws.GetRow(rowIndex).GetCell(0).SetCellValue("合同号");
if (ws.GetRow(rowIndex).GetCell(1) == null) ws.GetRow(rowIndex).CreateCell(1);
ws.GetRow(rowIndex).GetCell(1).SetCellValue("文件编号");
if (ws.GetRow(rowIndex).GetCell(2) == null) ws.GetRow(rowIndex).CreateCell(2);
ws.GetRow(rowIndex).GetCell(2).SetCellValue("文件类型");
if (ws.GetRow(rowIndex).GetCell(3) == null) ws.GetRow(rowIndex).CreateCell(3);
ws.GetRow(rowIndex).GetCell(3).SetCellValue("发生日期");
if (ws.GetRow(rowIndex).GetCell(4) == null) ws.GetRow(rowIndex).CreateCell(4);
ws.GetRow(rowIndex).GetCell(4).SetCellValue("BYC负责部门");
if (ws.GetRow(rowIndex).GetCell(5) == null) ws.GetRow(rowIndex).CreateCell(5);
ws.GetRow(rowIndex).GetCell(5).SetCellValue("上传人");
if (ws.GetRow(rowIndex).GetCell(6) == null) ws.GetRow(rowIndex).CreateCell(6);
ws.GetRow(rowIndex).GetCell(6).SetCellValue("备注");
}
//数据行
int selectedRowsCount = this.Grid1.SelectedRowIndexArray.Count();
if (selectedRowsCount > 0)
{
int i = 0;
foreach (var q in this.Grid1.SelectedRowIDArray)
{
var fo = BLL.SESRelatedDataService.GetSESRelatedDataById(q.ToString());
var contractManage = BLL.ContractManagementService.GetContractManagementByDataIdFileType(q.ToString(), item.Value);
if (contractManage.Count > 0)
{
var conFiles = (from x in Funs.DB.View_FC_ContractManagementLists where x.FC_ID == fo.ID && x.FileTypeId == item.Value select x).ToList();
foreach (var con in conFiles)
{
i = i + 1;
if (ws.GetRow(i) == null) ws.CreateRow(i);
if (ws.GetRow(i).GetCell(0) == null) ws.GetRow(i).CreateCell(0);
ws.GetRow(i).GetCell(0).SetCellValue(con.FO_NO);
if (item.Text == "合同续签")
{
if (ws.GetRow(i).GetCell(1) == null) ws.GetRow(i).CreateCell(1);
ws.GetRow(i).GetCell(1).SetCellValue("合同续签");
if (ws.GetRow(i).GetCell(2) == null) ws.GetRow(i).CreateCell(2);
ws.GetRow(i).GetCell(2).SetCellValue(con.FileName);
if (ws.GetRow(i).GetCell(3) == null) ws.GetRow(i).CreateCell(3);
ws.GetRow(i).GetCell(3).SetCellValue(con.UploadManName);
if (ws.GetRow(i).GetCell(4) == null) ws.GetRow(i).CreateCell(4);
ws.GetRow(i).GetCell(4).SetCellValue(con.Contractor);
if (ws.GetRow(i).GetCell(5) == null) ws.GetRow(i).CreateCell(5);
ws.GetRow(i).GetCell(5).SetCellValue(con.PreviousFO);
if (ws.GetRow(i).GetCell(6) == null) ws.GetRow(i).CreateCell(6);
ws.GetRow(i).GetCell(6).SetCellValue(con.Remark);
}
else if (item.Text == "费用增补")
{
if (ws.GetRow(i).GetCell(1) == null) ws.GetRow(i).CreateCell(1);
ws.GetRow(i).GetCell(1).SetCellValue("费用增补");
if (ws.GetRow(i).GetCell(2) == null) ws.GetRow(i).CreateCell(2);
ws.GetRow(i).GetCell(2).SetCellValue(con.FileName);
if (ws.GetRow(i).GetCell(3) == null) ws.GetRow(i).CreateCell(3);
ws.GetRow(i).GetCell(3).SetCellValue(con.UploadManName);
if (ws.GetRow(i).GetCell(4) == null) ws.GetRow(i).CreateCell(4);
ws.GetRow(i).GetCell(4).SetCellValue(con.Contractor);
if (ws.GetRow(i).GetCell(5) == null) ws.GetRow(i).CreateCell(5);
ws.GetRow(i).GetCell(5).SetCellValue(con.InitialBudget.HasValue ? con.InitialBudget.ToString() : "");
if (ws.GetRow(i).GetCell(6) == null) ws.GetRow(i).CreateCell(6);
ws.GetRow(i).GetCell(6).SetCellValue(con.SupplementedBudget.HasValue ? con.SupplementedBudget.ToString() : "");
if (ws.GetRow(i).GetCell(7) == null) ws.GetRow(i).CreateCell(7);
ws.GetRow(i).GetCell(7).SetCellValue(con.TotalBudget.HasValue ? con.TotalBudget.ToString() : "");
if (ws.GetRow(i).GetCell(8) == null) ws.GetRow(i).CreateCell(8);
ws.GetRow(i).GetCell(8).SetCellValue(con.Remark);
}
else if (item.Text == "份额变更")
{
if (ws.GetRow(i).GetCell(1) == null) ws.GetRow(i).CreateCell(1);
ws.GetRow(i).GetCell(1).SetCellValue("份额变更");
if (ws.GetRow(i).GetCell(2) == null) ws.GetRow(i).CreateCell(2);
ws.GetRow(i).GetCell(2).SetCellValue(con.FileName);
if (ws.GetRow(i).GetCell(3) == null) ws.GetRow(i).CreateCell(3);
ws.GetRow(i).GetCell(3).SetCellValue(con.UploadManName);
if (ws.GetRow(i).GetCell(4) == null) ws.GetRow(i).CreateCell(4);
ws.GetRow(i).GetCell(4).SetCellValue(con.Contractor);
if (ws.GetRow(i).GetCell(5) == null) ws.GetRow(i).CreateCell(5);
ws.GetRow(i).GetCell(5).SetCellValue(con.InitialBudget.HasValue ? con.InitialBudget.ToString() : "");
if (ws.GetRow(i).GetCell(6) == null) ws.GetRow(i).CreateCell(6);
ws.GetRow(i).GetCell(6).SetCellValue(con.CurrentAllocation.HasValue ? con.CurrentAllocation.ToString() : "");
if (ws.GetRow(i).GetCell(7) == null) ws.GetRow(i).CreateCell(7);
ws.GetRow(i).GetCell(7).SetCellValue(con.Remark);
}
else if (item.Text == "短期续延")
{
if (ws.GetRow(i).GetCell(1) == null) ws.GetRow(i).CreateCell(1);
ws.GetRow(i).GetCell(1).SetCellValue("短期续延");
if (ws.GetRow(i).GetCell(2) == null) ws.GetRow(i).CreateCell(2);
ws.GetRow(i).GetCell(2).SetCellValue(con.FileName);
if (ws.GetRow(i).GetCell(3) == null) ws.GetRow(i).CreateCell(3);
ws.GetRow(i).GetCell(3).SetCellValue(con.UploadManName);
if (ws.GetRow(i).GetCell(4) == null) ws.GetRow(i).CreateCell(4);
ws.GetRow(i).GetCell(4).SetCellValue(con.Contractor);
if (ws.GetRow(i).GetCell(5) == null) ws.GetRow(i).CreateCell(5);
ws.GetRow(i).GetCell(5).SetCellValue(con.StartDate.HasValue ? string.Format("{0:yyyy-MM-dd}", con.StartDate) : "");
if (ws.GetRow(i).GetCell(6) == null) ws.GetRow(i).CreateCell(6);
ws.GetRow(i).GetCell(6).SetCellValue(con.EndDate.HasValue ? string.Format("{0:yyyy-MM-dd}", con.EndDate) : "");
if (ws.GetRow(i).GetCell(7) == null) ws.GetRow(i).CreateCell(7);
ws.GetRow(i).GetCell(7).SetCellValue(con.Remark);
}
else if (item.Text == "承包商EHSQ审计报告")
{
if (ws.GetRow(i).GetCell(1) == null) ws.GetRow(i).CreateCell(1);
ws.GetRow(i).GetCell(1).SetCellValue(con.FileName);
if (ws.GetRow(i).GetCell(2) == null) ws.GetRow(i).CreateCell(2);
ws.GetRow(i).GetCell(2).SetCellValue(con.ContractorType);
if (ws.GetRow(i).GetCell(3) == null) ws.GetRow(i).CreateCell(3);
ws.GetRow(i).GetCell(3).SetCellValue(con.Contractor);
if (ws.GetRow(i).GetCell(4) == null) ws.GetRow(i).CreateCell(4);
ws.GetRow(i).GetCell(4).SetCellValue(con.AuditDate.HasValue ? string.Format("{0:yyyy-MM-dd}", con.AuditDate) : "");
if (ws.GetRow(i).GetCell(5) == null) ws.GetRow(i).CreateCell(5);
ws.GetRow(i).GetCell(5).SetCellValue(con.AuditResult);
if (ws.GetRow(i).GetCell(6) == null) ws.GetRow(i).CreateCell(6);
ws.GetRow(i).GetCell(6).SetCellValue(con.UploadManName);
}
else if (item.Text == "NCR")
{
if (ws.GetRow(i).GetCell(1) == null) ws.GetRow(i).CreateCell(1);
ws.GetRow(i).GetCell(1).SetCellValue(con.FileName);
if (ws.GetRow(i).GetCell(2) == null) ws.GetRow(i).CreateCell(2);
ws.GetRow(i).GetCell(2).SetCellValue("NCR");
if (ws.GetRow(i).GetCell(3) == null) ws.GetRow(i).CreateCell(3);
ws.GetRow(i).GetCell(3).SetCellValue(con.OccurDate.HasValue ? string.Format("{0:yyyy-MM-dd}", con.OccurDate) : "");
if (ws.GetRow(i).GetCell(4) == null) ws.GetRow(i).CreateCell(4);
ws.GetRow(i).GetCell(4).SetCellValue(con.BycDeptName);
if (ws.GetRow(i).GetCell(5) == null) ws.GetRow(i).CreateCell(5);
ws.GetRow(i).GetCell(5).SetCellValue(con.UploadManName);
if (ws.GetRow(i).GetCell(6) == null) ws.GetRow(i).CreateCell(6);
ws.GetRow(i).GetCell(6).SetCellValue(con.Remark);
}
else if (item.Text == "合同约谈")
{
if (ws.GetRow(i).GetCell(1) == null) ws.GetRow(i).CreateCell(1);
ws.GetRow(i).GetCell(1).SetCellValue(con.FileName);
if (ws.GetRow(i).GetCell(2) == null) ws.GetRow(i).CreateCell(2);
ws.GetRow(i).GetCell(2).SetCellValue("合同约谈");
if (ws.GetRow(i).GetCell(3) == null) ws.GetRow(i).CreateCell(3);
ws.GetRow(i).GetCell(3).SetCellValue(con.OccurDate.HasValue ? string.Format("{0:yyyy-MM-dd}", con.OccurDate) : "");
if (ws.GetRow(i).GetCell(4) == null) ws.GetRow(i).CreateCell(4);
ws.GetRow(i).GetCell(4).SetCellValue(con.BycDeptName);
if (ws.GetRow(i).GetCell(5) == null) ws.GetRow(i).CreateCell(5);
ws.GetRow(i).GetCell(5).SetCellValue(con.UploadManName);
if (ws.GetRow(i).GetCell(6) == null) ws.GetRow(i).CreateCell(6);
ws.GetRow(i).GetCell(6).SetCellValue(con.Remark);
}
else if (item.Text == "开工会")
{
if (ws.GetRow(i).GetCell(1) == null) ws.GetRow(i).CreateCell(1);
ws.GetRow(i).GetCell(1).SetCellValue(con.FileName);
if (ws.GetRow(i).GetCell(2) == null) ws.GetRow(i).CreateCell(2);
ws.GetRow(i).GetCell(2).SetCellValue("开工会");
if (ws.GetRow(i).GetCell(3) == null) ws.GetRow(i).CreateCell(3);
ws.GetRow(i).GetCell(3).SetCellValue(con.OccurDate.HasValue ? string.Format("{0:yyyy-MM-dd}", con.OccurDate) : "");
if (ws.GetRow(i).GetCell(4) == null) ws.GetRow(i).CreateCell(4);
ws.GetRow(i).GetCell(4).SetCellValue(con.BycDeptName);
if (ws.GetRow(i).GetCell(5) == null) ws.GetRow(i).CreateCell(5);
ws.GetRow(i).GetCell(5).SetCellValue(con.UploadManName);
if (ws.GetRow(i).GetCell(6) == null) ws.GetRow(i).CreateCell(6);
ws.GetRow(i).GetCell(6).SetCellValue(con.Remark);
}
else if (item.Text == "会议纪要")
{
if (ws.GetRow(i).GetCell(1) == null) ws.GetRow(i).CreateCell(1);
ws.GetRow(i).GetCell(1).SetCellValue(con.FileName);
if (ws.GetRow(i).GetCell(2) == null) ws.GetRow(i).CreateCell(2);
ws.GetRow(i).GetCell(2).SetCellValue("会议纪要");
if (ws.GetRow(i).GetCell(3) == null) ws.GetRow(i).CreateCell(3);
ws.GetRow(i).GetCell(3).SetCellValue(con.OccurDate.HasValue ? string.Format("{0:yyyy-MM-dd}", con.OccurDate) : "");
if (ws.GetRow(i).GetCell(4) == null) ws.GetRow(i).CreateCell(4);
ws.GetRow(i).GetCell(4).SetCellValue(con.BycDeptName);
if (ws.GetRow(i).GetCell(5) == null) ws.GetRow(i).CreateCell(5);
ws.GetRow(i).GetCell(5).SetCellValue(con.UploadManName);
if (ws.GetRow(i).GetCell(6) == null) ws.GetRow(i).CreateCell(6);
ws.GetRow(i).GetCell(6).SetCellValue(con.Remark);
}
else if (item.Text == "停工整改报告")
{
if (ws.GetRow(i).GetCell(1) == null) ws.GetRow(i).CreateCell(1);
ws.GetRow(i).GetCell(1).SetCellValue(con.FileName);
if (ws.GetRow(i).GetCell(2) == null) ws.GetRow(i).CreateCell(2);
ws.GetRow(i).GetCell(2).SetCellValue("停工整改报告");
if (ws.GetRow(i).GetCell(3) == null) ws.GetRow(i).CreateCell(3);
ws.GetRow(i).GetCell(3).SetCellValue(con.OccurDate.HasValue ? string.Format("{0:yyyy-MM-dd}", con.OccurDate) : "");
if (ws.GetRow(i).GetCell(4) == null) ws.GetRow(i).CreateCell(4);
ws.GetRow(i).GetCell(4).SetCellValue(con.BycDeptName);
if (ws.GetRow(i).GetCell(5) == null) ws.GetRow(i).CreateCell(5);
ws.GetRow(i).GetCell(5).SetCellValue(con.UploadManName);
if (ws.GetRow(i).GetCell(6) == null) ws.GetRow(i).CreateCell(6);
ws.GetRow(i).GetCell(6).SetCellValue(con.Remark);
}
else if (item.Text == "合同终止")
{
if (ws.GetRow(i).GetCell(1) == null) ws.GetRow(i).CreateCell(1);
ws.GetRow(i).GetCell(1).SetCellValue(con.FileName);
if (ws.GetRow(i).GetCell(2) == null) ws.GetRow(i).CreateCell(2);
ws.GetRow(i).GetCell(2).SetCellValue("合同终止");
if (ws.GetRow(i).GetCell(3) == null) ws.GetRow(i).CreateCell(3);
ws.GetRow(i).GetCell(3).SetCellValue(con.OccurDate.HasValue ? string.Format("{0:yyyy-MM-dd}", con.OccurDate) : "");
if (ws.GetRow(i).GetCell(4) == null) ws.GetRow(i).CreateCell(4);
ws.GetRow(i).GetCell(4).SetCellValue(con.BycDeptName);
if (ws.GetRow(i).GetCell(5) == null) ws.GetRow(i).CreateCell(5);
ws.GetRow(i).GetCell(5).SetCellValue(con.UploadManName);
if (ws.GetRow(i).GetCell(6) == null) ws.GetRow(i).CreateCell(6);
ws.GetRow(i).GetCell(6).SetCellValue(con.Remark);
}
else if (item.Text == "组织架构")
{
if (ws.GetRow(i).GetCell(1) == null) ws.GetRow(i).CreateCell(1);
ws.GetRow(i).GetCell(1).SetCellValue(con.FileName);
if (ws.GetRow(i).GetCell(2) == null) ws.GetRow(i).CreateCell(2);
ws.GetRow(i).GetCell(2).SetCellValue("组织架构");
if (ws.GetRow(i).GetCell(3) == null) ws.GetRow(i).CreateCell(3);
ws.GetRow(i).GetCell(3).SetCellValue(con.OccurDate.HasValue ? string.Format("{0:yyyy-MM-dd}", con.OccurDate) : "");
if (ws.GetRow(i).GetCell(4) == null) ws.GetRow(i).CreateCell(4);
ws.GetRow(i).GetCell(4).SetCellValue(con.BycDeptName);
if (ws.GetRow(i).GetCell(5) == null) ws.GetRow(i).CreateCell(5);
ws.GetRow(i).GetCell(5).SetCellValue(con.UploadManName);
if (ws.GetRow(i).GetCell(6) == null) ws.GetRow(i).CreateCell(6);
ws.GetRow(i).GetCell(6).SetCellValue(con.Remark);
}
else if (item.Text == "框架承包商评估表")
{
if (ws.GetRow(i).GetCell(1) == null) ws.GetRow(i).CreateCell(1);
ws.GetRow(i).GetCell(1).SetCellValue(con.FileName);
if (ws.GetRow(i).GetCell(2) == null) ws.GetRow(i).CreateCell(2);
ws.GetRow(i).GetCell(2).SetCellValue("框架承包商评估表");
if (ws.GetRow(i).GetCell(3) == null) ws.GetRow(i).CreateCell(3);
ws.GetRow(i).GetCell(3).SetCellValue(con.OccurDate.HasValue ? string.Format("{0:yyyy-MM-dd}", con.OccurDate) : "");
if (ws.GetRow(i).GetCell(4) == null) ws.GetRow(i).CreateCell(4);
ws.GetRow(i).GetCell(4).SetCellValue(con.BycDeptName);
if (ws.GetRow(i).GetCell(5) == null) ws.GetRow(i).CreateCell(5);
ws.GetRow(i).GetCell(5).SetCellValue(con.UploadManName);
if (ws.GetRow(i).GetCell(6) == null) ws.GetRow(i).CreateCell(6);
ws.GetRow(i).GetCell(6).SetCellValue(con.Remark);
}
}
}
else
{
i = i + 1;
if (ws.GetRow(i) == null) ws.CreateRow(i);
if (ws.GetRow(i).GetCell(0) == null) ws.GetRow(i).CreateCell(0);
ws.GetRow(i).GetCell(0).SetCellValue(fo.FO_NO);
}
}
}
else
{
Alert.ShowInTop("请勾选要导出的合同!", MessageBoxIcon.Warning);
return;
}
}
reportName = "合同管理";
}
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=" + reportName + "_" + 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();
}
/// <summary>
/// 根据sql获取数据
/// </summary>
/// <param name="strSql"></param>
/// <param name="tableName"></param>
/// <param name="parameters"></param>
/// <returns></returns>
public static DataTable GetDataTableNameRunText(string strSql, string tableName = "", params SqlParameter[] parameters)
{
DataTable dataTable = string.IsNullOrEmpty(tableName) ? new DataTable() : new DataTable(tableName);
using (SqlConnection Connection = new SqlConnection(Funs.ConnString))
{
try
{
Connection.Open();
SqlCommand command = new SqlCommand(strSql, Connection);
command.CommandType = CommandType.Text;
if (parameters != null)
{
command.Parameters.AddRange(parameters);
}
SqlDataAdapter adapter = new SqlDataAdapter(command);
adapter.Fill(dataTable);
}
finally
{
Connection.Close();
}
}
return dataTable;
}
#endregion
#region
/// <summary>
/// 菜单按钮权限
/// </summary>
private void GetButtonPower()
{
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.UserId, BLL.Const.SESRelatedDateMenuId);
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.BtnSend))
{
this.btnSendEmail.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnBatchDownload))
{
drpDownloadType.Hidden = false;
this.btnBatchDownload.Hidden = false;
}
else
{
drpDownloadType.Hidden = true;
}
if (buttonList.Contains(BLL.Const.BtnSave))
{
this.Grid1.EnableRowDoubleClickEvent = true;
}
else
{
this.Grid1.EnableRowDoubleClickEvent = false;
}
#region
if (buttonList.Contains(BLL.Const.BtnSignedAdd))
{
this.btnAddFile2.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnSignedModify))
{
this.btnMenuEdit2.Hidden = false;
this.Grid2.EnableRowDoubleClickEvent = true;
}
else
{
this.Grid2.EnableRowDoubleClickEvent = false;
}
if (buttonList.Contains(BLL.Const.BtnSignedDelete))
{
this.btnMenuDelete2.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnSignedView))
{
TabSigned.Hidden = false;
}
else
{
TabSigned.Hidden = true;
}
if (buttonList.Contains(BLL.Const.BtnManageAdd))
{
this.btnAddFile3.Hidden = false;
this.btnAddFile4.Hidden = false;
this.btnAddFile5.Hidden = false;
this.btnAddFile6.Hidden = false;
this.btnAddFile7.Hidden = false;
this.btnAddFile.Hidden = false;
this.btnAddFile9.Hidden = false;
this.btnAddFile10.Hidden = false;
this.btnAddFile11.Hidden = false;
this.btnAddFile12.Hidden = false;
this.btnAddFile13.Hidden = false;
this.btnAddFile14.Hidden = false;
this.btnAddFile15.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnManageModify))
{
this.btnMenuEdit3.Hidden = false;
this.Grid3.EnableRowDoubleClickEvent = true;
this.btnMenuEdit4.Hidden = false;
this.Grid4.EnableRowDoubleClickEvent = true;
this.btnMenuEdit5.Hidden = false;
this.Grid5.EnableRowDoubleClickEvent = true;
this.btnMenuEdit6.Hidden = false;
this.Grid6.EnableRowDoubleClickEvent = true;
this.btnMenuEdit7.Hidden = false;
this.Grid7.EnableRowDoubleClickEvent = true;
this.btnMenuEdit8.Hidden = false;
this.Grid8.EnableRowDoubleClickEvent = true;
this.btnMenuEdit9.Hidden = false;
this.Grid9.EnableRowDoubleClickEvent = true;
this.btnMenuEdit10.Hidden = false;
this.Grid10.EnableRowDoubleClickEvent = true;
this.btnMenuEdit11.Hidden = false;
this.Grid11.EnableRowDoubleClickEvent = true;
this.btnMenuEdit12.Hidden = false;
this.Grid12.EnableRowDoubleClickEvent = true;
this.btnMenuEdit13.Hidden = false;
this.Grid13.EnableRowDoubleClickEvent = true;
this.btnMenuEdit14.Hidden = false;
this.Grid14.EnableRowDoubleClickEvent = true;
this.btnMenuEdit15.Hidden = false;
this.Grid15.EnableRowDoubleClickEvent = true;
}
else
{
this.Grid3.EnableRowDoubleClickEvent = false;
this.Grid4.EnableRowDoubleClickEvent = false;
this.Grid5.EnableRowDoubleClickEvent = false;
this.Grid6.EnableRowDoubleClickEvent = false;
this.Grid7.EnableRowDoubleClickEvent = false;
this.Grid8.EnableRowDoubleClickEvent = false;
this.Grid9.EnableRowDoubleClickEvent = false;
this.Grid10.EnableRowDoubleClickEvent = false;
this.Grid11.EnableRowDoubleClickEvent = false;
this.Grid12.EnableRowDoubleClickEvent = false;
this.Grid13.EnableRowDoubleClickEvent = false;
this.Grid14.EnableRowDoubleClickEvent = false;
this.Grid15.EnableRowDoubleClickEvent = false;
}
if (buttonList.Contains(BLL.Const.BtnManageDelete))
{
this.btnMenuDelete3.Hidden = false;
this.btnMenuDelete4.Hidden = false;
this.btnMenuDelete5.Hidden = false;
this.btnMenuDelete6.Hidden = false;
this.btnMenuDelete7.Hidden = false;
this.btnMenuDelete8.Hidden = false;
this.btnMenuDelete9.Hidden = false;
this.btnMenuDelete10.Hidden = false;
this.btnMenuDelete11.Hidden = false;
this.btnMenuDelete12.Hidden = false;
this.btnMenuDelete13.Hidden = false;
this.btnMenuDelete14.Hidden = false;
this.btnMenuDelete15.Hidden = false;
}
if (buttonList.Contains(BLL.Const.BtnManageView))
{
TabManagement.Hidden = false;
}
else
{
TabManagement.Hidden = true;
}
#endregion
if (buttonList.Contains(BLL.Const.BtnOut))
{
this.btnNCRExport.Hidden = false;
}
if (buttonList.Contains(BLL.Const.FCExport))
{
this.btnExport.Hidden = false;
}
if (buttonList.Contains(BLL.Const.PersonExport))
{
this.btnExport1.Hidden = false;
}
if (buttonList.Contains(BLL.Const.FoExport))
{
this.btnFoExport.Hidden = false;
}
}
}
#endregion
#region
///// <summary>
///// 打印
///// </summary>
///// <param name="sender"></param>
///// <param name="e"></param>
//protected void btnPrint_Click(object sender, EventArgs e)
//{
// if (Grid1.SelectedRowIndexArray.Length == 0)
// {
// Alert.ShowInParent("Please select at least one record!");
// return;
// }
// string ContractNo = Grid1.SelectedRow.Values[1].ToString();
// string sData = StartTime.Text;
// string eData = EndTime.Text;
// PageContext.RegisterStartupScript(Window2.GetShowReference(String.Format("../Report/ReportPrint.aspx?report=4&fcid=" + ContractNo + "&sData=" + sData + "&eData=" + eData + "", "Print - ")));
//}
#endregion
#region
/// <summary>
/// 行绑定后事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_RowDataBound(object sender, GridRowEventArgs e)
{
DataRowView row = e.DataItem as DataRowView;
string id = row["ID"].ToString();
//for (int i = 0; i < this.Grid1.Rows.Count; i++)
//{
if (!string.IsNullOrEmpty(id))
{
var data = BLL.SESRelatedDataService.GetSESRelatedDataById(id);
if (data != null)
{
if (data.Expire_Date.HasValue)
{
if (data.Expire_Date < DateTime.Now)//过期
{
e.RowCssClass = "color2";
}
else if (data.Expire_Date.Value.AddMonths(-6) <= DateTime.Now && data.Expire_Date > DateTime.Now)//六个月后过期
{
e.RowCssClass = "color1";
}
}
if (data.FC_Status == "Closed")
{
e.RowCssClass = "color2";
}
//Remaining Budget/Contract Budget<10 显示红色
var checkedValue = BLL.SESReportService.getSumSSRActualCostByFo(data.FO_NO);
var remainmingBudget = data.Actual_Budget - checkedValue;
if (data.Actual_Budget > 0)
{
var remainmingBudgetRate = remainmingBudget / data.Actual_Budget * 100;
if (remainmingBudgetRate < 10)
{
e.CellCssClasses[30] = "colorRed";
}
}
//如果(合同过期日-今天)/(合同生效总天数)<10显示红色
if (data.Validate_Date.HasValue && data.Expire_Date.HasValue)
{
decimal a = (data.Expire_Date - DateTime.Now).Value.Days;
decimal b = (data.Expire_Date - data.Validate_Date).Value.Days;//合同生效总天数
if (b > 0)
{
decimal c = a / b * 100;
if (c < 10)
{
e.CellCssClasses[31] = "colorRed";
}
}
}
}
}
//}
}
#endregion
#region
/// <summary>
/// 查询
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnSearch_Click(object sender, EventArgs e)
{
string s = this.hdConstRecords.Text.Trim() + "|" +
this.hdFoNo.Text.Trim() + "|" +
this.hdDiscipline.Text.Trim() + "|" +
this.hdContractor.Text.Trim() + "|" +
this.hdContractAdmin.Text.Trim() + "|" +
this.hdBuyer.Text.Trim() + "|" +
this.hdMainCoord.Text.Trim() + "|" +
this.hdMCDepartment.Text.Trim() + "|" +
this.hdFCStatus.Text.Trim() + "|" +
this.hdFoType.Text.Trim() + "|";
string window = String.Format("SESRelatedDataSearch.aspx?s={0}", s, "查询 - ");
PageContext.RegisterStartupScript(Window3.GetSaveStateReference(hdItemsString.ClientID) + Window3.GetShowReference(window));
}
/// <summary>
/// 查询返回值
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window3_Close(object sender, WindowCloseEventArgs e)
{
List<string> lists = Funs.GetStrListByStr(hdItemsString.Text, '|');
this.hdConstRecords.Text = lists[0];
this.hdFoNo.Text = lists[1];
this.hdDiscipline.Text = lists[2];
this.hdContractor.Text = lists[3];
this.hdContractAdmin.Text = lists[4];
this.hdBuyer.Text = lists[5];
this.hdMainCoord.Text = lists[6];
this.hdMCDepartment.Text = lists[7];
this.hdFCStatus.Text = lists[8];
this.hdFoType.Text = lists[9];
BindGrid();
}
#endregion
#region
/// <summary>
/// 查看
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuView_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("Please select at least one record!");
return;
}
string Id = Grid1.SelectedRowID;
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("SESRelatedDataEdit.aspx?id={0}&view=1", Id, "编辑 - ")));
}
#endregion
#region Grid行点击事件
/// <summary>
///Grid行点击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid1_RowSelect(object sender, GridRowSelectEventArgs e)
{
this.hdID.Text = this.Grid1.SelectedRowID;
if (!string.IsNullOrEmpty(this.hdID.Text))
{
var sESRelatedData = BLL.SESRelatedDataService.GetSESRelatedDataById(this.hdID.Text);
if (sESRelatedData != null)
{
GetButtonPower();//权限设置
string cruUser = CurrUser.UserId;
string[] mcdeptLeader = null;
if (!string.IsNullOrEmpty(sESRelatedData.Applicant))
{
string depName = string.Empty;
if (sESRelatedData.Applicant.Contains("/"))
{
depName = sESRelatedData.Applicant.Split('/')[0];
}
else
{
depName = sESRelatedData.Applicant;
}
var dep = from x in Funs.DB.Base_Depart where (x.DepartName == depName || x.DepartName == sESRelatedData.Applicant) && x.DepartLeader != null select x;
if (dep.Count() > 0)
{
if (!string.IsNullOrEmpty(dep.First().DepartLeader))
{
mcdeptLeader = dep.Select(x => x.DepartLeader).ToArray();
}
}
}
if ((!string.IsNullOrEmpty(sESRelatedData.User_Representative) && sESRelatedData.User_Representative.Contains(cruUser)) || (!string.IsNullOrEmpty(sESRelatedData.Main_Coordinator) && sESRelatedData.Main_Coordinator.Contains(cruUser)) || (mcdeptLeader != null && mcdeptLeader.Contains(cruUser)) || cruUser == Const.GlyId)
{
TabSigned.Hidden = false;
TabManagement.Hidden = false;
this.TabStrip1.ActiveTabIndex = 0;
}
var foType = BLL.FOTypeService.GetFoTypeById(sESRelatedData.FOTypeId);
if (foType != null && foType.FOType.Contains("TAR"))
{
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.UserId, BLL.Const.SESRelatedDateMenuId);
if (buttonList.Contains(Const.BtnTARSignedView))
{
TabSigned.Hidden = false;
}
if (buttonList.Contains(Const.BtnTARManageView))
{
TabManagement.Hidden = false;
}
this.TabStrip1.ActiveTabIndex = 0;
}
if (this.TabStrip1.ActiveTabIndex == 0)
{
BindGrid2(this.hdID.Text);
}
else if (this.TabStrip1.ActiveTabIndex == 1)
{
BindGrid3(this.hdID.Text);
}
}
}
}
#endregion
#region
/// <summary>
/// Grid2数据绑定
/// </summary>
/// <param name="id"></param>
private void BindGrid2(string id)
{
string strSql = @"SELECT Signed.FileId,
Signed.FC_ID,
Signed.FileName,
(CASE Signed.FileType WHEN '1' THEN '合同' WHEN '2' THEN '变更的合同' END) AS FileType,
Signed.FileTypeCode,
Signed.UploadMan,
Signed.UploadDate,
Signed.Remark,
Signed.AttachUrl,
U.UserName AS UploadManName
FROM FC_SignedContracts AS Signed
LEFT JOIN Sys_User AS U ON U.UserId = Signed.UploadMan
WHERE Signed.FC_ID = @id ";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@id", id));
if (drpFileType2.SelectedValue != Const._Null)
{
strSql += " AND Signed.FileType=@FileType";
listStr.Add(new SqlParameter("@FileType", drpFileType2.SelectedValue));
}
strSql += " ORDER BY Signed.UploadDate DESC";
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid2.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid2, tb);
Grid2.DataSource = table;
Grid2.DataBind();
for (int i = 0; i < Grid2.Rows.Count; i++)
{
System.Web.UI.WebControls.LinkButton lbtnUrl = ((System.Web.UI.WebControls.LinkButton)(this.Grid2.Rows[i].FindControl("lbtnUrl1")));
string url = lbtnUrl.CommandArgument.ToString();
if (!string.IsNullOrEmpty(url))
{
url = url.Replace('\\', '/');
lbtnUrl.Text = BLL.UploadAttachmentService.ShowAttachment("../", url);
}
}
}
/// <summary>
/// 合同续签
/// </summary>
/// <param name="id"></param>
private void BindGrid3(string id)
{
string strSql = @"SELECT con.FileId,
con.FC_ID,
con.FileName,
'合同续签' as FileTypeId,
con.UploadMan,
con.UploadDate,
con.Remark,
con.AttachUrl,
U.UserName AS UploadManName,
(case when contractor.Contractor is not null
then (case when contractor.ContractorCN is not null
then contractor.Contractor+' '+contractor.ContractorCN
else contractor.Contractor end)
else contractor.ContractorCN end) as Contractor,
fc.PreviousFO,
fc.FO_NO
FROM FC_ContractManagement AS con
LEFT JOIN Sys_User AS U ON U.UserId = con.UploadMan
LEFT JOIN FC_SESRelatedData AS fc on fc.ID = con.FC_ID
left join Base_Contractor as contractor on contractor.ContractorId = fc.Contractor
WHERE con.FileTypeId='1' and con.FC_ID=@id ";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@id", id));
strSql += " ORDER BY con.UploadDate DESC";
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid3.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid3, tb);
Grid3.DataSource = table;
Grid3.DataBind();
for (int i = 0; i < Grid3.Rows.Count; i++)
{
System.Web.UI.WebControls.LinkButton lbtnUrl = ((System.Web.UI.WebControls.LinkButton)(this.Grid3.Rows[i].FindControl("lbtnUrl2")));
string url = lbtnUrl.CommandArgument.ToString();
if (!string.IsNullOrEmpty(url))
{
url = url.Replace('\\', '/');
lbtnUrl.Text = BLL.UploadAttachmentService.ShowAttachment("../", url);
}
}
}
/// <summary>
/// 费用增补
/// </summary>
/// <param name="id"></param>
private void BindGrid4(string id)
{
string strSql = @"SELECT con.FileId,
con.FC_ID,
con.FileName,
'费用增补' as FileTypeId,
con.UploadMan,
con.UploadDate,
con.Remark,
con.AttachUrl,
U.UserName AS UploadManName,
SupplementedBudget,
TotalBudget,
(case when contractor.Contractor is not null
then (case when contractor.ContractorCN is not null
then contractor.Contractor+' '+contractor.ContractorCN
else contractor.Contractor end)
else contractor.ContractorCN end) as Contractor,
fc.FO_NO,
fc.InitialBudget
FROM FC_ContractManagement AS con
LEFT JOIN Sys_User AS U ON U.UserId = con.UploadMan
LEFT JOIN FC_SESRelatedData AS fc on fc.ID = con.FC_ID
left join Base_Contractor as contractor on contractor.ContractorId = fc.Contractor
WHERE con.FileTypeId='2' and con.FC_ID=@id ";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@id", id));
strSql += " ORDER BY con.UploadDate DESC";
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid4.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid4, tb);
Grid4.DataSource = table;
Grid4.DataBind();
for (int i = 0; i < Grid4.Rows.Count; i++)
{
System.Web.UI.WebControls.LinkButton lbtnUrl = ((System.Web.UI.WebControls.LinkButton)(this.Grid4.Rows[i].FindControl("lbtnUrl3")));
string url = lbtnUrl.CommandArgument.ToString();
if (!string.IsNullOrEmpty(url))
{
url = url.Replace('\\', '/');
lbtnUrl.Text = BLL.UploadAttachmentService.ShowAttachment("../", url);
}
}
}
/// <summary>
/// 份额变更
/// </summary>
/// <param name="id"></param>
private void BindGrid5(string id)
{
string strSql = @"SELECT con.FileId,
con.FC_ID,
con.FileName,
'份额变更' as FileTypeId,
con.UploadMan,
con.UploadDate,
con.Remark,
con.AttachUrl,
U.UserName AS UploadManName,
SupplementedBudget,
TotalBudget,
(case when contractor.Contractor is not null
then (case when contractor.ContractorCN is not null
then contractor.Contractor+' '+contractor.ContractorCN
else contractor.Contractor end)
else contractor.ContractorCN end) as Contractor,
fc.FO_NO,
fc.InitialBudget,
(fc.Proportion_of_FC_Definition*100.0) as CurrentAllocation
FROM FC_ContractManagement AS con
LEFT JOIN Sys_User AS U ON U.UserId = con.UploadMan
LEFT JOIN FC_SESRelatedData AS fc on fc.ID = con.FC_ID
left join Base_Contractor as contractor on contractor.ContractorId = fc.Contractor
WHERE con.FileTypeId='3' and con.FC_ID=@id ";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@id", id));
strSql += " ORDER BY con.UploadDate DESC";
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid5.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid5, tb);
Grid5.DataSource = table;
Grid5.DataBind();
for (int i = 0; i < Grid5.Rows.Count; i++)
{
System.Web.UI.WebControls.LinkButton lbtnUrl = ((System.Web.UI.WebControls.LinkButton)(this.Grid5.Rows[i].FindControl("lbtnUrl4")));
string url = lbtnUrl.CommandArgument.ToString();
if (!string.IsNullOrEmpty(url))
{
url = url.Replace('\\', '/');
lbtnUrl.Text = BLL.UploadAttachmentService.ShowAttachment("../", url);
}
}
}
/// <summary>
/// 短期续延
/// </summary>
/// <param name="id"></param>
private void BindGrid6(string id)
{
string strSql = @"SELECT con.FileId,
con.FC_ID,
con.FileName,
'短期续延' as FileTypeId,
con.UploadMan,
con.UploadDate,
con.Remark,
con.AttachUrl,
U.UserName AS UploadManName,
SupplementedBudget,
TotalBudget,
(case when contractor.Contractor is not null
then (case when contractor.ContractorCN is not null
then contractor.Contractor+' '+contractor.ContractorCN
else contractor.Contractor end)
else contractor.ContractorCN end) as Contractor,
fc.FO_NO,
StartDate,
EndDate
FROM FC_ContractManagement AS con
LEFT JOIN Sys_User AS U ON U.UserId = con.UploadMan
LEFT JOIN FC_SESRelatedData AS fc on fc.ID = con.FC_ID
left join Base_Contractor as contractor on contractor.ContractorId = fc.Contractor
WHERE con.FileTypeId='4' and con.FC_ID=@id ";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@id", id));
strSql += " ORDER BY con.UploadDate DESC";
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid6.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid6, tb);
Grid6.DataSource = table;
Grid6.DataBind();
for (int i = 0; i < Grid6.Rows.Count; i++)
{
System.Web.UI.WebControls.LinkButton lbtnUrl = ((System.Web.UI.WebControls.LinkButton)(this.Grid6.Rows[i].FindControl("lbtnUrl5")));
string url = lbtnUrl.CommandArgument.ToString();
if (!string.IsNullOrEmpty(url))
{
url = url.Replace('\\', '/');
lbtnUrl.Text = BLL.UploadAttachmentService.ShowAttachment("../", url);
}
}
}
/// <summary>
/// 承包商EHSQ审计报告
/// </summary>
/// <param name="id"></param>
private void BindGrid7(string id)
{
string strSql = @"SELECT con.FileId,
con.FC_ID,
con.FileName,
'EHSQ审计报告' as FileTypeId,
con.UploadMan,
con.UploadDate,
con.Remark,
con.AttachUrl,
U.UserName AS UploadManName,
(case when contractor.Contractor is not null
then (case when contractor.ContractorCN is not null
then contractor.Contractor+' '+contractor.ContractorCN
else contractor.Contractor end)
else contractor.ContractorCN end) as Contractor,
fc.FO_NO,
AuditDate,
con.AuditResult,
t.Type as ContractorType
FROM FC_ContractManagement AS con
LEFT JOIN Sys_User AS U ON U.UserId = con.UploadMan
LEFT JOIN FC_SESRelatedData AS fc on fc.ID = con.FC_ID
left join Base_Contractor as contractor on contractor.ContractorId = fc.Contractor
left join Base_Type as t on t.TypeId = fc.Type
WHERE con.FileTypeId='5' and con.FC_ID=@id ";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@id", id));
strSql += " ORDER BY con.UploadDate DESC";
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid7.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid7, tb);
Grid7.DataSource = table;
Grid7.DataBind();
for (int i = 0; i < Grid7.Rows.Count; i++)
{
System.Web.UI.WebControls.LinkButton lbtnUrl = ((System.Web.UI.WebControls.LinkButton)(this.Grid7.Rows[i].FindControl("lbtnUrl6")));
string url = lbtnUrl.CommandArgument.ToString();
if (!string.IsNullOrEmpty(url))
{
url = url.Replace('\\', '/');
lbtnUrl.Text = BLL.UploadAttachmentService.ShowAttachment("../", url);
}
}
}
/// <summary>
/// NCR
/// </summary>
/// <param name="id"></param>
private void BindGrid8(string id)
{
string strSql = @"SELECT con.FileId,
con.FC_ID,
con.FileName,
'NCR' as FileTypeId,
con.UploadMan,
con.UploadDate,
con.Remark,
con.AttachUrl,
U.UserName AS UploadManName,
con.OccurDate,
fc.FO_NO,
dep.DepartName
FROM FC_ContractManagement AS con
LEFT JOIN Sys_User AS U ON U.UserId = con.UploadMan
left join Base_Depart as dep on dep.DepartId = con.BycDept
LEFT JOIN FC_SESRelatedData AS fc on fc.ID = con.FC_ID
WHERE con.FileTypeId='6' and con.FC_ID=@id ";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@id", id));
//if (this.drpFileType.SelectedValue!=BLL.Const._Null)
//{
// strSql += " AND con.FileTypeId=@fileTypeId ";
// listStr.Add(new SqlParameter("@fileTypeId", this.drpFileType.SelectedValue));
//}
strSql += " ORDER BY con.UploadDate DESC";
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid8.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid8, tb);
Grid8.DataSource = table;
Grid8.DataBind();
for (int i = 0; i < Grid8.Rows.Count; i++)
{
System.Web.UI.WebControls.LinkButton lbtnUrl = ((System.Web.UI.WebControls.LinkButton)(this.Grid8.Rows[i].FindControl("lbtnUrl8")));
string url = lbtnUrl.CommandArgument.ToString();
if (!string.IsNullOrEmpty(url))
{
url = url.Replace('\\', '/');
lbtnUrl.Text = BLL.UploadAttachmentService.ShowAttachment("../", url);
}
}
}
/// <summary>
/// 合同约谈
/// </summary>
/// <param name="id"></param>
private void BindGrid9(string id)
{
string strSql = @"SELECT con.FileId,
con.FC_ID,
con.FileName,
'合同约谈' as FileTypeId,
con.UploadMan,
con.UploadDate,
con.Remark,
con.AttachUrl,
U.UserName AS UploadManName,
con.OccurDate,
dep.DepartName,
fc.FO_NO
FROM FC_ContractManagement AS con
LEFT JOIN Sys_User AS U ON U.UserId = con.UploadMan
left join Base_Depart as dep on dep.DepartId = con.BycDept
LEFT JOIN FC_SESRelatedData AS fc on fc.ID = con.FC_ID
WHERE con.FileTypeId='7' and con.FC_ID=@id ";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@id", id));
//if (this.drpFileType.SelectedValue!=BLL.Const._Null)
//{
// strSql += " AND con.FileTypeId=@fileTypeId ";
// listStr.Add(new SqlParameter("@fileTypeId", this.drpFileType.SelectedValue));
//}
strSql += " ORDER BY con.UploadDate DESC";
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid9.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid9, tb);
Grid9.DataSource = table;
Grid9.DataBind();
for (int i = 0; i < Grid9.Rows.Count; i++)
{
System.Web.UI.WebControls.LinkButton lbtnUrl = ((System.Web.UI.WebControls.LinkButton)(this.Grid9.Rows[i].FindControl("lbtnUrl9")));
string url = lbtnUrl.CommandArgument.ToString();
if (!string.IsNullOrEmpty(url))
{
url = url.Replace('\\', '/');
lbtnUrl.Text = BLL.UploadAttachmentService.ShowAttachment("../", url);
}
}
}
/// <summary>
/// 开工会
/// </summary>
/// <param name="id"></param>
private void BindGrid10(string id)
{
string strSql = @"SELECT con.FileId,
con.FC_ID,
con.FileName,
'开工会' as FileTypeId,
con.UploadMan,
con.UploadDate,
con.Remark,
con.AttachUrl,
U.UserName AS UploadManName,
con.OccurDate,
dep.DepartName,
fc.FO_NO
FROM FC_ContractManagement AS con
LEFT JOIN Sys_User AS U ON U.UserId = con.UploadMan
left join Base_Depart as dep on dep.DepartId = con.BycDept
LEFT JOIN FC_SESRelatedData AS fc on fc.ID = con.FC_ID
WHERE con.FileTypeId='8' and con.FC_ID=@id ";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@id", id));
//if (this.drpFileType.SelectedValue!=BLL.Const._Null)
//{
// strSql += " AND con.FileTypeId=@fileTypeId ";
// listStr.Add(new SqlParameter("@fileTypeId", this.drpFileType.SelectedValue));
//}
strSql += " ORDER BY con.UploadDate DESC";
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid10.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid10, tb);
Grid10.DataSource = table;
Grid10.DataBind();
for (int i = 0; i < Grid10.Rows.Count; i++)
{
System.Web.UI.WebControls.LinkButton lbtnUrl = ((System.Web.UI.WebControls.LinkButton)(this.Grid10.Rows[i].FindControl("lbtnUrl10")));
string url = lbtnUrl.CommandArgument.ToString();
if (!string.IsNullOrEmpty(url))
{
url = url.Replace('\\', '/');
lbtnUrl.Text = BLL.UploadAttachmentService.ShowAttachment("../", url);
}
}
}
/// <summary>
/// 会议纪要
/// </summary>
/// <param name="id"></param>
private void BindGrid11(string id)
{
string strSql = @"SELECT con.FileId,
con.FC_ID,
con.FileName,
'会议纪要' as FileTypeId,
con.UploadMan,
con.UploadDate,
con.Remark,
con.AttachUrl,
U.UserName AS UploadManName,
con.OccurDate,
dep.DepartName,
fc.FO_NO
FROM FC_ContractManagement AS con
LEFT JOIN Sys_User AS U ON U.UserId = con.UploadMan
left join Base_Depart as dep on dep.DepartId = con.BycDept
LEFT JOIN FC_SESRelatedData AS fc on fc.ID = con.FC_ID
WHERE con.FileTypeId='9' and con.FC_ID=@id ";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@id", id));
//if (this.drpFileType.SelectedValue!=BLL.Const._Null)
//{
// strSql += " AND con.FileTypeId=@fileTypeId ";
// listStr.Add(new SqlParameter("@fileTypeId", this.drpFileType.SelectedValue));
//}
strSql += " ORDER BY con.UploadDate DESC";
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid11.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid11, tb);
Grid11.DataSource = table;
Grid11.DataBind();
for (int i = 0; i < Grid11.Rows.Count; i++)
{
System.Web.UI.WebControls.LinkButton lbtnUrl = ((System.Web.UI.WebControls.LinkButton)(this.Grid11.Rows[i].FindControl("lbtnUrl11")));
string url = lbtnUrl.CommandArgument.ToString();
if (!string.IsNullOrEmpty(url))
{
url = url.Replace('\\', '/');
lbtnUrl.Text = BLL.UploadAttachmentService.ShowAttachment("../", url);
}
}
}
/// <summary>
/// 停工整改报告
/// </summary>
/// <param name="id"></param>
private void BindGrid12(string id)
{
string strSql = @"SELECT con.FileId,
con.FC_ID,
con.FileName,
'停工整改报告' as FileTypeId,
con.UploadMan,
con.UploadDate,
con.Remark,
con.AttachUrl,
U.UserName AS UploadManName,
con.OccurDate,
dep.DepartName,
fc.FO_NO
FROM FC_ContractManagement AS con
LEFT JOIN Sys_User AS U ON U.UserId = con.UploadMan
left join Base_Depart as dep on dep.DepartId = con.BycDept
LEFT JOIN FC_SESRelatedData AS fc on fc.ID = con.FC_ID
WHERE con.FileTypeId='10' and con.FC_ID=@id ";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@id", id));
//if (this.drpFileType.SelectedValue!=BLL.Const._Null)
//{
// strSql += " AND con.FileTypeId=@fileTypeId ";
// listStr.Add(new SqlParameter("@fileTypeId", this.drpFileType.SelectedValue));
//}
strSql += " ORDER BY con.UploadDate DESC";
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid12.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid12, tb);
Grid12.DataSource = table;
Grid12.DataBind();
for (int i = 0; i < Grid12.Rows.Count; i++)
{
System.Web.UI.WebControls.LinkButton lbtnUrl = ((System.Web.UI.WebControls.LinkButton)(this.Grid12.Rows[i].FindControl("lbtnUrl12")));
string url = lbtnUrl.CommandArgument.ToString();
if (!string.IsNullOrEmpty(url))
{
url = url.Replace('\\', '/');
lbtnUrl.Text = BLL.UploadAttachmentService.ShowAttachment("../", url);
}
}
}
/// <summary>
/// 合同终止
/// </summary>
/// <param name="id"></param>
private void BindGrid13(string id)
{
string strSql = @"SELECT con.FileId,
con.FC_ID,
con.FileName,
'合同终止' as FileTypeId,
con.UploadMan,
con.UploadDate,
con.Remark,
con.AttachUrl,
U.UserName AS UploadManName,
con.OccurDate,
dep.DepartName,
fc.FO_NO
FROM FC_ContractManagement AS con
LEFT JOIN Sys_User AS U ON U.UserId = con.UploadMan
left join Base_Depart as dep on dep.DepartId = con.BycDept
LEFT JOIN FC_SESRelatedData AS fc on fc.ID = con.FC_ID
WHERE con.FileTypeId='11' and con.FC_ID=@id ";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@id", id));
//if (this.drpFileType.SelectedValue!=BLL.Const._Null)
//{
// strSql += " AND con.FileTypeId=@fileTypeId ";
// listStr.Add(new SqlParameter("@fileTypeId", this.drpFileType.SelectedValue));
//}
strSql += " ORDER BY con.UploadDate DESC";
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid13.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid13, tb);
Grid13.DataSource = table;
Grid13.DataBind();
for (int i = 0; i < Grid13.Rows.Count; i++)
{
System.Web.UI.WebControls.LinkButton lbtnUrl = ((System.Web.UI.WebControls.LinkButton)(this.Grid13.Rows[i].FindControl("lbtnUrl13")));
string url = lbtnUrl.CommandArgument.ToString();
if (!string.IsNullOrEmpty(url))
{
url = url.Replace('\\', '/');
lbtnUrl.Text = BLL.UploadAttachmentService.ShowAttachment("../", url);
}
}
}
/// <summary>
/// 组织架构
/// </summary>
/// <param name="id"></param>
private void BindGrid14(string id)
{
string strSql = @"SELECT con.FileId,
con.FC_ID,
con.FileName,
'组织架构' as FileTypeId,
con.UploadMan,
con.UploadDate,
con.Remark,
con.AttachUrl,
U.UserName AS UploadManName,
con.OccurDate,
dep.DepartName,
fc.FO_NO
FROM FC_ContractManagement AS con
LEFT JOIN Sys_User AS U ON U.UserId = con.UploadMan
left join Base_Depart as dep on dep.DepartId = con.BycDept
LEFT JOIN FC_SESRelatedData AS fc on fc.ID = con.FC_ID
WHERE con.FileTypeId='12' and con.FC_ID=@id ";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@id", id));
//if (this.drpFileType.SelectedValue!=BLL.Const._Null)
//{
// strSql += " AND con.FileTypeId=@fileTypeId ";
// listStr.Add(new SqlParameter("@fileTypeId", this.drpFileType.SelectedValue));
//}
strSql += " ORDER BY con.UploadDate DESC";
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid14.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid14, tb);
Grid14.DataSource = table;
Grid14.DataBind();
for (int i = 0; i < Grid14.Rows.Count; i++)
{
System.Web.UI.WebControls.LinkButton lbtnUrl = ((System.Web.UI.WebControls.LinkButton)(this.Grid14.Rows[i].FindControl("lbtnUrl14")));
string url = lbtnUrl.CommandArgument.ToString();
if (!string.IsNullOrEmpty(url))
{
url = url.Replace('\\', '/');
lbtnUrl.Text = BLL.UploadAttachmentService.ShowAttachment("../", url);
}
}
}
/// <summary>
/// 框架承包商评估表
/// </summary>
/// <param name="id"></param>
private void BindGrid15(string id)
{
string strSql = @"SELECT con.FileId,
con.FC_ID,
con.FileName,
'框架承包商评估表' as FileTypeId,
con.UploadMan,
con.UploadDate,
con.Remark,
con.AttachUrl,
U.UserName AS UploadManName,
con.OccurDate,
dep.DepartName,
fc.FO_NO
FROM FC_ContractManagement AS con
LEFT JOIN Sys_User AS U ON U.UserId = con.UploadMan
left join Base_Depart as dep on dep.DepartId = con.BycDept
LEFT JOIN FC_SESRelatedData AS fc on fc.ID = con.FC_ID
WHERE con.FileTypeId='13' and con.FC_ID=@id ";
List<SqlParameter> listStr = new List<SqlParameter>();
listStr.Add(new SqlParameter("@id", id));
//if (this.drpFileType.SelectedValue!=BLL.Const._Null)
//{
// strSql += " AND con.FileTypeId=@fileTypeId ";
// listStr.Add(new SqlParameter("@fileTypeId", this.drpFileType.SelectedValue));
//}
strSql += " ORDER BY con.UploadDate DESC";
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
Grid15.RecordCount = tb.Rows.Count;
var table = this.GetPagedDataTable(Grid15, tb);
Grid15.DataSource = table;
Grid15.DataBind();
for (int i = 0; i < Grid15.Rows.Count; i++)
{
System.Web.UI.WebControls.LinkButton lbtnUrl = ((System.Web.UI.WebControls.LinkButton)(this.Grid15.Rows[i].FindControl("lbtnUrl15")));
string url = lbtnUrl.CommandArgument.ToString();
if (!string.IsNullOrEmpty(url))
{
url = url.Replace('\\', '/');
lbtnUrl.Text = BLL.UploadAttachmentService.ShowAttachment("../", url);
}
}
}
#endregion
#region
/// <summary>
/// 选项卡改变事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void TabStrip1_TabIndexChanged(object sender, EventArgs e)
{
this.hdID.Text = string.Empty;
if (!string.IsNullOrEmpty(this.Grid1.SelectedRowID))
{
this.hdID.Text = this.Grid1.SelectedRowID;
}
else
{
if (!string.IsNullOrEmpty(Grid1.Rows[0].RowID))
{
this.hdID.Text = Grid1.Rows[0].RowID;
}
}
if (!string.IsNullOrEmpty(this.hdID.Text))
{
var sESRelatedData = BLL.SESRelatedDataService.GetSESRelatedDataById(this.hdID.Text);
if (sESRelatedData != null)
{
string cruUser = CurrUser.UserId;
string mcdeptLeader = string.Empty;
if (this.TabStrip1.ActiveTabIndex == 0)
{
BindGrid2(this.hdID.Text);
}
else if (this.TabStrip1.ActiveTabIndex == 1)
{
if (this.TabStrip2.ActiveTabIndex == 0)
{
BindGrid3(this.hdID.Text);
}
else if (this.TabStrip2.ActiveTabIndex == 1)
{
BindGrid4(this.hdID.Text);
}
else if (this.TabStrip2.ActiveTabIndex == 2)
{
BindGrid5(this.hdID.Text);
}
else if (this.TabStrip2.ActiveTabIndex == 3)
{
BindGrid6(this.hdID.Text);
}
else if (this.TabStrip2.ActiveTabIndex == 4)
{
BindGrid7(this.hdID.Text);
}
else if (this.TabStrip2.ActiveTabIndex == 5)
{
BindGrid8(this.hdID.Text);
}
else if (this.TabStrip2.ActiveTabIndex == 6)
{
BindGrid9(this.hdID.Text);
}
else if (this.TabStrip2.ActiveTabIndex == 7)
{
BindGrid10(this.hdID.Text);
}
else if (this.TabStrip2.ActiveTabIndex == 8)
{
BindGrid11(this.hdID.Text);
}
else if (this.TabStrip2.ActiveTabIndex == 9)
{
BindGrid12(this.hdID.Text);
}
else if (this.TabStrip2.ActiveTabIndex == 10)
{
BindGrid13(this.hdID.Text);
}
else if (this.TabStrip2.ActiveTabIndex == 11)
{
BindGrid14(this.hdID.Text);
}
else if (this.TabStrip2.ActiveTabIndex == 12)
{
BindGrid15(this.hdID.Text);
}
}
}
}
}
protected void TabStrip2_TabIndexChanged(object sender, EventArgs e)
{
this.hdID.Text = string.Empty;
if (!string.IsNullOrEmpty(this.Grid1.SelectedRowID))
{
this.hdID.Text = this.Grid1.SelectedRowID;
}
else
{
if (!string.IsNullOrEmpty(Grid1.Rows[0].RowID))
{
this.hdID.Text = Grid1.Rows[0].RowID;
}
}
if (!string.IsNullOrEmpty(this.hdID.Text))
{
var sESRelatedData = BLL.SESRelatedDataService.GetSESRelatedDataById(this.hdID.Text);
if (sESRelatedData != null)
{
string cruUser = CurrUser.UserId;
string mcdeptLeader = string.Empty;
if (this.TabStrip2.ActiveTabIndex == 0)
{
BindGrid3(this.hdID.Text);
}
else if (this.TabStrip2.ActiveTabIndex == 1)
{
BindGrid4(this.hdID.Text);
}
else if (this.TabStrip2.ActiveTabIndex == 2)
{
BindGrid5(this.hdID.Text);
}
else if (this.TabStrip2.ActiveTabIndex == 3)
{
BindGrid6(this.hdID.Text);
}
else if (this.TabStrip2.ActiveTabIndex == 4)
{
BindGrid7(this.hdID.Text);
}
else if (this.TabStrip2.ActiveTabIndex == 5)
{
BindGrid8(this.hdID.Text);
}
else if (this.TabStrip2.ActiveTabIndex == 6)
{
BindGrid9(this.hdID.Text);
}
else if (this.TabStrip2.ActiveTabIndex == 7)
{
BindGrid10(this.hdID.Text);
}
else if (this.TabStrip2.ActiveTabIndex == 8)
{
BindGrid11(this.hdID.Text);
}
else if (this.TabStrip2.ActiveTabIndex == 9)
{
BindGrid12(this.hdID.Text);
}
else if (this.TabStrip2.ActiveTabIndex == 10)
{
BindGrid13(this.hdID.Text);
}
else if (this.TabStrip2.ActiveTabIndex == 11)
{
BindGrid14(this.hdID.Text);
}
else if (this.TabStrip2.ActiveTabIndex == 12)
{
BindGrid15(this.hdID.Text);
}
}
}
}
#endregion
#region Signed Contracts
/// <summary>
/// Signed Contracts
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
//protected void btnSignedContracts_Click(object sender, EventArgs e)
//{
// if (Grid1.SelectedRowIndexArray.Length == 0)
// {
// Alert.ShowInParent("Please select at least one record!");
// return;
// }
// string Id = Grid1.SelectedRowID;
// PageContext.RegisterStartupScript(Window4.GetShowReference(String.Format("SESRelatedDataSigned.aspx?id={0}", Id, "编辑 - ")));
//}
protected void btnAddFile2_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("Please select FC Record!");
return;
}
if (drpFileType2Select.SelectedValue == Const._Null)
{
Alert.ShowInParent("Please select FileType!");
return;
}
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../AttachFile/webuploader3.aspx?type=add&toKeyId={0}&path=FileUpload/SES/SESRelatedData/SignedContracts&menuId={1}&mainTableId={2}", drpFileType2Select.SelectedValue, BLL.Const.SESRelatedDateMenuId, Grid1.SelectedRowID)));
}
/// <summary>
/// Grid2行双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid2_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
btnMenuEdit2_Click(null, null);
}
/// <summary>
/// Grid2右键编辑
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuEdit2_Click(object sender, EventArgs e)
{
if (Grid2.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("Please select Signed Contracts!");
return;
}
string fileId = Grid2.SelectedRowID;
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../AttachFile/webuploader3.aspx?type=edit&toKeyId={0}&path=FileUpload/SES/SESRelatedData/SignedContracts&menuId={1}", fileId, BLL.Const.SESRelatedDateMenuId)));
//PageContext.RegisterStartupScript(Window4.GetShowReference(String.Format("SESRelatedDataSigned.aspx?fileId={0}", fileId, "编辑 - ")));
}
/// <summary>
/// Grid2右键删除
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDelete2_Click(object sender, EventArgs e)
{
if (Grid2.SelectedRowIndexArray.Length > 0)
{
foreach (int rowIndex in Grid2.SelectedRowIndexArray)
{
string rowID = Grid2.DataKeys[rowIndex][0].ToString();
var signedContracts = BLL.SignedContractsService.GetSignedContractsById(rowID);
if (signedContracts != null)
{
BLL.SignedContractsService.DeleteSignedContractsById(rowID);
}
}
BindGrid2(this.hdID.Text);
BLL.Sys_LogService.AddLog(this.CurrUser.UserId, "Delete Signed Contracts");
ShowNotify("Deleted successfully!");
}
}
protected void drpFileType2_OnSelectedIndexChanged(object sender, EventArgs e)
{
BindGrid2(this.hdID.Text);
}
/// <summary>
/// 关闭Signed Contracts弹出框
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void WindowAtt_Close(object sender, WindowCloseEventArgs e)
{
BindGrid2(this.hdID.Text);
BindGrid3(this.hdID.Text);
}
#endregion
#region Contract Management
/// <summary>
/// Contract Management
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
//protected void btnContractManagement_Click(object sender, EventArgs e)
//{
// if (Grid1.SelectedRowIndexArray.Length == 0)
// {
// Alert.ShowInParent("Please select at least one record!");
// return;
// }
// string Id = Grid1.SelectedRowID;
// //PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("SESRelatedDataContractManage.aspx?id={0}", Id, "编辑 - ")));
//}
#region
protected void btnAddFile3_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("Please select FC Record!");
return;
}
string Id = Grid1.SelectedRowID;
PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("SESRelatedDataContractManage1.aspx?id={0}", Id, "编辑 - ")));
}
/// <summary>
/// Grid3行双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid3_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
btnMenuEdit3_Click(null, null);
}
/// <summary>
/// Grid3右键编辑
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuEdit3_Click(object sender, EventArgs e)
{
if (Grid3.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("Please select at least one record!");
return;
}
string fileId = Grid3.SelectedRowID;
PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("SESRelatedDataContractManage1.aspx?fileId={0}", fileId, "编辑 - ")));
}
/// <summary>
/// Grid3右键删除
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDelete3_Click(object sender, EventArgs e)
{
if (Grid3.SelectedRowIndexArray.Length > 0)
{
foreach (int rowIndex in Grid3.SelectedRowIndexArray)
{
string rowID = Grid3.DataKeys[rowIndex][0].ToString();
var contracts = BLL.ContractManagementService.GetContractManagementById(rowID);
if (contracts != null)
{
BLL.ContractManagementService.DeleteContractManagementById(rowID);
}
}
BindGrid3(this.hdID.Text);
BLL.Sys_LogService.AddLog(this.CurrUser.UserId, "删除合同续签");
ShowNotify("Deleted successfully!");
}
}
protected void drpFileType_SelectedIndexChanged(object sender, EventArgs e)
{
BindGrid8(this.hdID.Text);
}
#endregion
#region
protected void btnAddFile4_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("Please select FC Record!");
return;
}
string Id = Grid1.SelectedRowID;
PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("SESRelatedDataContractManage2.aspx?id={0}", Id, "编辑 - ")));
}
/// <summary>
/// Grid3行双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid4_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
btnMenuEdit4_Click(null, null);
}
/// <summary>
/// Grid3右键编辑
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuEdit4_Click(object sender, EventArgs e)
{
if (Grid4.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("Please select at least one record!");
return;
}
string fileId = Grid4.SelectedRowID;
PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("SESRelatedDataContractManage2.aspx?fileId={0}", fileId, "编辑 - ")));
}
/// <summary>
/// Grid3右键删除
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDelete4_Click(object sender, EventArgs e)
{
if (Grid4.SelectedRowIndexArray.Length > 0)
{
foreach (int rowIndex in Grid4.SelectedRowIndexArray)
{
string rowID = Grid4.DataKeys[rowIndex][0].ToString();
var contracts = BLL.ContractManagementService.GetContractManagementById(rowID);
if (contracts != null)
{
BLL.ContractManagementService.DeleteContractManagementById(rowID);
}
}
BindGrid4(this.hdID.Text);
BLL.Sys_LogService.AddLog(this.CurrUser.UserId, "删除费用增补");
ShowNotify("Deleted successfully!");
}
}
#endregion
#region
protected void btnAddFile5_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("Please select FC Record!");
return;
}
string Id = Grid1.SelectedRowID;
PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("SESRelatedDataContractManage3.aspx?id={0}", Id, "编辑 - ")));
}
/// <summary>
/// Grid3行双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid5_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
btnMenuEdit5_Click(null, null);
}
/// <summary>
/// Grid3右键编辑
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuEdit5_Click(object sender, EventArgs e)
{
if (Grid5.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("Please select at least one record!");
return;
}
string fileId = Grid5.SelectedRowID;
PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("SESRelatedDataContractManage3.aspx?fileId={0}", fileId, "编辑 - ")));
}
/// <summary>
/// Grid3右键删除
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDelete5_Click(object sender, EventArgs e)
{
if (Grid5.SelectedRowIndexArray.Length > 0)
{
foreach (int rowIndex in Grid5.SelectedRowIndexArray)
{
string rowID = Grid5.DataKeys[rowIndex][0].ToString();
var contracts = BLL.ContractManagementService.GetContractManagementById(rowID);
if (contracts != null)
{
BLL.ContractManagementService.DeleteContractManagementById(rowID);
}
}
BindGrid5(this.hdID.Text);
BLL.Sys_LogService.AddLog(this.CurrUser.UserId, "删除份额变更");
ShowNotify("Deleted successfully!");
}
}
#endregion
#region
protected void btnAddFile6_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("Please select FC Record!");
return;
}
string Id = Grid1.SelectedRowID;
PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("SESRelatedDataContractManage4.aspx?id={0}", Id, "编辑 - ")));
}
/// <summary>
/// Grid3行双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid6_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
btnMenuEdit6_Click(null, null);
}
/// <summary>
/// Grid3右键编辑
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuEdit6_Click(object sender, EventArgs e)
{
if (Grid6.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("Please select at least one record!");
return;
}
string fileId = Grid6.SelectedRowID;
PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("SESRelatedDataContractManage4.aspx?fileId={0}", fileId, "编辑 - ")));
}
/// <summary>
/// Grid3右键删除
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDelete6_Click(object sender, EventArgs e)
{
if (Grid6.SelectedRowIndexArray.Length > 0)
{
foreach (int rowIndex in Grid6.SelectedRowIndexArray)
{
string rowID = Grid6.DataKeys[rowIndex][0].ToString();
var contracts = BLL.ContractManagementService.GetContractManagementById(rowID);
if (contracts != null)
{
BLL.ContractManagementService.DeleteContractManagementById(rowID);
}
}
BindGrid6(this.hdID.Text);
BLL.Sys_LogService.AddLog(this.CurrUser.UserId, "删除短期续延");
ShowNotify("Deleted successfully!");
}
}
#endregion
#region EHSQ审计报告
protected void btnAddFile7_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("Please select FC Record!");
return;
}
string Id = Grid1.SelectedRowID;
PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("SESRelatedDataContractManage5.aspx?id={0}", Id, "编辑 - ")));
}
/// <summary>
/// Grid3行双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid7_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
btnMenuEdit7_Click(null, null);
}
/// <summary>
/// Grid3右键编辑
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuEdit7_Click(object sender, EventArgs e)
{
if (Grid7.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("Please select at least one record!");
return;
}
string fileId = Grid7.SelectedRowID;
PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("SESRelatedDataContractManage5.aspx?fileId={0}", fileId, "编辑 - ")));
}
/// <summary>
/// Grid3右键删除
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDelete7_Click(object sender, EventArgs e)
{
if (Grid7.SelectedRowIndexArray.Length > 0)
{
foreach (int rowIndex in Grid7.SelectedRowIndexArray)
{
string rowID = Grid7.DataKeys[rowIndex][0].ToString();
var contracts = BLL.ContractManagementService.GetContractManagementById(rowID);
if (contracts != null)
{
BLL.ContractManagementService.DeleteContractManagementById(rowID);
}
}
BindGrid7(this.hdID.Text);
BLL.Sys_LogService.AddLog(this.CurrUser.UserId, "删除承包商EHSQ审计报告");
ShowNotify("Deleted successfully!");
}
}
#endregion
#region NCR
protected void btnAddFile_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("Please select FC Record!");
return;
}
string Id = Grid1.SelectedRowID;
PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("SESRelatedDataContractManage6.aspx?id={0}", Id, "编辑 - ")));
}
/// <summary>
/// Grid3行双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid8_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
btnMenuEdit8_Click(null, null);
}
/// <summary>
/// Grid3右键编辑
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuEdit8_Click(object sender, EventArgs e)
{
if (Grid8.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("Please select at least one record!");
return;
}
string fileId = Grid8.SelectedRowID;
PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("SESRelatedDataContractManage6.aspx?fileId={0}", fileId, "编辑 - ")));
}
/// <summary>
/// Grid3右键删除
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDelete8_Click(object sender, EventArgs e)
{
if (Grid8.SelectedRowIndexArray.Length > 0)
{
foreach (int rowIndex in Grid8.SelectedRowIndexArray)
{
string rowID = Grid8.DataKeys[rowIndex][0].ToString();
var contracts = BLL.ContractManagementService.GetContractManagementById(rowID);
if (contracts != null)
{
BLL.ContractManagementService.DeleteContractManagementById(rowID);
}
}
BindGrid8(this.hdID.Text);
BLL.Sys_LogService.AddLog(this.CurrUser.UserId, "删除NCR合同");
ShowNotify("Deleted successfully!");
}
}
#endregion
#region
protected void btnAddFile9_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("Please select FC Record!");
return;
}
string Id = Grid1.SelectedRowID;
PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("SESRelatedDataContractManage7.aspx?id={0}", Id, "编辑 - ")));
}
/// <summary>
/// Grid3行双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid9_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
btnMenuEdit9_Click(null, null);
}
/// <summary>
/// Grid3右键编辑
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuEdit9_Click(object sender, EventArgs e)
{
if (Grid9.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("Please select at least one record!");
return;
}
string fileId = Grid9.SelectedRowID;
PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("SESRelatedDataContractManage7.aspx?fileId={0}", fileId, "编辑 - ")));
}
/// <summary>
/// Grid3右键删除
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDelete9_Click(object sender, EventArgs e)
{
if (Grid9.SelectedRowIndexArray.Length > 0)
{
foreach (int rowIndex in Grid9.SelectedRowIndexArray)
{
string rowID = Grid9.DataKeys[rowIndex][0].ToString();
var contracts = BLL.ContractManagementService.GetContractManagementById(rowID);
if (contracts != null)
{
BLL.ContractManagementService.DeleteContractManagementById(rowID);
}
}
BindGrid9(this.hdID.Text);
BLL.Sys_LogService.AddLog(this.CurrUser.UserId, "删除合同约谈");
ShowNotify("Deleted successfully!");
}
}
#endregion
#region
protected void btnAddFile10_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("Please select FC Record!");
return;
}
string Id = Grid1.SelectedRowID;
PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("SESRelatedDataContractManage8.aspx?id={0}", Id, "编辑 - ")));
}
/// <summary>
/// Grid3行双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid10_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
btnMenuEdit10_Click(null, null);
}
/// <summary>
/// Grid3右键编辑
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuEdit10_Click(object sender, EventArgs e)
{
if (Grid10.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("Please select at least one record!");
return;
}
string fileId = Grid10.SelectedRowID;
PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("SESRelatedDataContractManage8.aspx?fileId={0}", fileId, "编辑 - ")));
}
/// <summary>
/// Grid3右键删除
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDelete10_Click(object sender, EventArgs e)
{
if (Grid10.SelectedRowIndexArray.Length > 0)
{
foreach (int rowIndex in Grid10.SelectedRowIndexArray)
{
string rowID = Grid10.DataKeys[rowIndex][0].ToString();
var contracts = BLL.ContractManagementService.GetContractManagementById(rowID);
if (contracts != null)
{
BLL.ContractManagementService.DeleteContractManagementById(rowID);
}
}
BindGrid10(this.hdID.Text);
BLL.Sys_LogService.AddLog(this.CurrUser.UserId, "删除开工会");
ShowNotify("Deleted successfully!");
}
}
#endregion
#region
protected void btnAddFile11_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("Please select FC Record!");
return;
}
string Id = Grid1.SelectedRowID;
PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("SESRelatedDataContractManage9.aspx?id={0}", Id, "编辑 - ")));
}
/// <summary>
/// Grid3行双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid11_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
btnMenuEdit11_Click(null, null);
}
/// <summary>
/// Grid3右键编辑
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuEdit11_Click(object sender, EventArgs e)
{
if (Grid11.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("Please select at least one record!");
return;
}
string fileId = Grid11.SelectedRowID;
PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("SESRelatedDataContractManage9.aspx?fileId={0}", fileId, "编辑 - ")));
}
/// <summary>
/// Grid3右键删除
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDelete11_Click(object sender, EventArgs e)
{
if (Grid11.SelectedRowIndexArray.Length > 0)
{
foreach (int rowIndex in Grid11.SelectedRowIndexArray)
{
string rowID = Grid11.DataKeys[rowIndex][0].ToString();
var contracts = BLL.ContractManagementService.GetContractManagementById(rowID);
if (contracts != null)
{
BLL.ContractManagementService.DeleteContractManagementById(rowID);
}
}
BindGrid11(this.hdID.Text);
BLL.Sys_LogService.AddLog(this.CurrUser.UserId, "删除会议纪要");
ShowNotify("Deleted successfully!");
}
}
#endregion
#region
protected void btnAddFile12_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("Please select FC Record!");
return;
}
string Id = Grid1.SelectedRowID;
PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("SESRelatedDataContractManage10.aspx?id={0}", Id, "编辑 - ")));
}
/// <summary>
/// Grid3行双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid12_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
btnMenuEdit12_Click(null, null);
}
/// <summary>
/// Grid3右键编辑
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuEdit12_Click(object sender, EventArgs e)
{
if (Grid12.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("Please select at least one record!");
return;
}
string fileId = Grid12.SelectedRowID;
PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("SESRelatedDataContractManage10.aspx?fileId={0}", fileId, "编辑 - ")));
}
/// <summary>
/// Grid3右键删除
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDelete12_Click(object sender, EventArgs e)
{
if (Grid12.SelectedRowIndexArray.Length > 0)
{
foreach (int rowIndex in Grid12.SelectedRowIndexArray)
{
string rowID = Grid12.DataKeys[rowIndex][0].ToString();
var contracts = BLL.ContractManagementService.GetContractManagementById(rowID);
if (contracts != null)
{
BLL.ContractManagementService.DeleteContractManagementById(rowID);
}
}
BindGrid12(this.hdID.Text);
BLL.Sys_LogService.AddLog(this.CurrUser.UserId, "删除停工整改报告");
ShowNotify("Deleted successfully!");
}
}
#endregion
#region
protected void btnAddFile13_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("Please select FC Record!");
return;
}
string Id = Grid1.SelectedRowID;
PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("SESRelatedDataContractManage11.aspx?id={0}", Id, "编辑 - ")));
}
/// <summary>
/// Grid3行双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid13_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
btnMenuEdit13_Click(null, null);
}
/// <summary>
/// Grid3右键编辑
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuEdit13_Click(object sender, EventArgs e)
{
if (Grid13.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("Please select at least one record!");
return;
}
string fileId = Grid13.SelectedRowID;
PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("SESRelatedDataContractManage11.aspx?fileId={0}", fileId, "编辑 - ")));
}
/// <summary>
/// Grid3右键删除
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDelete13_Click(object sender, EventArgs e)
{
if (Grid13.SelectedRowIndexArray.Length > 0)
{
foreach (int rowIndex in Grid13.SelectedRowIndexArray)
{
string rowID = Grid13.DataKeys[rowIndex][0].ToString();
var contracts = BLL.ContractManagementService.GetContractManagementById(rowID);
if (contracts != null)
{
BLL.ContractManagementService.DeleteContractManagementById(rowID);
}
}
BindGrid13(this.hdID.Text);
BLL.Sys_LogService.AddLog(this.CurrUser.UserId, "删除合同终止");
ShowNotify("Deleted successfully!");
}
}
#endregion
#region
protected void btnAddFile14_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("Please select FC Record!");
return;
}
string Id = Grid1.SelectedRowID;
PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("SESRelatedDataContractManage12.aspx?id={0}", Id, "编辑 - ")));
}
/// <summary>
/// Grid3行双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid14_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
btnMenuEdit14_Click(null, null);
}
/// <summary>
/// Grid3右键编辑
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuEdit14_Click(object sender, EventArgs e)
{
if (Grid14.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("Please select at least one record!");
return;
}
string fileId = Grid14.SelectedRowID;
PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("SESRelatedDataContractManage12.aspx?fileId={0}", fileId, "编辑 - ")));
}
/// <summary>
/// Grid3右键删除
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDelete14_Click(object sender, EventArgs e)
{
if (Grid14.SelectedRowIndexArray.Length > 0)
{
foreach (int rowIndex in Grid14.SelectedRowIndexArray)
{
string rowID = Grid14.DataKeys[rowIndex][0].ToString();
var contracts = BLL.ContractManagementService.GetContractManagementById(rowID);
if (contracts != null)
{
BLL.ContractManagementService.DeleteContractManagementById(rowID);
}
}
BindGrid14(this.hdID.Text);
BLL.Sys_LogService.AddLog(this.CurrUser.UserId, "删除组织架构");
ShowNotify("Deleted successfully!");
}
}
#endregion
#region
protected void btnAddFile15_Click(object sender, EventArgs e)
{
if (Grid1.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("Please select FC Record!");
return;
}
string Id = Grid1.SelectedRowID;
PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("SESRelatedDataContractManage13.aspx?id={0}", Id, "编辑 - ")));
}
/// <summary>
/// Grid3行双击事件
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Grid15_RowDoubleClick(object sender, GridRowClickEventArgs e)
{
btnMenuEdit15_Click(null, null);
}
/// <summary>
/// Grid3右键编辑
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuEdit15_Click(object sender, EventArgs e)
{
if (Grid15.SelectedRowIndexArray.Length == 0)
{
Alert.ShowInParent("Please select at least one record!");
return;
}
string fileId = Grid15.SelectedRowID;
PageContext.RegisterStartupScript(Window5.GetShowReference(String.Format("SESRelatedDataContractManage13.aspx?fileId={0}", fileId, "编辑 - ")));
}
/// <summary>
/// Grid3右键删除
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void btnMenuDelete15_Click(object sender, EventArgs e)
{
if (Grid15.SelectedRowIndexArray.Length > 0)
{
foreach (int rowIndex in Grid15.SelectedRowIndexArray)
{
string rowID = Grid15.DataKeys[rowIndex][0].ToString();
var contracts = BLL.ContractManagementService.GetContractManagementById(rowID);
if (contracts != null)
{
BLL.ContractManagementService.DeleteContractManagementById(rowID);
}
}
BindGrid15(this.hdID.Text);
BLL.Sys_LogService.AddLog(this.CurrUser.UserId, "删除框架承包商评估表");
ShowNotify("Deleted successfully!");
}
}
#endregion
/// <summary>
/// 关闭弹出窗体
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void Window5_Close(object sender, WindowCloseEventArgs e)
{
BindGrid3(this.hdID.Text);
BindGrid4(this.hdID.Text);
BindGrid5(this.hdID.Text);
BindGrid6(this.hdID.Text);
BindGrid7(this.hdID.Text);
BindGrid8(this.hdID.Text);
BindGrid9(this.hdID.Text);
BindGrid10(this.hdID.Text);
BindGrid11(this.hdID.Text);
BindGrid12(this.hdID.Text);
BindGrid13(this.hdID.Text);
BindGrid14(this.hdID.Text);
BindGrid15(this.hdID.Text);
}
#endregion
protected void btnBatchDownload_Click(object sender, EventArgs e)
{
string rootPath = Server.MapPath("~/").Replace('\\', '/');
string date = DateTime.Now.ToString("yyyyMMddHHmmss");
if (drpDownloadType.SelectedValue == "0")
{
Alert.ShowInParent("Please select Download!");
return;
}
if (drpDownloadType.SelectedValue == "1")
{
string destFile = rootPath + "FileUpload\\Temp\\SignedContracts_" + date;
string zipFileName = "SignedContracts_" + date;
if (!Directory.Exists(destFile))
{
Directory.CreateDirectory(destFile);
}
List<string> urlList = (from x in Funs.DB.FC_SignedContracts where x.AttachUrl != null && x.AttachUrl != "" select x.AttachUrl).ToList();
foreach (string url in urlList)
{
string sourceFileName = rootPath + url.Replace('\\', '/');
string[] subUrl = sourceFileName.Split('/');
string fileName = subUrl[subUrl.Count() - 1];
string newFileName = fileName.Substring(fileName.IndexOf("~") + 1);
if (newFileName.Contains("_"))
{
if (newFileName.Substring(0, 1) == "_")
{
newFileName = newFileName.Substring(1, newFileName.Length - 1);
}
else
{
newFileName = newFileName.Replace(newFileName.Split('_')[0], "");
newFileName = newFileName.Substring(1);
}
}
string destFileName = destFile + "/" + newFileName;
if (File.Exists(sourceFileName))
{
File.Copy(sourceFileName, destFileName, true);
}
}
FileZipDownload(destFile.Replace('\\', '/'), zipFileName);
//List<string> durl = new List<string>();
//List<string> urlList = (from x in Funs.DB.FC_SignedContracts where x.AttachUrl != null && x.AttachUrl != "" select x.AttachUrl).ToList();
//foreach (string url in urlList)
//{
// string fullUrl = rootPath + url.Replace('\\', '/');
// if (File.Exists(fullUrl))
// {
// durl.Add(url);
// }
//}
//// 1-Signed Contracts,2-Contract Management
//string strcon = DownloadFileByHttpUrl(durl, "1");
//ShowNotify(strcon);
}
if (drpDownloadType.SelectedValue == "2")
{
//string destFile = rootPath + "FileUpload\\SES\\SESRelatedData\\ContractManagement";
string destFile = rootPath + "FileUpload\\Temp\\ContractManagement_" + date;
string zipFileName = "ContractManagement_" + date;
if (!Directory.Exists(destFile))
{
Directory.CreateDirectory(destFile);
}
List<string> urlList = (from x in Funs.DB.FC_ContractManagement where x.AttachUrl != null && x.AttachUrl != "" select x.AttachUrl).ToList();
foreach (string url in urlList)
{
string sourceFileName = rootPath + url.Replace('\\', '/');
string[] subUrl = sourceFileName.Split('/');
string fileName = subUrl[subUrl.Count() - 1];
string newFileName = fileName.Substring(fileName.IndexOf("~") + 1);
if (newFileName.Contains("_"))
{
if (newFileName.Substring(0, 1) == "_")
{
newFileName = newFileName.Substring(1, newFileName.Length - 1);
}
else
{
newFileName = newFileName.Replace(newFileName.Split('_')[0], "");
newFileName = newFileName.Substring(1);
}
}
string destFileName = destFile + "/" + newFileName;
if (File.Exists(sourceFileName))
{
File.Copy(sourceFileName, destFileName, true);
}
}
FileZipDownload(destFile.Replace('\\', '/'), zipFileName);
//List<string> durl = new List<string>();
//List<string> urlList = (from x in Funs.DB.FC_ContractManagement where x.AttachUrl != null && x.AttachUrl != "" select x.AttachUrl).ToList();
//foreach (string url in urlList)
//{
// string fullUrl = rootPath + url.Replace('\\', '/');
// if (File.Exists(fullUrl))
// {
// durl.Add(url);
// }
//}
//string strcon = DownloadFileByHttpUrl(durl, "2");
//ShowNotify(strcon);
}
}
private void FileZipDownload(string destFilePath, string zipFileName)
{
string zipFilePath = destFilePath + ".zip";
System.IO.Compression.ZipFile.CreateFromDirectory(destFilePath, zipFilePath);
FileInfo info = new FileInfo(zipFilePath);
long fileSize = info.Length;
System.Web.HttpContext.Current.Response.Clear();
System.Web.HttpContext.Current.Response.ContentType = "application/x-zip-compressed";
System.Web.HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + System.Web.HttpUtility.UrlEncode(zipFileName + ".zip", System.Text.Encoding.UTF8));
System.Web.HttpContext.Current.Response.AddHeader("Content-Length", fileSize.ToString());
System.Web.HttpContext.Current.Response.TransmitFile(zipFilePath, 0, fileSize);
System.Web.HttpContext.Current.Response.Flush();
System.Web.HttpContext.Current.Response.Close();
Funs.DeleteDir(destFilePath);
File.Delete(zipFilePath);
}
public string DownloadFileByHttpUrl(List<string> HttpUrlList, string type)
{
if (HttpUrlList == null || HttpUrlList.Count == 0)
{
return "没有附件";
}
try
{
var random = new Random();
var zipMs = new MemoryStream();
ZipOutputStream zipStream = new ZipOutputStream(zipMs);
zipStream.SetLevel(6);//压缩率0~9
foreach (var url in HttpUrlList)
{
if (!string.IsNullOrWhiteSpace(url))
{
string rootPath = System.Configuration.ConfigurationManager.AppSettings["RootUrl"];
string surl = rootPath + url.Replace('\\', '/');
var urlStr = HttpUtility.UrlDecode(surl);
Console.WriteLine(urlStr);
string fileExt = Path.GetExtension(urlStr).ToLower();
string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(urlStr);
var strName = fileNameWithoutExtension.Substring(fileNameWithoutExtension.LastIndexOf("/") + 1) + random.Next(1000, 9999) + fileExt;
zipStream.PutNextEntry(new ZipEntry(strName));
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(urlStr);
request.AllowAutoRedirect = true;
WebProxy proxy = new WebProxy();
proxy.BypassProxyOnLocal = true;
proxy.UseDefaultCredentials = true;
request.Proxy = proxy;
WebResponse response = request.GetResponse();
using (Stream streams = response.GetResponseStream())
{
Byte[] buffer = new Byte[1024];
int current = 0;
while ((current = streams.Read(buffer, 0, buffer.Length)) != 0)
{
zipStream.Write(buffer, 0, current);
}
zipStream.Flush();
}
}
}
zipStream.Finish();
zipMs.Position = 0;
//下边为打包压缩
MemoryStream stream = zipMs;
byte[] srcBuf = new Byte[stream.Length];
stream.Read(srcBuf, 0, srcBuf.Length);
stream.Seek(0, SeekOrigin.Begin);
string filePath = "C:/DownLoad";//Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
if (!Directory.Exists(filePath))
{
Directory.CreateDirectory(filePath);
}
string date = DateTime.Now.ToString("yyyyMMddHHmmss");
string con = string.Empty;
if (type == "1")
{
con = "FC_Signed Contracts";
}
else
{
con = "FC_Contract Management";
}
var file_name = con + "_" + date + ".zip";
using (FileStream fs = new FileStream(filePath + "\\" + file_name, FileMode.Create, FileAccess.Write))
{
fs.Write(srcBuf, 0, srcBuf.Length);
fs.Close();
return "已下载到C://Download文件下";
}
}
catch (Exception ex)
{
return "下载失败:" + ex.ToString();
}
}
protected void drpDownloadType_SelectedIndexChanged(object sender, EventArgs e)
{
}
protected void btnSelectAll_Click(object sender, EventArgs e)
{
string cruUser = CurrUser.UserId;
string strSql = @"SELECT * from View_FC_SESRelatedData WHERE 1=1 ";
List<SqlParameter> listStr = new List<SqlParameter>();
if (!string.IsNullOrEmpty(hdConstRecords.Text.Trim()))
{
strSql += " AND ConstRecords =@ConstRecords";
listStr.Add(new SqlParameter("@ConstRecords", this.hdConstRecords.Text.Trim()));
}
if (!string.IsNullOrEmpty(hdFoNo.Text.Trim()))
{
strSql += " AND FO_NO LIKE @FO_NO";
listStr.Add(new SqlParameter("@FO_NO", "%" + this.hdFoNo.Text.Trim() + "%"));
}
if (!string.IsNullOrEmpty(txtFO.Text.Trim()))
{
strSql += " AND FO_NO LIKE @FO";
listStr.Add(new SqlParameter("@FO", "%" + this.txtFO.Text.Trim() + "%"));
}
if (!string.IsNullOrEmpty(hdDiscipline.Text.Trim()))
{
strSql += " AND DisciplineId =@disciplineId";
listStr.Add(new SqlParameter("@disciplineId", hdDiscipline.Text.Trim()));
}
if (!string.IsNullOrEmpty(this.hdContractor.Text.Trim()))
{
strSql += " AND ContractorId =@ContractorId";
listStr.Add(new SqlParameter("@ContractorId", this.hdContractor.Text.Trim()));
}
if (drpContractor.SelectedValue != Const._Null)
{
strSql += " AND ContractorId =@con";
listStr.Add(new SqlParameter("@con", drpContractor.SelectedValue));
}
if (!string.IsNullOrEmpty(this.hdContractAdmin.Text.Trim()))
{
strSql += " AND Contract_AdminId =@Contract_Admin";
listStr.Add(new SqlParameter("@Contract_Admin", this.hdContractAdmin.Text.Trim()));
}
if (!string.IsNullOrEmpty(this.hdBuyer.Text.Trim()))
{
strSql += " AND Buyer=@Buyer";
listStr.Add(new SqlParameter("@Buyer", this.hdBuyer.Text.Trim()));
}
if (!string.IsNullOrEmpty(this.hdMainCoord.Text.Trim()))
{
strSql += " AND Main_CoordinatorId =@Main_Coordinator";
listStr.Add(new SqlParameter("@Main_Coordinator", this.hdMainCoord.Text.Trim()));
}
if (!string.IsNullOrEmpty(this.hdMCDepartment.Text.Trim()))
{
strSql += " AND MCDept=@MCDept";
listStr.Add(new SqlParameter("@MCDept", this.hdMCDepartment.Text.Trim()));
}
if (!string.IsNullOrEmpty(this.hdFCStatus.Text.Trim()))
{
strSql += " AND FC_Status=@FC_Status";
listStr.Add(new SqlParameter("@FC_Status", this.hdFCStatus.Text.Trim()));
}
if (!string.IsNullOrEmpty(this.hdFoType.Text.Trim()))
{
strSql += " AND FOTypeId=@FOTypeId";
listStr.Add(new SqlParameter("@FOTypeId", this.hdFoType.Text.Trim()));
}
SqlParameter[] parameter = listStr.ToArray();
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
//if (!string.IsNullOrEmpty(selectedList))
//{
// string[] selectedIds = selectedList.Split(',');
List<string> selectId = new List<string>();
// foreach (var id in selectedIds)
// {
foreach (DataRow row in tb.Rows)
{
//if (id == row["ID"].ToString())
//{
selectId.Add(row["ID"].ToString());
//}
}
//}
Grid1.SelectedRowIDArray = selectId.ToArray();
// }
}
}
}