255 lines
9.4 KiB
C#
255 lines
9.4 KiB
C#
|
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
|
|||
|
{
|
|||
|
#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;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|
|||
|
#endregion
|
|||
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (!IsPostBack)
|
|||
|
{
|
|||
|
|
|||
|
GetButtonPower();
|
|||
|
//BLL.SolutionTempleteTypeService.InitSolutionTempleteDropDownList(drpSolutionType, true);
|
|||
|
//Funs.FineUIPleaseSelect(drpState);
|
|||
|
UnitService.InitUnitByProjectIdUnitTypeDropDownList(drpProposeUnit, CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_2, true);
|
|||
|
|
|||
|
btnNew.OnClientClick = Window1.GetShowReference("ContactListEdit.aspx") + "return false;";
|
|||
|
if (this.CurrUser.UnitId != null && this.CurrUser.UnitId != Const.UnitId_TCC && this.CurrUser.UnitId != Const.hfnbdId)
|
|||
|
{
|
|||
|
this.drpProposeUnit.Hidden = true;
|
|||
|
}
|
|||
|
|
|||
|
BindGrid();
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
var eventArgs = GetRequestEventArgument(); // 此函数所在文件:PageBase.cs
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
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();
|
|||
|
|
|||
|
}
|
|||
|
protected DataTable ChecklistData()
|
|||
|
{
|
|||
|
|
|||
|
string strSql = @"select a.*,b.UserName,c.ProfessionalName,d.UnitName from Comprehensive_ContactList a
|
|||
|
left join Sys_User b on a.CreateMan =b.UserId
|
|||
|
left join Base_CNProfessional c on a.CNProfessionalId = c.CNProfessionalId
|
|||
|
left join Base_Unit d on a.UnitId=d.UnitId
|
|||
|
where a.ProjectId=@ProjectId";
|
|||
|
|
|||
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|||
|
listStr.Add(new SqlParameter("@ProjectId", CurrUser.LoginProjectId));
|
|||
|
if (this.CurrUser.UnitId != null && this.CurrUser.UnitId != Const.UnitId_TCC && this.CurrUser.UnitId != Const.hfnbdId)
|
|||
|
{
|
|||
|
strSql += " AND a.UnitId='" + this.CurrUser.UnitId+"'";
|
|||
|
}
|
|||
|
if (drpProposeUnit.SelectedValue != Const._Null)
|
|||
|
{
|
|||
|
strSql += " AND a.UnitId='" + drpProposeUnit.SelectedValue + "'";
|
|||
|
|
|||
|
}
|
|||
|
|
|||
|
|
|||
|
strSql += " order by a.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()
|
|||
|
{
|
|||
|
var list = ChecklistData();
|
|||
|
Grid1.RecordCount = list.Rows.Count;
|
|||
|
var CNProfessional = CNProfessionalService.GetCNProfessionalItem();
|
|||
|
var uniWork = UnitWorkService.GetUnitWorkLists(CurrUser.LoginProjectId);
|
|||
|
|
|||
|
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);
|
|||
|
|
|||
|
LogService.AddSys_Log(CurrUser, id, id, Const.CQMSContactLitMenuId, "删除工程联络单管理");
|
|||
|
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();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|