20220315 代码初始化上传
This commit is contained in:
@@ -0,0 +1,238 @@
|
||||
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 VisaApplication : 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.VisaApplicationMenuId);
|
||||
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("VisaApplicationEdit.aspx") + "return false;";
|
||||
BindGrid();
|
||||
}
|
||||
}
|
||||
protected DataTable ChecklistData()
|
||||
{
|
||||
|
||||
string strSql = @"SELECT va.VisaApplicationId,va.ProjectId,va.UnitId,va.SecretLevelId,va.VisaApplicationCode,s.SecretLevelName,va.ApplicableProcedures,"
|
||||
+ @" case when va.ApplicableProcedures='1' then '常规程序(审批执行)' else '紧急程序(立即执行)' end as ApplicableProceduresStr,"
|
||||
+ @" va.CompileMan,va.CompileDate,va.Edition,va.State,va.TaskTheme,"
|
||||
+ @" unit.UnitName,u.userName as CompileManName"
|
||||
+ @" FROM CQMS_VisaApplication 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"
|
||||
+ @" 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));
|
||||
}
|
||||
if (drpState.SelectedValue != Const._Null)
|
||||
{
|
||||
if (drpState.SelectedValue == "1") //已闭合
|
||||
{
|
||||
strSql += " AND State=@State";
|
||||
listStr.Add(new SqlParameter("@State", BLL.Const.VisaApplication_Complete));
|
||||
}
|
||||
else //未闭合
|
||||
{
|
||||
strSql += " AND State!=@State";
|
||||
listStr.Add(new SqlParameter("@State", BLL.Const.VisaApplication_Complete));
|
||||
}
|
||||
}
|
||||
strSql += " order by va.VisaApplicationCode 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_VisaApplication visaApplication = VisaApplicationService.GetVisaApplicationByVisaApplicationId(id);
|
||||
if (visaApplication.State == Const.VisaApplication_Complete)
|
||||
{
|
||||
Alert.ShowInTop("该工程签证申请/评审表已经审批完成,无法操作,请右键查看!", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
else if (visaApplication.State == Const.VisaApplication_Compile)
|
||||
{
|
||||
if (visaApplication.CompileMan == CurrUser.UserId || CurrUser.UserId == Const.sysglyId)
|
||||
{
|
||||
|
||||
PageContext.RegisterStartupScript(window_tt.GetShowReference(String.Format("VisaApplicationEdit.aspx?visaApplicationId={0}", id)));
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("您不是编制人,无法操作!请右键查看", MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Model.CQMS_VisaApplicationApprove approve = VisaApplicationApproveService.GetVisaApplicationApproveByApproveMan(id, CurrUser.UserId);
|
||||
if (approve != null || CurrUser.UserId == Const.sysglyId)
|
||||
{
|
||||
PageContext.RegisterStartupScript(window_tt.GetShowReference(String.Format("VisaApplicationEdit.aspx?visaApplicationId={0}", id)));
|
||||
return;
|
||||
//Response.Redirect("CQMSConstructSolutionAudit.aspx?visaApplicationId=" + id);
|
||||
//PageContext.RegisterStartupScript(Window1.GetShowReference(String.Format("CheckListView.aspx?CheckControlCode={0}", id, "查看 - ")));
|
||||
}
|
||||
else
|
||||
{
|
||||
Alert.ShowInTop("您不是办理用户,无法操作!请右键查看", MessageBoxIcon.Warning);
|
||||
return;
|
||||
//if (visaApplication.CompileMan.Equals(CurrUser.UserId))
|
||||
//{
|
||||
// PageContext.RegisterStartupScript(window_tt.GetShowReference(String.Format("VisaApplicationEdit.aspx?visaApplicationId={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("VisaApplicationView.aspx?visaApplicationId={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.VisaApplicationMenuId, Const.BtnDelete))
|
||||
{
|
||||
var visaApplication = VisaApplicationService.GetVisaApplicationByVisaApplicationId(id);
|
||||
VisaApplicationApproveService.DeleteVisaApplicationApprovesByVisaApplicationId(id);
|
||||
VisaApplicationService.DeleteVisaApplication(id);
|
||||
LogService.AddSys_Log(CurrUser, visaApplication.VisaApplicationCode, id, Const.VisaApplicationMenuId, "删除工程签证申请/评审表");
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user