228 lines
9.1 KiB
C#
228 lines
9.1 KiB
C#
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 ConfirmFormList : 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.ConfirmFormMenuId);
|
|
if (buttonList.Count() > 0)
|
|
{
|
|
//if (buttonList.Contains(Const.BtnAdd))
|
|
//{
|
|
// btnNew.Hidden = false;
|
|
|
|
//}
|
|
//if (buttonList.Contains(Const.BtnModify) || buttonList.Contains(Const.BtnSubmit))
|
|
//{
|
|
// btnMenuModify.Hidden = false;
|
|
//}
|
|
//if (buttonList.Contains(Const.BtnDelete))
|
|
//{
|
|
// btnMenuDel.Hidden = false;
|
|
//}
|
|
}
|
|
}
|
|
#endregion
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
GetButtonPower();
|
|
//Funs.FineUIPleaseSelect(drpState);
|
|
UnitService.InitUnitByProjectIdUnitTypeDropDownList(drpUnit, CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_2, true);
|
|
//btnNew.OnClientClick = window_tt.GetShowReference("ConfirmFormEdit.aspx") + "return false;";
|
|
BindGrid();
|
|
}
|
|
}
|
|
protected DataTable ChecklistData()
|
|
{
|
|
|
|
string strSql = @"SELECT va.ConfirmFormId,va.ProjectId,va.UnitId,va.SecretLevelId,va.ConfirmFormCode,s.SecretLevelName,"
|
|
+ @" va.CompileMan,va.CompileDate,va.Edition,va.State,va.TaskTheme,st.PlanCost,st.RealCost,"
|
|
+ @" unit.UnitName,u.userName as CompileManName"
|
|
+ @" FROM CQMS_ConfirmForm va "
|
|
+ @" left join Base_Unit unit on unit.unitId=va.UnitId "
|
|
+ @" left join sys_User u on u.userId = va.CompileMan"
|
|
+ @" left join Base_SecretLevel s on va.SecretLevelId=s.SecretLevelId"
|
|
+ @" left join CQMS_Statement st on va.ConfirmFormId=st.ConfirmFormId"
|
|
+ @" where va.ProjectId=@ProjectId";
|
|
|
|
List<SqlParameter> listStr = new List<SqlParameter>();
|
|
listStr.Add(new SqlParameter("@ProjectId", CurrUser.LoginProjectId));
|
|
if (drpUnit.SelectedValue != Const._Null)
|
|
{
|
|
strSql += " AND va.UnitId=@unitId";
|
|
listStr.Add(new SqlParameter("@unitId", drpUnit.SelectedValue));
|
|
}
|
|
strSql += " AND va.State=@State";
|
|
listStr.Add(new SqlParameter("@State", BLL.Const.ConfirmForm_Complete));
|
|
strSql += " order by va.ConfirmFormCode desc ";
|
|
SqlParameter[] parameter = listStr.ToArray();
|
|
DataTable tb = SQLHelper.GetDataTableRunText(strSql, parameter);
|
|
return tb;
|
|
}
|
|
private void BindGrid()
|
|
{
|
|
var list = ChecklistData();
|
|
Grid1.RecordCount = list.Rows.Count;
|
|
list = GetFilteredTable(Grid1.FilteredData, list);
|
|
var table = GetPagedDataTable(Grid1, list);
|
|
Grid1.DataSource = table;
|
|
Grid1.DataBind();
|
|
}
|
|
|
|
protected void btnQuery_Click(object sender, EventArgs e)
|
|
{
|
|
BindGrid();
|
|
}
|
|
|
|
protected void btnRset_Click(object sender, EventArgs e)
|
|
{
|
|
drpUnit.SelectedIndex = 0;
|
|
//drpState.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];
|
|
Model.CQMS_ConfirmForm confirmForm = ConfirmFormService.GetConfirmFormByConfirmFormId(id);
|
|
if (confirmForm.State == Const.ConfirmForm_Complete)
|
|
{
|
|
Alert.ShowInTop("该工程签证确认单已经审批完成,无法操作,请右键查看!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
else if (confirmForm.State == Const.ConfirmForm_Compile)
|
|
{
|
|
if (confirmForm.CompileMan == CurrUser.UserId || CurrUser.UserId == Const.sysglyId)
|
|
{
|
|
|
|
PageContext.RegisterStartupScript(window_tt.GetShowReference(String.Format("ConfirmFormEdit.aspx?confirmFormId={0}", id)));
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("您不是编制人,无法操作!请右键查看", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Model.CQMS_ConfirmFormApprove approve = ConfirmFormApproveService.GetConfirmFormApproveByApproveMan(id, CurrUser.UserId);
|
|
if (approve != null || CurrUser.UserId == Const.sysglyId)
|
|
{
|
|
PageContext.RegisterStartupScript(window_tt.GetShowReference(String.Format("ConfirmFormEdit.aspx?confirmFormId={0}", id)));
|
|
return;
|
|
//Response.Redirect("CQMSConstructSolutionAudit.aspx?confirmFormId=" + id);
|
|
//PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CheckListView.aspx?CheckControlCode={0}", id, "查看 - ")));
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("您不是办理用户,无法操作!请右键查看", MessageBoxIcon.Warning);
|
|
return;
|
|
//if (confirmForm.CompileMan.Equals(CurrUser.UserId))
|
|
//{
|
|
// PageContext.RegisterStartupScript(window_tt.GetShowReference(String.Format("ConfirmFormEdit.aspx?confirmFormId={0}", id)));
|
|
//}
|
|
//else
|
|
//{
|
|
// Alert.ShowInTop("您不是办理用户,无法操作!请右键查看", MessageBoxIcon.Warning);
|
|
// return;
|
|
//}
|
|
|
|
}
|
|
}
|
|
|
|
|
|
}
|
|
|
|
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(window_tt.GetShowReference(String.Format("ConfirmFormView.aspx?confirmFormId={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.ConfirmFormMenuId, Const.BtnDelete))
|
|
{
|
|
var confirmForm = ConfirmFormService.GetConfirmFormByConfirmFormId(id);
|
|
ConfirmFormApproveService.DeleteConfirmFormApprovesByConfirmFormId(id);
|
|
ConfirmFormDetailService.DeleteConfirmFormDetailByConfirmFormId(id);
|
|
ConfirmFormService.DeleteConfirmForm(id);
|
|
LogService.AddSys_Log(CurrUser, confirmForm.ConfirmFormCode, id, Const.ConfirmFormMenuId, "删除工程签证确认单");
|
|
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();
|
|
}
|
|
}
|
|
} |