259 lines
9.7 KiB
C#
259 lines
9.7 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.Information
|
||
{
|
||
public partial class VisaApplicationFinal : 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.CQMSConstructSolutionMenuId);
|
||
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("EditVisaApplicationFinal.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 VisaApplicationFinalId
|
||
,ProjectId
|
||
,unit.UnitId
|
||
,UnitName
|
||
,CompileDate
|
||
,Remark
|
||
FROM dbo.CQMS_VisaApplication_Final as visa
|
||
left join Base_Unit unit on unit.unitId=visa.UnitId
|
||
where 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 solution.UnitId='" + this.CurrUser.UnitId+"'";
|
||
}
|
||
if (drpProposeUnit.SelectedValue != Const._Null)
|
||
{
|
||
strSql += " AND solution.UnitId='" + drpProposeUnit.SelectedValue + "'";
|
||
|
||
}
|
||
|
||
|
||
strSql += " order by CompileDate 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.CQMS_VisaApplication_Final visaApplication_Final = VisaApplicationFinalService.GetVisaApplicationById(fileId);
|
||
|
||
if (visaApplication_Final != null)
|
||
{
|
||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/Solution&menuId={2}",
|
||
-1, visaApplication_Final.VisaApplicationFinalId, Const.CQMSVisaApplicationFinalMenuId)));
|
||
}
|
||
|
||
}
|
||
}
|
||
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("EditVisaApplicationFinal.aspx?visaApplicationFinalId={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("EditConstructSolutionFinal.aspx?visaApplicationFinalId={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.CQMSVisaApplicationFinalMenuId, Const.BtnDelete))
|
||
{
|
||
var constructSolution = VisaApplicationFinalService.GetVisaApplicationById(id);
|
||
VisaApplicationFinalService.DeleteVisaApplication(id);
|
||
LogService.AddSys_Log(CurrUser, constructSolution.VisaApplicationFinalId, id, Const.CQMSVisaApplicationFinalMenuId, "删除方案审查");
|
||
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();
|
||
}
|
||
}
|
||
} |