178 lines
6.1 KiB
C#
178 lines
6.1 KiB
C#
|
using BLL;
|
|||
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Web;
|
|||
|
using System.Web.UI;
|
|||
|
using System.Web.UI.WebControls;
|
|||
|
|
|||
|
namespace FineUIPro.Web.SubPackManage
|
|||
|
{
|
|||
|
public partial class SubPackBlackRemark : PageBase
|
|||
|
{
|
|||
|
/// <summary>
|
|||
|
/// 黑名单对象主键
|
|||
|
/// </summary>
|
|||
|
public string BlackForeignKey
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return (string)ViewState["BlackForeignKey"];
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
ViewState["BlackForeignKey"] = value;
|
|||
|
}
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 黑名单对象身份证号
|
|||
|
/// </summary>
|
|||
|
public string IDCard
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return (string)ViewState["IDCard"];
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
ViewState["IDCard"] = value;
|
|||
|
}
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 黑名单对象类型
|
|||
|
/// </summary>
|
|||
|
public string BlackType
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return (string)ViewState["BlackType"];
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
ViewState["BlackType"] = value;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
/// <summary>
|
|||
|
/// 黑名单所属项目
|
|||
|
/// </summary>
|
|||
|
public string ProjectID
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return (string)ViewState["ProjectID"];
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
ViewState["ProjectID"] = value;
|
|||
|
}
|
|||
|
}
|
|||
|
/// <summary>
|
|||
|
/// 黑名单对象保存
|
|||
|
/// </summary>
|
|||
|
public string EditType
|
|||
|
{
|
|||
|
get
|
|||
|
{
|
|||
|
return (string)ViewState["EditType"];
|
|||
|
}
|
|||
|
set
|
|||
|
{
|
|||
|
ViewState["EditType"] = value;
|
|||
|
}
|
|||
|
}
|
|||
|
protected void Page_Load(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (!IsPostBack)
|
|||
|
{
|
|||
|
this.BlackForeignKey = Request.Params["BlackForeignKey"];
|
|||
|
this.IDCard = Request.Params["IDCard"];
|
|||
|
this.BlackType = Request.Params["BlackType"];
|
|||
|
this.ProjectID = Request.Params["ProjectID"];
|
|||
|
this.EditType = Request.Params["EditType"];
|
|||
|
var blackList = Funs.DB.SubPack_Blacklist.FirstOrDefault(p => p.ProjectID == this.ProjectID && p.BlackForeignKey == this.BlackForeignKey && p.BlackType == this.BlackType && p.IDCard == this.IDCard);
|
|||
|
if (blackList != null)
|
|||
|
this.txtRemark.Text = blackList.Remark;
|
|||
|
if (this.EditType == "-1")
|
|||
|
btnSave.Hidden = true;
|
|||
|
else
|
|||
|
btnSave.Hidden = false;
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
protected void btnSave_Click(object sender, EventArgs e)
|
|||
|
{
|
|||
|
if (string.IsNullOrWhiteSpace(BlackForeignKey) || string.IsNullOrWhiteSpace(IDCard) || string.IsNullOrWhiteSpace(BlackType) || string.IsNullOrWhiteSpace(ProjectID))
|
|||
|
{
|
|||
|
Alert.Show("黑名单保存缺少必要数据,无法保存", MessageBoxIcon.Warning);
|
|||
|
return;
|
|||
|
}
|
|||
|
Model.SGGLDB db = Funs.DB;
|
|||
|
Model.SubPack_Blacklist newBlack = new Model.SubPack_Blacklist();
|
|||
|
var blackList = db.SubPack_Blacklist.FirstOrDefault(p => p.BlackForeignKey == this.BlackForeignKey && p.BlackType == this.BlackType && p.IDCard == this.IDCard && p.ProjectID == this.ProjectID);
|
|||
|
if (blackList == null)
|
|||
|
{
|
|||
|
newBlack.SubPackBlackListID = SQLHelper.GetNewID(typeof(Model.SubPack_Blacklist));
|
|||
|
newBlack.BlackForeignKey = this.BlackForeignKey;
|
|||
|
newBlack.IDCard = this.IDCard;
|
|||
|
newBlack.BlackType = this.BlackType;
|
|||
|
newBlack.Remark = txtRemark.Text.Trim();
|
|||
|
newBlack.BlackMan = this.CurrUser.UserId;
|
|||
|
newBlack.BlackTime = DateTime.Now;
|
|||
|
newBlack.ProjectID = this.ProjectID;
|
|||
|
db.SubPack_Blacklist.InsertOnSubmit(newBlack);
|
|||
|
}
|
|||
|
else
|
|||
|
{
|
|||
|
blackList.Remark = txtRemark.Text.Trim();
|
|||
|
}
|
|||
|
//劳务公司
|
|||
|
if (BlackType == Const.SubPackBlackListTeamList)
|
|||
|
{
|
|||
|
//劳务公司名单明细表
|
|||
|
var teamListDetail = db.SubPack_TeamListDetail.FirstOrDefault(p => p.SubPackTeamListDetailID == this.BlackForeignKey);
|
|||
|
if (teamListDetail != null)
|
|||
|
{
|
|||
|
teamListDetail.BackState = "1";
|
|||
|
}
|
|||
|
//劳务公司变更明细表
|
|||
|
var changeRequestDetail = db.SubPack_ChangeRequestDetail.FirstOrDefault(p => p.SubPackChangeRequestDetailID == this.BlackForeignKey);
|
|||
|
if (changeRequestDetail != null)
|
|||
|
{
|
|||
|
changeRequestDetail.BackState = "1";
|
|||
|
}
|
|||
|
}
|
|||
|
//劳务队伍
|
|||
|
else if (BlackType == Const.SubPackBlackLaborTeam)
|
|||
|
{
|
|||
|
var laborTeam = db.SubPack_LaborTeam.FirstOrDefault(p => p.LaborTeamId == this.BlackForeignKey);
|
|||
|
if (laborTeam != null)
|
|||
|
{
|
|||
|
laborTeam.State = "1";
|
|||
|
}
|
|||
|
}
|
|||
|
//劳务班组
|
|||
|
else if (BlackType == Const.SubPackBlackListTeam)
|
|||
|
{
|
|||
|
var team = db.SubPack_BranchTeamListTeam.FirstOrDefault(p => p.BranchTeamListTeamId == this.BlackForeignKey);
|
|||
|
if (team != null)
|
|||
|
{
|
|||
|
team.State = "1";
|
|||
|
}
|
|||
|
}
|
|||
|
//劳务人员
|
|||
|
else if (BlackType == Const.SubPackBlackListPersonnel)
|
|||
|
{
|
|||
|
var personnel = db.SubPack_SubPackPersonnel.FirstOrDefault(p => p.SubPackPersonnelID == this.BlackForeignKey);
|
|||
|
if (personnel != null)
|
|||
|
{
|
|||
|
personnel.State = "1";
|
|||
|
}
|
|||
|
}
|
|||
|
db.SubmitChanges();
|
|||
|
ShowNotify("加入黑名单,操作成功", MessageBoxIcon.Success);
|
|||
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|||
|
}
|
|||
|
}
|
|||
|
}
|