SGGL_SHJ/SGGL/FineUIPro.Web/CQMS/Plan/SubPlanEdit.aspx.cs

907 lines
36 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using BLL;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace FineUIPro.Web.CQMS.Plan
{
public partial class SubPlanEdit : PageBase
{
#region
/// <summary>
/// 分包施工质量计划主键
/// </summary>
public string SubPlanId
{
get
{
return (string)ViewState["SubPlanId"];
}
set
{
ViewState["SubPlanId"] = value;
}
}
#endregion
#region
/// <summary>
/// 定义会签意见集合
/// </summary>
public static List<Model.Plan_SubPlanApprove> approves = new List<Model.Plan_SubPlanApprove>();
#endregion
public int ContactImg
{
get
{
return Convert.ToInt32(ViewState["ContactImg"]);
}
set
{
ViewState["ContactImg"] = value;
}
}
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
var unitWork = UnitWorkService.GetUnitWorkLists(CurrUser.LoginProjectId);
var unitWorks = from x in unitWork
select
new
{
x.UnitWorkId,
UnitWorkName = x.UnitWorkCode + "-" + x.UnitWorkName + BLL.UnitWorkService.GetProjectType(x.ProjectType)
};
gvUnitWork.DataSource = unitWorks;
gvUnitWork.DataBind();
var gvCNProfessional = CNProfessionalService.GetList();
gvCNPro.DataSource = gvCNProfessional;
gvCNPro.DataBind();
UnitService.InitUnitByProjectIdUnitTypeDropDownList(drpUnit, CurrUser.LoginProjectId, BLL.Const.ProjectUnitType_2, false);
CQMS_SubPlanService.setRoleTree(trOne, this.CurrUser.LoginProjectId, "专业工程师", Const.ProjectUnitType_1, Const.ZBCNEngineer);
CQMS_SubPlanService.setRoleTree(trTwo, this.CurrUser.LoginProjectId, "质量经理", Const.ProjectUnitType_1, Const.QAManager + "," + Const.CQEngineer);
CQMS_SubPlanService.setRoleTree(trFive, this.CurrUser.LoginProjectId, "施工经理", Const.ProjectUnitType_1, Const.ConstructionManager + "," + Const.ConstructionAssistantManager);
ContactImg = 0;
//CommonService.GetAllButtonList(CurrUser.LoginProjectId, CurrUser.PersonId, Const.SubPlanMenuId);
txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
SubPlanId = Request.Params["SubPlanId"];
BLL.Base_CompanytemplateService.InitBase_CompanyTemplateDownList(drpCompanyTemplate, true);
IsHiddendrpCompanyTemplate();
if (!string.IsNullOrWhiteSpace(SubPlanId))
{
HFSubPlanId.Text = SubPlanId;
Model.Plan_SubPlan SubPlan = CQMS_SubPlanService.GetSubPlanBySubPlanId(SubPlanId);
txtCode.Text = SubPlan.Code;
if (!string.IsNullOrEmpty(SubPlan.UnitId))
{
drpUnit.SelectedValue = SubPlan.UnitId;
}
if (SubPlan.CompileDate != null)
{
txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", SubPlan.CompileDate);
}
txtPlanName.Text = SubPlan.PlanName;
if (!string.IsNullOrEmpty(SubPlan.UnitWorkIds))
{
if (SubPlan.UnitWorkIds.Length > 0)
{
txtUnitWork.Values = SubPlan.UnitWorkIds.Split(',');
}
}
if (!string.IsNullOrEmpty(SubPlan.CNProfessionalCodes))
{
if (SubPlan.CNProfessionalCodes.Length > 0)
{
txtCNProfessional.Values = SubPlan.CNProfessionalCodes.Split(',');
}
}
if (SubPlan.Edition != null)
{
txtEdition.Text = SubPlan.Edition.ToString();
}
bindApprove();
var zyUserIds = CQMS_SubPlanApproveService.GetUserIdsApprovesBySignType(SubPlanId, "ZY");
if (zyUserIds.Count > 0)
{
SetCheck(trOne, zyUserIds);
}
var zlUserIds = CQMS_SubPlanApproveService.GetUserIdsApprovesBySignType(SubPlanId, "ZL");
if (zlUserIds.Count > 0)
{
SetCheck(trTwo, zlUserIds);
}
var sgUserIds = CQMS_SubPlanApproveService.GetUserIdsApprovesBySignType(SubPlanId, "SG");
if (sgUserIds.Count > 0)
{
SetCheck(trFive, sgUserIds);
}
if (SubPlan.State == Const.SubPlan_ReCompile || SubPlan.State == Const.SubPlan_Compile)
{
agree.Hidden = true;
options.Hidden = true;
optio.Hidden = true;
}
if (SubPlan.State == Const.SubPlan_Audit)
{
txtProjectName.Enabled = false;
txtCode.Enabled = false;
drpUnit.Enabled = false;
txtCompileDate.Enabled = false;
txtPlanName.Enabled = false;
txtCNProfessional.Enabled = false;
txtUnitWork.Enabled = false;
ContactImg = -1;
Panel2.Enabled = false;
}
//提交版本人多次修改
if (SubPlan.CompileMan.Equals(CurrUser.PersonId))
{
txtProjectName.Enabled = true;
txtCode.Enabled = true;
drpUnit.Enabled = true;
txtCompileDate.Enabled = true;
txtPlanName.Enabled = true;
txtCNProfessional.Enabled = true;
txtUnitWork.Enabled = true;
ContactImg = 0;
Panel2.Enabled = true;
Model.Plan_SubPlanApprove approve = CQMS_SubPlanApproveService.GetSubPlanApproveByApproveMan(SubPlanId, CurrUser.PersonId);
if (approve == null)
{
rblIsAgree.Hidden = true;
rblIsAgree.Required = false;
options.Hidden = true;
txtOptions.Required = false;
optio.Hidden = true;
}
}
//if (!string.IsNullOrEmpty(countersign.CVRole))
//{
// GetCheck(tvCV.Nodes[0].ChildNodes, countersign.CVRole);
//}
}
else
{
agree.Hidden = true;
txtEdition.Text = "0";
options.Hidden = true;
optio.Hidden = true;
plApprove2.Hidden = true;
string prefix = BLL.ProjectService.GetProjectCodeByProjectId(this.CurrUser.LoginProjectId) + "-FBJH-";
txtCode.Text = BLL.SQLHelper.RunProcNewId("SpGetThreeNumber", "Plan_SubPlan", "Code", this.CurrUser.LoginProjectId, prefix);
this.txtPlanName.Text = "分包施工质量计划";
}
txtProjectName.Text = ProjectService.GetProjectByProjectId(CurrUser.LoginProjectId).ProjectName;
}
}
/// <summary>
/// 审批列表
/// </summary>
private void bindApprove()
{
var list = CQMS_SubPlanApproveService.getListData(SubPlanId);
gvApprove.DataSource = list;
gvApprove.DataBind();
}
public string man(Object man)
{
string appman = string.Empty;
if (Person_PersonsService.GetPerson_PersonsById(man.ToString()) != null)
{
appman = Person_PersonsService.GetPerson_PersonsById(man.ToString()).PersonName;
}
return appman;
}
#region /
protected void btnSave_Click(object sender, EventArgs e)
{
//validate(Const.BtnSave, "save");
if (CommonService.GetAllButtonPowerList(CurrUser.LoginProjectId, CurrUser.PersonId, Const.SubPlanMenuId, Const.BtnSave))
{
SaveSubPlan("save");
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
Alert.ShowInTop("保存成功!", MessageBoxIcon.Success);
}
else
{
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
validate(Const.BtnSave, "submmit");
}
/// <summary>
/// 保存验证
/// </summary>
/// <param name="buttonName"></param>
/// <param name="tip"></param>
public void validate(string buttonName, string tip)
{
if (CommonService.GetAllButtonPowerList(CurrUser.LoginProjectId, CurrUser.PersonId, Const.SubPlanMenuId, buttonName))
{
string err = string.Empty;
if (!AttachFileService.Getfile(HFSubPlanId.Text, Const.SubPlanMenuId))
{
err += "请上传附件,";
}
//if (string.IsNullOrEmpty(hdFilePath.Value))
//{
// err += "请上传附件,";
//}
//if (trOne.Nodes[0].Nodes.Count == 0 && trTwo.Nodes.Count == 0 && trThree.Nodes.Count == 0 &&
// trFour.Nodes.Count == 0 && trFive.Nodes.Count == 0 && trSixe.Nodes.Count == 0)
//{
// err += "请选择总包会签人员,";
//}
List<FineUIPro.Tree> list = new List<FineUIPro.Tree>();
list.Add(trOne);
list.Add(trTwo);
list.Add(trFive);
var res = false;
foreach (var item in list)
{
if (nodesCheckd(item))
{
res = true;
break;
}
}
if (!res)
{
err += "请选择总包会签人员,";
}
if (!string.IsNullOrWhiteSpace(err))
{
err = err.Substring(0, err.LastIndexOf(","));
err += "!";
}
if (!string.IsNullOrWhiteSpace(err))
{
Alert.ShowInTop(err, MessageBoxIcon.Warning);
return;
}
if (!string.IsNullOrWhiteSpace(SubPlanId))
{//更新时操作
if (tip == "save")
{
EditConstructSol("save");
}
else
{
EditConstructSol("submit");
}
}
else
{
if (tip == "save")
{
SaveSubPlan("save");
}
else
{
SaveSubPlan("submit");
}
//添加时操作
}
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
if (tip == "save")
{
tip = "保存成功!";
}
else
{
tip = "提交成功!";
}
Alert.ShowInTop(tip, MessageBoxIcon.Success);
}
else
{
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
}
}
/// <summary>
/// 编辑时候保存
/// </summary>
private void EditConstructSol(string saveType)
{
Model.Plan_SubPlan SubPlan = new Model.Plan_SubPlan();
SubPlan.Code = txtCode.Text.Trim();
SubPlan.ProjectId = CurrUser.LoginProjectId;
if (drpUnit.SelectedValue != "0")
{
SubPlan.UnitId = drpUnit.SelectedValue;
}
SubPlan.PlanName = txtPlanName.Text.Trim();
int edtion = Convert.ToInt32(txtEdition.Text);
SubPlan.Edition = edtion;
if (!string.IsNullOrEmpty(txtCompileDate.Text.Trim()))
{
SubPlan.CompileDate = Convert.ToDateTime(txtCompileDate.Text.Trim());
}
if (txtUnitWork.Values.Length > 0)
{
SubPlan.UnitWorkIds = string.Join(",", txtUnitWork.Values);
}
if (txtCNProfessional.Values.Length > 0)
{
SubPlan.CNProfessionalCodes = string.Join(",", txtCNProfessional.Values);
}
if (!string.IsNullOrEmpty(SubPlanId))
{
SubPlan.SubPlanId = SubPlanId;
Model.Plan_SubPlan SubPlan1 = CQMS_SubPlanService.GetSubPlanBySubPlanId(SubPlanId);
if (saveType == "submit")
{
if (CurrUser.PersonId != SubPlan1.CompileMan) //办理人不是编制人,提示查看审批信息
{
Model.Plan_SubPlanApprove sApprove = new Model.Plan_SubPlanApprove();
sApprove.SubPlanId = SubPlan.SubPlanId;
sApprove.ApproveMan = SubPlan1.CompileMan;
sApprove.ApproveType = "S";
CQMS_SubPlanApproveService.AddSubPlanApprove(sApprove);
if (SubPlan1.State == Const.SubPlan_Audit)
{
SubPlan.State = SubPlan1.State;
}
else
{
SubPlan.State = Const.SubPlan_Audit;
}
}
else
{
countersign(SubPlan.SubPlanId);
SubPlan.State = SubPlan1.State;
}
if (!CurrUser.PersonId.Equals(SubPlan1.CompileMan))
{
Model.Plan_SubPlanApprove approve = CQMS_SubPlanApproveService.GetConstructSoluAppByApproveMan(SubPlanId, CurrUser.PersonId, Convert.ToInt32(SubPlan1.Edition));
if (saveType == "submit")
{
approve.ApproveDate = DateTime.Now;
}
approve.Edition = Convert.ToInt32(edtion);
approve.IsAgree = Convert.ToBoolean(rblIsAgree.SelectedValue);
approve.ApproveIdea = txtOptions.Text.Trim();
CQMS_SubPlanApproveService.UpdateSubPlanApprove(approve);
}
else
{
if (saveType == "submit")
{
if (SubPlan1.State == Const.SubPlan_Audit)//==会签状态升级版本
{
Model.Plan_SubPlanApprove reApprove = new Model.Plan_SubPlanApprove();
reApprove.SubPlanId = SubPlan.SubPlanId;
reApprove.ApproveDate = DateTime.Now;
reApprove.ApproveMan = SubPlan1.CompileMan;
reApprove.ApproveType = Const.SubPlan_ReCompile;
edtion++;
reApprove.Edition = edtion;
CQMS_SubPlanApproveService.AddSubPlanApprove(reApprove);
}
else
{
Model.Plan_SubPlanApprove approves = CQMS_SubPlanApproveService.GetConstructSolApproveByApproveMan(SubPlanId, SubPlan1.CompileMan);
approves.ApproveDate = DateTime.Now;
CQMS_SubPlanApproveService.UpdateSubPlanApprove(approves);
}
}
}
}
else
{
SubPlan.State = SubPlan1.State;
}
//提交时候,更新提交版本
if (CurrUser.PersonId.Equals(SubPlan1.CompileMan))
{
if (SubPlan1.State != Const.SubPlan_Audit)
{
edtion++;
}
SubPlan.Edition = Convert.ToInt32(edtion);
SubPlan.State = Const.SubPlan_Audit;
}
CQMS_SubPlanService.UpdateSubPlan(SubPlan);
//判断状态,全部会签同意,则审批完成
if (saveType == "submit")
{
List<Model.Plan_SubPlanApprove> allApproves = CQMS_SubPlanApproveService.GetHandleSubPlanApprovesBySubPlanId(SubPlanId, SubPlan.Edition == null ? 0 : Convert.ToInt32(SubPlan.Edition));
var count = allApproves.Where(p => p.ApproveDate != null && p.IsAgree != null && Convert.ToBoolean(p.IsAgree)).Count();//查询会签同意的
var fcount = allApproves.Where(p => p.ApproveDate != null && p.IsAgree != null && !Convert.ToBoolean(p.IsAgree)).Count();//查询会签不同意的
if ((count + fcount) == allApproves.Count)
{
if (count == allApproves.Count)
{
var cons = CQMS_SubPlanService.GetSubPlanBySubPlanId(SubPlanId);
cons.State = Const.SubPlan_Complete;
cons.CompileDate = DateTime.Now;
CQMS_SubPlanService.UpdateSubPlan(cons);
}
//有不同意意见,打回重新编制
if (fcount > 0)
{
var cons = CQMS_SubPlanService.GetSubPlanBySubPlanId(SubPlanId);
Model.Plan_SubPlanApprove reApprove = new Model.Plan_SubPlanApprove();
reApprove.SubPlanId = SubPlan.SubPlanId;
reApprove.ApproveMan = cons.CompileMan;
reApprove.ApproveType = Const.SubPlan_ReCompile;
edtion++;
reApprove.Edition = edtion;
CQMS_SubPlanApproveService.AddSubPlanApprove(reApprove);
//cons.Edition = edtion;
cons.State = Const.SubPlan_ReCompile;
cons.CompileDate = DateTime.Now;
SubPlan.State = Const.SubPlan_ReCompile;
CQMS_SubPlanService.UpdateSubPlan(cons);
}
}
}
LogService.AddSys_Log(CurrUser, SubPlan.Code, SubPlanId, Const.SubPlanMenuId, "修改分包施工质量计划");
}
}
#endregion
#region
/// <summary>
/// 保存分包施工质量计划
/// </summary>
/// <param name="saveType">保存类型</param>
private void SaveSubPlan(string saveType)
{
//if (tvHSE.CheckedNodes.Count == 0 || (tvHSE.CheckedNodes.Count > 0 && tvHSE.CheckedNodes[0].Value == "0"))
//{
// ScriptManager.RegisterStartupScript(this, typeof(string), "_alert", "alert('请选择HSE会签人员')", true);
// return;
//}
Model.Plan_SubPlan SubPlan = new Model.Plan_SubPlan();
SubPlan.Code = txtCode.Text.Trim();
SubPlan.ProjectId = CurrUser.LoginProjectId;
if (drpUnit.SelectedValue != "0")
{
SubPlan.UnitId = drpUnit.SelectedValue;
}
SubPlan.PlanName = txtPlanName.Text.Trim();
SubPlan.FilePath = "FileUpload/CQMSSupPlan/" + SubPlan.Code + ".doc";
if (!string.IsNullOrEmpty(txtCompileDate.Text.Trim()))
{
SubPlan.CompileDate = Convert.ToDateTime(txtCompileDate.Text.Trim());
}
if (txtUnitWork.Values.Length > 0)
{
SubPlan.UnitWorkIds = string.Join(",", txtUnitWork.Values);
}
if (txtCNProfessional.Values.Length > 0)
{
SubPlan.CNProfessionalCodes = string.Join(",", txtCNProfessional.Values);
}
if (saveType == "submit")
{
SubPlan.State = Const.SubPlan_Audit;
}
else
{
SubPlan.State = Const.SubPlan_Compile;
}
SubPlan.CompileMan = CurrUser.PersonId;
SubPlan.Edition = Convert.ToInt32(txtEdition.Text);
if (!string.IsNullOrEmpty(this.SubPlanId))
{
SubPlan.SubPlanId = this.SubPlanId;
SubPlanId = SubPlan.SubPlanId;
CQMS_SubPlanService.UpdateSubPlan(SubPlan);
}
else
{
if (!string.IsNullOrEmpty(HFSubPlanId.Text))
{
SubPlan.SubPlanId = HFSubPlanId.Text;
}
else
{
SubPlan.SubPlanId = SQLHelper.GetNewID(typeof(Model.Plan_SubPlan));
}
SubPlanId = SubPlan.SubPlanId;
CQMS_SubPlanService.AddSubPlan(SubPlan);
}
if (saveType == "submit")
{
Model.Plan_SubPlanApprove approve1 = new Model.Plan_SubPlanApprove();
approve1.SubPlanId = SubPlan.SubPlanId;
approve1.ApproveDate = DateTime.Now;
approve1.ApproveMan = this.CurrUser.PersonId;
approve1.ApproveType = Const.SubPlan_Compile;
approve1.Edition = Convert.ToInt32(txtEdition.Text);
CQMS_SubPlanApproveService.AddSubPlanApprove(approve1);
}
else
{
Model.Plan_SubPlanApprove approve1 = new Model.Plan_SubPlanApprove();
approve1.SubPlanId = SubPlan.SubPlanId;
approve1.ApproveMan = this.CurrUser.PersonId;
approve1.ApproveType = Const.SubPlan_Compile;
approve1.Edition = Convert.ToInt32(txtEdition.Text);
CQMS_SubPlanApproveService.AddSubPlanApprove(approve1);
}
LogService.AddSys_Log(CurrUser, SubPlan.Code, SubPlanId, Const.SubPlanMenuId, "添加分包施工质量计划");
//}
//提交
if (saveType == "submit")
{
countersign(SubPlan.SubPlanId);
}
LogService.AddSys_Log(CurrUser, SubPlan.Code, SubPlanId, Const.SubPlanMenuId, "编制分包施工质量计划");
}
#endregion
/// <summary>
/// 删除未选择的代办记录
/// </summary>
/// <param name="SubPlanId"></param>
private void delSolutionApprove(string SubPlanId, string man, string signType)
{
var count = CQMS_SubPlanApproveService.getListSolutionApproveCount(SubPlanId, man, signType);
if (count > 0)
{
CQMS_SubPlanApproveService.delSolutionApprove(SubPlanId, man);
}
}
/// <summary>
/// 会签
/// </summary>
private void countersign(string SubPlanId)
{
if (trOne.Nodes[0].Nodes.Count > 0)
{
foreach (TreeNode tn in trOne.Nodes[0].Nodes)
{
if (tn.Checked)
{
Model.Plan_SubPlanApprove approve = new Model.Plan_SubPlanApprove();
approve.SubPlanId = SubPlanId;
approve.ApproveMan = tn.NodeID;
approve.ApproveType = Const.SubPlan_Audit;
approve.SignType = "ZY";
int edtion = Convert.ToInt32(txtEdition.Text);
if (!string.IsNullOrEmpty(Request.Params["SubPlanId"]))
{
edtion++;
}
approve.Edition = edtion;
delSolutionApprove(SubPlanId, tn.NodeID, "ZY");
CQMS_SubPlanApproveService.AddSubPlanApprove(approve);
APICommonService.SendSubscribeMessage(approve.ApproveMan, "分包施工质量计划待办理", this.CurrUser.PersonName, string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now));
}
else
{
delSolutionApprove(SubPlanId, tn.NodeID, "ZY");
}
}
}
if (trTwo.Nodes[0].Nodes.Count > 0)
{
foreach (TreeNode tn in trTwo.Nodes[0].Nodes)
{
if (tn.Checked)
{
Model.Plan_SubPlanApprove approve = new Model.Plan_SubPlanApprove();
approve.SubPlanId = SubPlanId;
approve.ApproveMan = tn.NodeID;
approve.ApproveType = Const.SubPlan_Audit;
approve.SignType = "ZL";
int edtion = Convert.ToInt32(txtEdition.Text);
if (!string.IsNullOrEmpty(Request.Params["SubPlanId"]))
{
edtion++;
}
approve.Edition = edtion;
delSolutionApprove(SubPlanId, tn.NodeID, "ZL");
CQMS_SubPlanApproveService.AddSubPlanApprove(approve);
APICommonService.SendSubscribeMessage(approve.ApproveMan, "分包施工质量计划待办理", this.CurrUser.PersonName, string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now));
}
else
{
delSolutionApprove(SubPlanId, tn.NodeID, "ZL");
}
}
}
if (trFive.Nodes[0].Nodes.Count > 0)
{
foreach (TreeNode tn in trFive.Nodes[0].Nodes)
{
if (tn.Checked)
{
Model.Plan_SubPlanApprove approve = new Model.Plan_SubPlanApprove();
approve.SubPlanId = SubPlanId;
approve.ApproveMan = tn.NodeID;
approve.ApproveType = Const.SubPlan_Audit;
approve.SignType = "SG";
int edtion = Convert.ToInt32(txtEdition.Text);
if (!string.IsNullOrEmpty(Request.Params["SubPlanId"]))
{
edtion++;
}
approve.Edition = edtion;
delSolutionApprove(SubPlanId, tn.NodeID, "SG");
CQMS_SubPlanApproveService.AddSubPlanApprove(approve);
APICommonService.SendSubscribeMessage(approve.ApproveMan, "分包施工质量计划待办理", this.CurrUser.PersonName, string.Format("{0:yyyy-MM-dd HH:mm:ss}", DateTime.Now));
}
else
{
delSolutionApprove(SubPlanId, tn.NodeID, "SG");
}
}
}
}
#region
/// <summary>
/// 设置树的节点选择
/// </summary>
/// <param name="nodes"></param>
/// <param name="role"></param>
private void SetCheck(Tree tree, List<string> userIds)
{
foreach (TreeNode tn in tree.Nodes[0].Nodes)
{
if (userIds.Contains(tn.NodeID))
{
tn.Checked = true;
}
}
}
/// <summary>
/// 判断是否有选择
/// </summary>
/// <param name="node"></param>
/// <returns></returns>
public Boolean nodesCheckd(Tree node)
{
bool res = false;
if (node.Nodes[0].Nodes.Count > 0)
{
foreach (var item in node.Nodes[0].Nodes)
{
if (item.Checked)
{
res = true;
break;
}
}
}
return res;
}
#endregion
#region
protected void trOne_NodeCheck(object sender, TreeCheckEventArgs e)
{
if (e.Checked)
{
trOne.CheckAllNodes(e.Node.Nodes);
}
else
{
trOne.UncheckAllNodes(e.Node.Nodes);
}
}
protected void trTwo_NodeCheck(object sender, TreeCheckEventArgs e)
{
if (e.Checked)
{
trTwo.CheckAllNodes(e.Node.Nodes);
}
else
{
trTwo.UncheckAllNodes(e.Node.Nodes);
}
}
protected void trFive_NodeCheck(object sender, TreeCheckEventArgs e)
{
if (e.Checked)
{
trFive.CheckAllNodes(e.Node.Nodes);
}
else
{
trFive.UncheckAllNodes(e.Node.Nodes);
}
}
#endregion
protected void imgBtnFile_Click(object sender, EventArgs e)
{
if (string.IsNullOrEmpty(HFSubPlanId.Text)) //新增记录
{
HFSubPlanId.Text = SQLHelper.GetNewID(typeof(Model.Plan_SubPlan));
}
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(
String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/Solution&menuId={2}",
ContactImg, HFSubPlanId.Text, Const.SubPlanMenuId)));
}
protected void btnapprove_Click(object sender, EventArgs e)
{
//HFSubPlanId.Text
var approve = CQMS_SubPlanApproveService.GetSubPlanApproveByApproveMan(HFSubPlanId.Text, CurrUser.PersonId);
if (approve != null)
{
var approveId = approve.SubPlanApproveId;
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(
String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/Solution&menuId={2}",
0, approveId, Const.SubPlanMenuId)));
}
}
protected void gvApprove_RowCommand(object sender, GridCommandEventArgs e)
{
object[] keys = gvApprove.DataKeys[e.RowIndex];
string fileId = string.Empty;
if (keys == null)
{
return;
}
else
{
fileId = keys[0].ToString();
}
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(
String.Format("../../AttachFile/webuploader.aspx?type={0}&toKeyId={1}&path=FileUpload/Solution&menuId={2}",
-1, fileId, Const.SubPlanMenuId)));
}
protected void PageManager1_CustomEvent(object sender, CustomEventArgs e)
{
string rootPath = Funs.RootPath;
var model = BLL.CQMS_SubPlanService.GetSubPlanBySubPlanId(SubPlanId);
string filepath = model.FilePath;
string path = rootPath + filepath;
DirectoryInfo pathInfo = new DirectoryInfo(path);
string newPath = pathInfo.Parent.FullName;
if (!Directory.Exists(newPath))
{
Directory.CreateDirectory(newPath);
}
if (e.EventArgument == "Yes")
{
if (!File.Exists(path))
{
File.Copy(rootPath + Const.CQMSPlanTemplateUrl, path);
}
}
else if (e.EventArgument == "No")
{
if (!File.Exists(path))
{
var stream = File.Create(path);
stream.Close();
}
}
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/IndexOffice.aspx?cmd={0}|CQMSSubPlan", SubPlanId, "查看 -")));
PageContext.RegisterStartupScript(WindowAtt.GetHideReference());
}
protected void btnEditWord_Click(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(SubPlanId))
{
var model = BLL.CQMS_SubPlanService.GetSubPlanBySubPlanId(SubPlanId);
if (!File.Exists(Funs.RootPath + model.FilePath))
{
GetCompanyTemplate();
}
else
{
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/IndexOffice.aspx?cmd={0}|CQMSSubPlan", SubPlanId, "查看 -")));
PageContext.RegisterStartupScript(WindowAtt.GetHideReference());
}
}
else
{
SaveSubPlan("save");
GetCompanyTemplate();
}
//PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/IndexOffice.aspx?cmd={0}", filepath, "查看 -")));
}
private void GetCompanyTemplate()
{
string rootPath = Funs.RootPath;
var model = BLL.CQMS_SubPlanService.GetSubPlanBySubPlanId(SubPlanId);
string filepath = model.FilePath;
string path = rootPath + filepath;
DirectoryInfo pathInfo = new DirectoryInfo(path);
string newPath = pathInfo.Parent.FullName;
if (!Directory.Exists(newPath))
{
Directory.CreateDirectory(newPath);
}
if (drpCompanyTemplate.SelectedValue != Const._Null)
{
var template = BLL.Base_CompanytemplateService.GetBase_CompanyTemplateById(drpCompanyTemplate.SelectedValue);
File.Copy(rootPath + template.FilePath, path);
}
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/IndexOffice.aspx?cmd={0}|CQMSSubPlan", SubPlanId, "查看 -")));
PageContext.RegisterStartupScript(WindowAtt.GetHideReference());
}
protected void IsHiddendrpCompanyTemplate()
{
if (!string.IsNullOrEmpty(SubPlanId))
{
Model.Plan_SubPlan SubPlan = BLL.CQMS_SubPlanService.GetSubPlanBySubPlanId(SubPlanId);
if (!File.Exists(Funs.RootPath + SubPlan.FilePath))
{
drpCompanyTemplate.Hidden = false;
}
}
else
{
drpCompanyTemplate.Hidden = false;
}
}
}
}