2025-04-07 17:43:30 +08:00
|
|
|
|
using Aspose.Words;
|
|
|
|
|
using BLL;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Data.SqlClient;
|
|
|
|
|
using System.IO;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Web;
|
|
|
|
|
using System.Web.UI;
|
|
|
|
|
using System.Web.UI.WebControls;
|
|
|
|
|
|
|
|
|
|
namespace FineUIPro.Web.CQMS.Comprehensive
|
|
|
|
|
{
|
|
|
|
|
public partial class ContactList : PageBase
|
|
|
|
|
{
|
2025-04-11 15:19:17 +08:00
|
|
|
|
#region 项目主键
|
2025-04-07 17:43:30 +08:00
|
|
|
|
/// <summary>
|
2025-04-11 15:19:17 +08:00
|
|
|
|
/// 项目主键
|
2025-04-07 17:43:30 +08:00
|
|
|
|
/// </summary>
|
2025-04-11 15:19:17 +08:00
|
|
|
|
public string ProjectId
|
2025-04-07 17:43:30 +08:00
|
|
|
|
{
|
2025-04-11 15:19:17 +08:00
|
|
|
|
get
|
2025-04-07 17:43:30 +08:00
|
|
|
|
{
|
2025-04-11 15:19:17 +08:00
|
|
|
|
return (string)ViewState["ProjectId"];
|
2025-04-07 17:43:30 +08:00
|
|
|
|
}
|
2025-04-11 15:19:17 +08:00
|
|
|
|
set
|
2025-04-07 17:43:30 +08:00
|
|
|
|
{
|
2025-04-11 15:19:17 +08:00
|
|
|
|
ViewState["ProjectId"] = value;
|
2025-04-07 17:43:30 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
#endregion
|
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (!IsPostBack)
|
2025-04-11 15:19:17 +08:00
|
|
|
|
{
|
|
|
|
|
this.ProjectId = this.CurrUser.LoginProjectId;
|
|
|
|
|
if (!string.IsNullOrEmpty(Request.Params["projectId"]) && Request.Params["projectId"] != this.CurrUser.LoginProjectId)
|
|
|
|
|
{
|
|
|
|
|
this.ProjectId = Request.Params["projectId"];
|
|
|
|
|
}
|
|
|
|
|
this.InitDropDownList();
|
|
|
|
|
this.ucTree.UnitId = this.CurrUser.UnitId;
|
|
|
|
|
this.ucTree.ProjectId = this.ProjectId;
|
|
|
|
|
if (!string.IsNullOrEmpty(this.ProjectId))
|
|
|
|
|
{
|
|
|
|
|
this.panelLeftRegion.Hidden = true;
|
|
|
|
|
////权限按钮方法
|
|
|
|
|
this.GetButtonPower();
|
|
|
|
|
}
|
2025-04-07 17:43:30 +08:00
|
|
|
|
|
|
|
|
|
btnNew.OnClientClick = Window1.GetShowReference("ContactListEdit.aspx") + "return false;";
|
|
|
|
|
if (this.CurrUser.UnitId != null && CommonService.GetProjectUnitType(this.CurrUser.LoginProjectId, this.CurrUser.UnitId) != BLL.Const.ProjectUnitType_1 && this.CurrUser.UnitId != Const.hfnbdId)
|
|
|
|
|
{
|
|
|
|
|
this.drpProposeUnit.Hidden = true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var eventArgs = GetRequestEventArgument(); // 此函数所在文件:PageBase.cs
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-11 15:19:17 +08:00
|
|
|
|
private void InitDropDownList()
|
|
|
|
|
{
|
|
|
|
|
UnitService.InitUnitByProjectIdUnitTypeDropDownList(drpProposeUnit, this.ProjectId, BLL.Const.ProjectUnitType_2, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 公司级树加载
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="sender"></param>
|
|
|
|
|
/// <param name="e"></param>
|
|
|
|
|
protected void changeTree(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
this.ProjectId = this.ucTree.ProjectId;
|
|
|
|
|
this.InitDropDownList();
|
|
|
|
|
if (string.IsNullOrEmpty(this.CurrUser.LoginProjectId))
|
|
|
|
|
{
|
|
|
|
|
btnNew.Hidden = true;
|
|
|
|
|
}
|
|
|
|
|
this.GetButtonPower();
|
|
|
|
|
this.BindGrid();
|
|
|
|
|
}
|
2025-04-07 17:43:30 +08:00
|
|
|
|
protected string ConvertEdition(object edition)
|
|
|
|
|
{
|
|
|
|
|
return string.Format("{0:#0.#}",((int)edition)/10.0);
|
|
|
|
|
}
|
|
|
|
|
protected void Grid1_RowDataBound(object sender, GridRowEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
int i = e.RowIndex;
|
|
|
|
|
string id = Grid1.Rows[i].DataKeys[0].ToString();
|
2025-04-11 15:19:17 +08:00
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#region 获取按钮权限
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 获取按钮权限
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="button"></param>
|
|
|
|
|
/// <returns></returns>
|
|
|
|
|
private void GetButtonPower()
|
|
|
|
|
{
|
|
|
|
|
if (Request.Params["value"] == "0")
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
var buttonList = CommonService.GetAllButtonList(CurrUser.LoginProjectId, CurrUser.UserId, Const.CQMSContactLitMenuId);
|
|
|
|
|
if (buttonList.Count() > 0)
|
|
|
|
|
{
|
|
|
|
|
if (buttonList.Contains(Const.BtnDelete))
|
|
|
|
|
{
|
|
|
|
|
btnMenuDel.Hidden = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-04-07 17:43:30 +08:00
|
|
|
|
}
|
2025-04-11 15:19:17 +08:00
|
|
|
|
#endregion
|
2025-04-07 17:43:30 +08:00
|
|
|
|
protected DataTable ChecklistData()
|
|
|
|
|
{
|
|
|
|
|
string strSql = @"SELECT ContactListId
|
|
|
|
|
,ProjectId
|
|
|
|
|
,unit.UnitId
|
|
|
|
|
,UnitName
|
|
|
|
|
,CreateDate
|
|
|
|
|
,Remark
|
|
|
|
|
FROM dbo.Comprehensive_ContactList contact
|
|
|
|
|
left join Base_Unit unit on unit.unitId=contact.UnitId
|
|
|
|
|
where ProjectId=@ProjectId";
|
|
|
|
|
|
|
|
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
2025-04-11 15:19:17 +08:00
|
|
|
|
listStr.Add(new SqlParameter("@ProjectId", this.ProjectId));
|
2025-04-07 17:43:30 +08:00
|
|
|
|
if (this.CurrUser.UnitId != null && CommonService.GetProjectUnitType(this.CurrUser.LoginProjectId, this.CurrUser.UnitId) != BLL.Const.ProjectUnitType_1 && this.CurrUser.UnitId != Const.hfnbdId)
|
|
|
|
|
{
|
|
|
|
|
strSql += " AND contact.UnitId='" + this.CurrUser.UnitId+"'";
|
|
|
|
|
}
|
|
|
|
|
if (drpProposeUnit.SelectedValue != Const._Null)
|
|
|
|
|
{
|
|
|
|
|
strSql += " AND contact.UnitId='" + drpProposeUnit.SelectedValue + "'";
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
strSql += " order by CreateDate desc ";
|
|
|
|
|
//if (drpUnitWork.SelectedValue != Const._Null)
|
|
|
|
|
//{
|
|
|
|
|
// strSql += " AND chec.unitworkId=@unitworkId";
|
|
|
|
|
// listStr.Add(new SqlParameter("@unitworkId", drpUnitWork.SelectedValue));
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
//if (drpQuestionType.SelectedValue != Const._Null)
|
|
|
|
|
//{
|
|
|
|
|
// strSql += " AND chec.QuestionType=@QuestionType";
|
|
|
|
|
// listStr.Add(new SqlParameter("@QuestionType", drpQuestionType.SelectedValue));
|
|
|
|
|
//}
|
|
|
|
|
//if (dpHandelStatus.SelectedValue != Const._Null)
|
|
|
|
|
//{
|
|
|
|
|
// if (dpHandelStatus.SelectedValue.Equals("1"))
|
|
|
|
|
// {
|
|
|
|
|
// strSql += " AND (chec.state='5' or chec.state='6')";
|
|
|
|
|
// }
|
|
|
|
|
// else if (dpHandelStatus.SelectedValue.Equals("2"))
|
|
|
|
|
// {
|
|
|
|
|
// strSql += " AND chec.state='7'";
|
|
|
|
|
// }
|
|
|
|
|
// else if (dpHandelStatus.SelectedValue.Equals("3"))
|
|
|
|
|
// {
|
|
|
|
|
// strSql += " AND DATEADD(day,1,chec.LimitDate)< GETDATE() and chec.state<>5 and chec.state<>6 and chec.state<>7";
|
|
|
|
|
// }
|
|
|
|
|
// else if (dpHandelStatus.SelectedValue.Equals("4"))
|
|
|
|
|
// {
|
|
|
|
|
// strSql += " AND DATEADD(day,1,chec.LimitDate)> GETDATE() and chec.state<>5 and chec.state<>6 and chec.state<>7";
|
|
|
|
|
// }
|
|
|
|
|
//}
|
|
|
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
|
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
|
|
|
return tb;
|
|
|
|
|
}
|
|
|
|
|
private void BindGrid()
|
|
|
|
|
{
|
2025-04-11 15:19:17 +08:00
|
|
|
|
if (string.IsNullOrEmpty(this.ProjectId))
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
2025-04-07 17:43:30 +08:00
|
|
|
|
var list = ChecklistData();
|
|
|
|
|
Grid1.RecordCount = list.Rows.Count;
|
|
|
|
|
var CNProfessional = CNProfessionalService.GetCNProfessionalItem();
|
2025-04-11 15:19:17 +08:00
|
|
|
|
var uniWork = UnitWorkService.GetUnitWorkLists(this.ProjectId);
|
2025-04-07 17:43:30 +08:00
|
|
|
|
|
|
|
|
|
list = GetFilteredTable(Grid1.FilteredData, list);
|
|
|
|
|
var table = GetPagedDataTable(Grid1, list);
|
|
|
|
|
Grid1.DataSource = table;
|
|
|
|
|
Grid1.DataBind();
|
|
|
|
|
}
|
|
|
|
|
protected void Grid1_RowCommand(object sender, GridCommandEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
object[] keys = Grid1.DataKeys[e.RowIndex];
|
|
|
|
|
string fileId = string.Empty;
|
|
|
|
|
if (keys == null)
|
|
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
fileId = keys[0].ToString();
|
|
|
|
|
}
|
|
|
|
|
if (e.CommandName == "attchUrl")
|
|
|
|
|
{
|
|
|
|
|
Model.Comprehensive_ContactList comprehensive = BLL.CQMS.Comprehensive.ContactListService.GetContactListById(fileId);
|
|
|
|
|
|
|
|
|
|
if (comprehensive != null)
|
|
|
|
|
{
|
|
|
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/Solution&menuId={2}",
|
|
|
|
|
-1, comprehensive.ContactListId, Const.CQMSContactLitMenuId)));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
protected void btnQuery_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void btnRset_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
//drpSolutionType.SelectedIndex = 0;
|
|
|
|
|
drpProposeUnit.SelectedIndex = 0;
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Grid1.PageSize = Convert.ToInt32(ddlPageSize.SelectedValue);
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void btnMenuModify_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
string id = Grid1.SelectedRowID.Split(',')[0];
|
|
|
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ContactListEdit.aspx?ContactListId={0}", id)));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void btnMenuView_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
string id = Grid1.SelectedRowID.Split(',')[0];
|
|
|
|
|
PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("ContactListEdit.aspx?ContactListId={0}", id)));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void btnMenuDel_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
|
|
|
|
if (Grid1.SelectedRowIndexArray.Length == 0)
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("请至少选择一条记录!", MessageBoxIcon.Warning);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
string id = Grid1.SelectedRowID.Split(',')[0];
|
|
|
|
|
if (CommonService.GetAllButtonPowerList(CurrUser.LoginProjectId, CurrUser.UserId, Const.CQMSContactLitMenuId, Const.BtnDelete))
|
|
|
|
|
{
|
|
|
|
|
BLL.CQMS.Comprehensive.ContactListService.DeletetContactList(id);
|
|
|
|
|
BindGrid();
|
|
|
|
|
Alert.ShowInTop("删除成功!", MessageBoxIcon.Success);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Success);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void Window1_Close(object sender, WindowCloseEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void window_tt_Close(object sender, WindowCloseEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void Grid1_RowDoubleClick(object sender, GridRowClickEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
btnMenuModify_Click(sender, e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void Grid1_PageIndexChange(object sender, GridPageEventArgs e)
|
|
|
|
|
{
|
|
|
|
|
Grid1.PageIndex = e.NewPageIndex;
|
|
|
|
|
BindGrid();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|