763 lines
29 KiB
C#
763 lines
29 KiB
C#
using BLL;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using Aspose.Words;
|
|
using System.Text;
|
|
using System.Web.Security;
|
|
using System.Collections;
|
|
|
|
namespace FineUIPro.Web.DocManage
|
|
{
|
|
public partial class DocManageEdit : PageBase
|
|
{
|
|
/// <summary>
|
|
/// 主键
|
|
/// </summary>
|
|
public string DocId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["DocId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["DocId"] = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 办理类型
|
|
/// </summary>
|
|
public string State
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["State"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["State"] = value;
|
|
}
|
|
}
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
UnitService.GetUnit(drpSendUnit, CurrUser.LoginProjectId, true);
|
|
UnitService.GetUnit(txtReceivUnit, CurrUser.LoginProjectId, true);
|
|
//DepartService.InitDepartDropDownList(drpDepart, this.CurrUser.UnitId, true);
|
|
UnitWorkService.InitUnitWorkDownList(drpProSubject, CurrUser.LoginProjectId,true);
|
|
DocTypeService.InitDocTypeDropDownList(drpDocType, true);
|
|
//CNProfessionalService.InitCNProfessionalDownList(drpCNProfessional, true);
|
|
Options.Hidden = true;
|
|
rblIsAgree.Visible = false;
|
|
DocId = Request.Params["DocId"];
|
|
BindForm();
|
|
InitCopyMan();
|
|
AddAttachTab();
|
|
}
|
|
}
|
|
|
|
private void AddAttachTab()
|
|
{
|
|
if (string.IsNullOrEmpty(hdDocId.Text)) //新增记录
|
|
{
|
|
hdDocId.Text = SQLHelper.GetNewID(typeof(Model.Doc_DocManage));
|
|
}
|
|
//string SourcePath = Request.RawUrl;
|
|
string SourcePath = "/DocManage/DocManageView.aspx?DocId=" + hdDocId.Text;
|
|
//SourcePath= SourcePath.Replace("DocManageEdit", "DocManageView");
|
|
string Classify = "文档管理-文档管理";
|
|
if (CCfile.Hidden!=true)
|
|
{
|
|
PageContext.RegisterStartupScript(TabStrip1.GetAddTabReference("dynamic_tab2", String.Format("../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/DocManage&menuId={1}", hdDocId.Text, Const.DocManageMenuId), "附件", IconHelper.GetIconUrl(Icon.Attach), false));
|
|
|
|
}
|
|
|
|
// PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/DocManage&menuId={1}", hdDocId.Text, Const.DocManageMenuId)));
|
|
|
|
}
|
|
|
|
private void InitCopyMan()
|
|
{
|
|
this.trCopyMan.Nodes.Clear();
|
|
this.trCopyMan.ShowBorder = false;
|
|
this.trCopyMan.ShowHeader = false;
|
|
this.trCopyMan.EnableIcons = true;
|
|
this.trCopyMan.AutoScroll = true;
|
|
this.trCopyMan.EnableSingleClickExpand = true;
|
|
TreeNode rootNode = new TreeNode
|
|
{
|
|
Text = "抄送人员",
|
|
NodeID = "0",
|
|
EnableCheckBox = false,
|
|
EnableCheckEvent = false,
|
|
Expanded = false
|
|
};
|
|
this.trCopyMan.Nodes.Add(rootNode);
|
|
var units = BLL.UnitService.GetUnitByProjectIdList(this.CurrUser.LoginProjectId);
|
|
string notCopyManId = this.CurrUser.UserId;
|
|
string exitCopyMan = string.Empty;
|
|
if (!string.IsNullOrEmpty(DocId))
|
|
{
|
|
Model.Doc_DocManage doc = BLL.DocManageService.GetDocByDocId(DocId);
|
|
if (doc != null)
|
|
{
|
|
notCopyManId = doc.CompileMan;
|
|
exitCopyMan = doc.CopyMan ?? string.Empty;
|
|
}
|
|
}
|
|
foreach (var unit in units)
|
|
{
|
|
TreeNode newNode = new TreeNode();
|
|
newNode.Text = unit.UnitName;
|
|
newNode.NodeID = unit.UnitId;
|
|
newNode.CommandName = "Unit";
|
|
newNode.EnableExpandEvent = true;
|
|
newNode.EnableCheckBox = true;
|
|
newNode.EnableCheckEvent = true;
|
|
newNode.Expanded = true;
|
|
rootNode.Nodes.Add(newNode);
|
|
var users = BLL.UserService.GetUserListByProjectIdAndUnitIdAndNotCopyManId(this.CurrUser.LoginProjectId, unit.UnitId, notCopyManId);
|
|
//var remove = users.FirstOrDefault(x => x.UserId == notCopyManId);
|
|
//users.Remove(remove);
|
|
foreach (var user in users)
|
|
{
|
|
TreeNode newNode2 = new TreeNode();
|
|
if (!string.IsNullOrEmpty(user.DepartId))
|
|
{
|
|
newNode2.Text = BLL.DepartService.getDepartNameById(user.DepartId) + "—" + user.UserName;
|
|
}
|
|
else
|
|
{
|
|
newNode2.Text = user.UserName;
|
|
}
|
|
newNode2.NodeID = user.UserId;
|
|
newNode2.CommandName = "User";
|
|
newNode2.EnableExpandEvent = true;
|
|
newNode2.EnableCheckBox = true;
|
|
newNode2.EnableCheckEvent = true;
|
|
if (exitCopyMan.Contains(user.UserId))
|
|
{
|
|
newNode2.EnableCheckBox = false;
|
|
newNode2.EnableCheckEvent = false;
|
|
if (!string.IsNullOrEmpty(user.DepartId))
|
|
{
|
|
newNode2.Text = BLL.DepartService.getDepartNameById(user.DepartId) + "—" + user.UserName + "(已抄送)";
|
|
}
|
|
else
|
|
{
|
|
newNode2.Text = user.UserName + "(已抄送)";
|
|
}
|
|
}
|
|
newNode.Nodes.Add(newNode2);
|
|
}
|
|
}
|
|
}
|
|
|
|
#region 全选、全不选
|
|
/// <summary>
|
|
/// 全选、全不选
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void trCopyMan_NodeCheck(object sender, FineUIPro.TreeCheckEventArgs e)
|
|
{
|
|
if (e.Checked)
|
|
{
|
|
this.trCopyMan.CheckAllNodes(e.Node.Nodes);
|
|
SetCheckParentNode(e.Node);
|
|
}
|
|
else
|
|
{
|
|
this.trCopyMan.UncheckAllNodes(e.Node.Nodes);
|
|
}
|
|
|
|
txtCopyMan.Text = GetCopyManName();
|
|
}
|
|
|
|
/// <summary>
|
|
/// 选中父节点
|
|
/// </summary>
|
|
/// <param name="node"></param>
|
|
private void SetCheckParentNode(TreeNode node)
|
|
{
|
|
if (node.ParentNode != null && node.ParentNode.NodeID != "0")
|
|
{
|
|
node.ParentNode.Checked = true;
|
|
if (node.ParentNode.ParentNode.NodeID != "0")
|
|
{
|
|
SetCheckParentNode(node.ParentNode);
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 绑定数据
|
|
public void BindForm()
|
|
{
|
|
if (!string.IsNullOrEmpty(DocId))
|
|
{
|
|
hdDocId.Text = DocId;
|
|
Model.Doc_DocManage doc = DocManageService.GetDocByDocId(DocId);
|
|
|
|
txtDocCode.Text = doc.DocCode;
|
|
txtDocName.Text = doc.DocName;
|
|
if (!string.IsNullOrEmpty(doc.SendUnitId))
|
|
{
|
|
drpSendUnit.SelectedValue = doc.SendUnitId;
|
|
// DepartService.InitDepartDropDownList(drpDepart, doc.SendUnitId, true);
|
|
}
|
|
else
|
|
{
|
|
drpSendUnit.SelectedValue = "";
|
|
}
|
|
//if (!string.IsNullOrEmpty(doc.DepartId))
|
|
//{
|
|
// drpDepart.SelectedValue = doc.DepartId;
|
|
//}
|
|
//else
|
|
//{
|
|
// if (doc.State != Const.Doc_State_0)
|
|
// {
|
|
// drpDepart.AutoSelectFirstItem = false;
|
|
// drpDepart.SelectedValue = "";
|
|
// }
|
|
|
|
//}
|
|
if (!string.IsNullOrEmpty(doc.ProjectSubjectId))
|
|
{
|
|
drpProSubject.SelectedValue = doc.ProjectSubjectId;
|
|
}
|
|
else
|
|
{
|
|
if (doc.State != Const.Doc_State_0)
|
|
{
|
|
drpProSubject.AutoSelectFirstItem = false;
|
|
drpProSubject.SelectedValue = "";
|
|
}
|
|
|
|
}
|
|
if (!string.IsNullOrEmpty(doc.DocTypeId))
|
|
{
|
|
drpDocType.SelectedValue = doc.DocTypeId;
|
|
}
|
|
else
|
|
{
|
|
if (doc.State != Const.Doc_State_0)
|
|
{
|
|
drpDocType.AutoSelectFirstItem = false;
|
|
drpDocType.SelectedValue = "";
|
|
}
|
|
|
|
|
|
}
|
|
//if (!string.IsNullOrEmpty(doc.CNProfessionalId))
|
|
//{
|
|
// drpCNProfessional.SelectedValue = doc.CNProfessionalId;
|
|
//}
|
|
//else
|
|
//{
|
|
// if (doc.State != Const.Doc_State_0)
|
|
// {
|
|
// drpCNProfessional.AutoSelectFirstItem = false;
|
|
// drpCNProfessional.SelectedValue = "";
|
|
// }
|
|
|
|
//}
|
|
txtCompileMan.Text = BLL.UserService.GetUserNameByUserId(doc.CompileMan);
|
|
if (doc.CompileDate != null)
|
|
{
|
|
this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", doc.CompileDate);
|
|
}
|
|
if (doc.FinishTime != null)
|
|
{
|
|
this.txtFinishTime.Text = string.Format("{0:yyyy-MM-dd}", doc.FinishTime);
|
|
}
|
|
txtDocContent.Text = HttpUtility.HtmlDecode(doc.DocContent);
|
|
if (!string.IsNullOrEmpty(doc.State))
|
|
{
|
|
State = doc.State;
|
|
if (doc.State == BLL.Const.Doc_State_1 && this.CurrUser.UserId != doc.CompileMan)
|
|
{
|
|
|
|
CCfile.Hidden = true;
|
|
Options.Hidden = false;
|
|
txtDocCode.Readonly = true;
|
|
txtDocName.Readonly = true;
|
|
drpSendUnit.Readonly = true;
|
|
//drpDepart.Readonly = true;
|
|
drpDocType.Readonly = true;
|
|
//drpCNProfessional.Readonly = true;
|
|
txtCompileMan.Readonly = true;
|
|
txtCompileDate.Readonly = true;
|
|
txtFinishTime.Readonly = true;
|
|
txtDocContent.Readonly = true;
|
|
drpProSubject.Readonly = true;
|
|
|
|
}
|
|
else if (doc.State == BLL.Const.Doc_State_1 && this.CurrUser.UserId == doc.CompileMan)
|
|
{
|
|
Options.Hidden = false;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
State = Const.Doc_State_0;
|
|
Options.Hidden = true;
|
|
rblIsAgree.Visible = false;
|
|
}
|
|
BindGrid();
|
|
}
|
|
else
|
|
{
|
|
State = Const.Doc_State_0;
|
|
plApprove2.Hidden = true;
|
|
this.txtCompileMan.Text = this.CurrUser.UserName;
|
|
this.txtCompileDate.Text = string.Format("{0:yyyy-MM-dd}", DateTime.Now);
|
|
drpSendUnit.SelectedValue = this.CurrUser.UnitId;
|
|
}
|
|
|
|
}
|
|
public void BindGrid()
|
|
{
|
|
var data = DocManageApproveService.GetListData(DocId);
|
|
gvApprove.DataSource = data;
|
|
gvApprove.DataBind();
|
|
}
|
|
|
|
#endregion
|
|
|
|
|
|
protected void drpHandleType_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
if (drpHandleMan.Items.Count > 0)
|
|
{
|
|
drpHandleMan.SelectedIndex = 0;
|
|
}
|
|
|
|
if (drpHandleType.SelectedValue == Const.Doc_State_2)
|
|
{
|
|
txtReceivUnit.Enabled = false;
|
|
txtReceivUnit.Required = false;
|
|
txtReceivUnit.SelectedIndex = 0;
|
|
drpHandleMan.Enabled = false;
|
|
drpHandleMan.Required = false;
|
|
|
|
}
|
|
else
|
|
{
|
|
txtReceivUnit.Enabled = true;
|
|
txtReceivUnit.Required = true;
|
|
|
|
drpHandleMan.Enabled = true;
|
|
drpHandleMan.Required = true;
|
|
}
|
|
}
|
|
public void submitPauseNotice()
|
|
{
|
|
SavePauseNotice();
|
|
Model.Doc_DocManage doc = DocManageService.GetDocByDocId(DocId);
|
|
|
|
if (!string.IsNullOrEmpty(DocId))
|
|
{
|
|
Model.Doc_DocManageApprove approve1 = DocManageApproveService.GetDocManageApproveByDocId(DocId); //获取当前审批人
|
|
if (doc.State == Const.Doc_State_0)
|
|
{
|
|
DocManageApproveService.DeleteDocManageApprovesByDocId(DocId);
|
|
approve1 = DocManageApproveService.GetDocManageApproveByDocId(DocId);
|
|
}
|
|
doc.State = drpHandleType.SelectedValue.Trim();
|
|
if (approve1 != null)
|
|
{
|
|
approve1.ApproveDate = DateTime.Now;
|
|
approve1.ApproveIdea = txtOpinions.Text.Trim();
|
|
DocManageApproveService.UpdateDocManageApprove(approve1);
|
|
if (doc.State == Const.Doc_State_1)
|
|
{
|
|
Model.Doc_DocManageApprove approve = new Model.Doc_DocManageApprove();
|
|
approve.DocId = doc.DocId;
|
|
if (drpHandleMan.SelectedValue != BLL.Const._Null)
|
|
{
|
|
approve.ApproveMan = drpHandleMan.SelectedValue;
|
|
if (string.IsNullOrEmpty(doc.AcceptMan))
|
|
{
|
|
doc.AcceptMan = doc.AcceptMan + drpHandleMan.SelectedValue;
|
|
|
|
}
|
|
else
|
|
{
|
|
doc.AcceptMan = doc.AcceptMan + "," + drpHandleMan.SelectedValue;
|
|
|
|
}
|
|
if (!string.IsNullOrEmpty(doc.ReceivUnitIds) && !doc.ReceivUnitIds.Contains(txtReceivUnit.SelectedValue))
|
|
{
|
|
doc.ReceivUnitIds = doc.ReceivUnitIds + "," + txtReceivUnit.SelectedValue;
|
|
|
|
}
|
|
else if (string.IsNullOrEmpty(doc.ReceivUnitIds))
|
|
{
|
|
doc.ReceivUnitIds = txtReceivUnit.SelectedValue;
|
|
}
|
|
|
|
}
|
|
DocManageApproveService.AddDocManageApprove(approve);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
Model.Doc_DocManageApprove approve = new Model.Doc_DocManageApprove();
|
|
approve.DocId = doc.DocId;
|
|
if (drpHandleMan.SelectedValue != BLL.Const._Null)
|
|
{
|
|
approve.ApproveMan = drpHandleMan.SelectedValue;
|
|
if (string.IsNullOrEmpty(doc.AcceptMan))
|
|
{
|
|
doc.AcceptMan = doc.AcceptMan + drpHandleMan.SelectedValue;
|
|
|
|
}
|
|
else
|
|
{
|
|
doc.AcceptMan = doc.AcceptMan + "," + drpHandleMan.SelectedValue;
|
|
|
|
}
|
|
if (!string.IsNullOrEmpty(doc.ReceivUnitIds) && !doc.ReceivUnitIds.Contains(txtReceivUnit.SelectedValue))
|
|
{
|
|
doc.ReceivUnitIds = doc.ReceivUnitIds + "," + txtReceivUnit.SelectedValue;
|
|
|
|
}
|
|
else if (string.IsNullOrEmpty(doc.ReceivUnitIds))
|
|
{
|
|
doc.ReceivUnitIds = txtReceivUnit.SelectedValue;
|
|
}
|
|
|
|
}
|
|
DocManageApproveService.AddDocManageApprove(approve);
|
|
}
|
|
|
|
DocManageService.UpdateDoc(doc);
|
|
}
|
|
NoticeCreateUser(DocId);
|
|
NoticeCopyMan(DocId);
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
LogService.AddSys_Log(CurrUser, doc.DocCode, DocId, Const.DocManageMenuId, "编辑文档");
|
|
}
|
|
/// <summary>
|
|
/// 保存文档
|
|
/// </summary>
|
|
private void SavePauseNotice()
|
|
{
|
|
Model.Doc_DocManage doc = new Model.Doc_DocManage();
|
|
doc.DocCode = txtDocCode.Text.Trim();
|
|
doc.DocName = txtDocName.Text.Trim();
|
|
doc.ProjectId = CurrUser.LoginProjectId;
|
|
if (drpSendUnit.SelectedValue != BLL.Const._Null)
|
|
{
|
|
doc.SendUnitId = drpSendUnit.SelectedValue;
|
|
}
|
|
//if (drpDepart.SelectedValue != BLL.Const._Null)
|
|
//{
|
|
// doc.DepartId = drpDepart.SelectedValue;
|
|
//}
|
|
if (drpProSubject.SelectedValue != BLL.Const._Null)
|
|
{
|
|
doc.ProjectSubjectId = drpProSubject.SelectedValue;
|
|
}
|
|
if (drpDocType.SelectedValue != BLL.Const._Null)
|
|
{
|
|
doc.DocTypeId = drpDocType.SelectedValue;
|
|
}
|
|
//if (drpCNProfessional.SelectedValue != BLL.Const._Null)
|
|
//{
|
|
// doc.CNProfessionalId = drpCNProfessional.SelectedValue;
|
|
//}
|
|
//else
|
|
//{
|
|
// var model = BLL.CNProfessionalService.GetCNProfessionalByName("通用");
|
|
// if (model != null)
|
|
// {
|
|
// doc.CNProfessionalId = model.CNProfessionalId;
|
|
|
|
// }
|
|
//}
|
|
doc.CompileDate = Funs.GetNewDateTimeOrNow(this.txtCompileDate.Text.Trim());
|
|
doc.FinishTime = Funs.GetNewDateTimeOrNow(this.txtFinishTime.Text.Trim());
|
|
|
|
doc.DocContent = txtDocContent.Text.Trim();
|
|
|
|
if (!string.IsNullOrEmpty(DocId))
|
|
{
|
|
var model = DocManageService.GetDocByDocId(DocId);
|
|
string state = model.State;
|
|
doc.DocId = DocId;
|
|
doc.State = string.IsNullOrEmpty(state) ? Const.Doc_State_0 : state;
|
|
doc.CompileMan = model.CompileMan;
|
|
doc.ReceivUnitIds = model.ReceivUnitIds;
|
|
doc.AcceptMan = model.AcceptMan;
|
|
doc.CopyMan = model.CopyMan;
|
|
DocManageService.UpdateDoc(doc);
|
|
}
|
|
else
|
|
{
|
|
if (!string.IsNullOrEmpty(hdDocId.Text))
|
|
{
|
|
doc.DocId = hdDocId.Text;
|
|
}
|
|
else
|
|
{
|
|
doc.DocId = SQLHelper.GetNewID(typeof(Model.Doc_DocManage));
|
|
}
|
|
DocId = doc.DocId;
|
|
doc.CompileMan = CurrUser.UserId;
|
|
doc.State = Const.Doc_State_0;
|
|
DocManageService.AddDoc(doc);
|
|
|
|
Model.Doc_DocManageApprove approve1 = new Model.Doc_DocManageApprove();
|
|
approve1.DocId = doc.DocId;
|
|
approve1.ApproveMan = CurrUser.UserId;
|
|
DocManageApproveService.AddDocManageApprove(approve1);
|
|
}
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
LogService.AddSys_Log(CurrUser, doc.DocCode, DocId, Const.DocManageMenuId, "编辑文档");
|
|
}
|
|
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
if (CommonService.GetAllButtonPowerList(CurrUser.LoginProjectId, CurrUser.UserId, Const.DocManageMenuId, Const.BtnSave))
|
|
{
|
|
SavePauseNotice();
|
|
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 闭环时推送通知到提出者
|
|
/// </summary>
|
|
/// <param name="DocId"></param>
|
|
public void NoticeCreateUser(string DocId)
|
|
{
|
|
var model = DocManageService.GetDocByDocId(DocId);
|
|
if (model != null)
|
|
{
|
|
if (model.State == Const.Doc_State_2)
|
|
{
|
|
Model.Doc_DocManageApprove approve = new Model.Doc_DocManageApprove();
|
|
approve.DocId = model.DocId;
|
|
approve.ApproveMan = model.CompileMan;
|
|
approve.Type = "s";
|
|
DocManageApproveService.AddDocManageApprove(approve);
|
|
|
|
}
|
|
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 推送通知到抄送人员
|
|
/// </summary>
|
|
/// <param name="DocId"></param>
|
|
public void NoticeCopyMan(string DocId)
|
|
{
|
|
TreeNode[] nodes = this.trCopyMan.GetCheckedNodes();
|
|
string copyMan = string.Empty;
|
|
if (nodes.Length > 0)
|
|
{
|
|
foreach (TreeNode tn in nodes)
|
|
{
|
|
if (tn.CommandName == "User")
|
|
{
|
|
Model.Doc_DocManageApprove approve = new Model.Doc_DocManageApprove();
|
|
approve.DocId = DocId;
|
|
approve.ApproveMan = tn.NodeID;
|
|
approve.Type = "s";
|
|
DocManageApproveService.AddDocManageApprove(approve);
|
|
copyMan += tn.NodeID + ",";
|
|
}
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(copyMan))
|
|
{
|
|
copyMan = copyMan.Substring(0, copyMan.Length - 1);
|
|
}
|
|
Model.Doc_DocManage doc = BLL.DocManageService.GetDocByDocId(DocId);
|
|
if (doc != null)
|
|
{
|
|
if (string.IsNullOrEmpty(doc.CopyMan))
|
|
{
|
|
doc.CopyMan = copyMan;
|
|
}
|
|
else
|
|
{
|
|
doc.CopyMan = doc.CopyMan + "," + copyMan;
|
|
}
|
|
BLL.DocManageService.UpdateDoc(doc);
|
|
}
|
|
}
|
|
|
|
protected string GetCopyManName()
|
|
{
|
|
TreeNode[] nodes = this.trCopyMan.GetCheckedNodes();
|
|
string copyMan = string.Empty;
|
|
string copyManName = string.Empty;
|
|
if (nodes.Length > 0)
|
|
{
|
|
foreach (TreeNode tn in nodes)
|
|
{
|
|
if (tn.CommandName == "User")
|
|
{
|
|
Model.Doc_DocManageApprove approve = new Model.Doc_DocManageApprove();
|
|
approve.DocId = DocId;
|
|
approve.ApproveMan = tn.NodeID;
|
|
approve.Type = "s";
|
|
DocManageApproveService.AddDocManageApprove(approve);
|
|
copyMan += tn.NodeID + ",";
|
|
}
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(copyMan))
|
|
{
|
|
copyMan = copyMan.Substring(0, copyMan.Length - 1);
|
|
}
|
|
|
|
copyManName = UserService.getUserNamesUserIds(copyMan);
|
|
return copyManName;
|
|
}
|
|
|
|
protected void btnSubmit_Click(object sender, EventArgs e)
|
|
{
|
|
if (CommonService.GetAllButtonPowerList(CurrUser.LoginProjectId, CurrUser.UserId, Const.DocManageMenuId, Const.BtnSave))
|
|
{
|
|
if (this.drpHandleType.SelectedValue != BLL.Const.Doc_State_2 && string.IsNullOrEmpty(this.txtReceivUnit.SelectedValue))
|
|
{
|
|
Alert.ShowInTop("请选择单位后再提交!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
if (this.drpHandleType.SelectedValue != BLL.Const.Doc_State_2 && this.drpHandleMan.SelectedValue == BLL.Const._Null)
|
|
{
|
|
Alert.ShowInTop("请选择办理人后再提交!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
if (Options.Hidden == false && string.IsNullOrEmpty(this.txtOpinions.Text.Trim()))
|
|
{
|
|
Alert.ShowInTop("请输入办理意见!", MessageBoxIcon.Warning);
|
|
return;
|
|
}
|
|
//if ( this.drpDepart.SelectedValue == BLL.Const._Null)
|
|
//{
|
|
// Alert.ShowInTop("请选择部门后再提交!", MessageBoxIcon.Warning);
|
|
// return;
|
|
//}
|
|
submitPauseNotice();
|
|
}
|
|
else
|
|
{
|
|
Alert.ShowInTop("您没有这个权限,请与管理员联系!", MessageBoxIcon.Warning);
|
|
}
|
|
}
|
|
|
|
protected void imgfile_Click(object sender, EventArgs e)
|
|
{
|
|
if (string.IsNullOrEmpty(hdDocId.Text)) //新增记录
|
|
{
|
|
hdDocId.Text = SQLHelper.GetNewID(typeof(Model.Doc_DocManage));
|
|
}
|
|
//string SourcePath = Request.RawUrl;
|
|
string SourcePath = "/DocManage/DocManageView.aspx?DocId=" + hdDocId.Text;
|
|
//SourcePath= SourcePath.Replace("DocManageEdit", "DocManageView");
|
|
string Classify = "文档管理-文档管理";
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/DocManage&menuId={1}", hdDocId.Text, Const.DocManageMenuId)));
|
|
//PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/DocManage&SourcePath={1}&Classify={2}", hdDocId.Text, SourcePath, Classify)));
|
|
}
|
|
/// <summary>
|
|
/// 总包的操作
|
|
/// </summary>
|
|
public void NotEdit()
|
|
{
|
|
txtDocCode.Enabled = false;
|
|
txtDocName.Enabled = false;
|
|
drpSendUnit.Enabled = false;
|
|
txtReceivUnit.Enabled = false;
|
|
drpDocType.Enabled = false;
|
|
// drpCNProfessional.Enabled = false;
|
|
txtCompileMan.Enabled = false;
|
|
txtCompileDate.Enabled = false;
|
|
txtDocContent.Enabled = false;
|
|
}
|
|
|
|
protected void txtReceivUnit_TextChanged(object sender, EventArgs e)
|
|
{
|
|
UserService.InitUserProjectIdUnitIdDropDownList(drpHandleMan, CurrUser.LoginProjectId, this.txtReceivUnit.SelectedValue, true);
|
|
if (this.drpHandleMan.Items.Count >= 2)
|
|
{
|
|
this.drpHandleMan.SelectedIndex = 1;
|
|
}
|
|
else
|
|
{
|
|
this.drpHandleMan.SelectedIndex = 0;
|
|
}
|
|
}
|
|
protected void ChangeDocCode(object sender, EventArgs e)
|
|
{
|
|
//string Code = "AAAA-BBBB-CCCC-DD-EEE-FFFF";
|
|
if (drpDocType.SelectedValue == Const._Null)
|
|
{
|
|
return;
|
|
}
|
|
var Typemodel = DocTypeService.GetDocTypeById(drpDocType.SelectedValue);
|
|
if (string.IsNullOrEmpty(Typemodel.CodeRule))
|
|
{
|
|
ShowNotify("请维护当前类型编码规则", MessageBoxIcon.Warning);
|
|
txtDocCode.Text = "";
|
|
return;
|
|
}
|
|
string CodeRule = Typemodel.CodeRule;
|
|
string[] CodeList = CodeRule.Split('-');
|
|
if (CodeList == null && CodeList.Length != 6)
|
|
{
|
|
ShowNotify("请维护当前类型编码规则", MessageBoxIcon.Warning);
|
|
txtDocCode.Text = "";
|
|
|
|
return;
|
|
}
|
|
CodeList[0] = "CWCEC";
|
|
if (drpSendUnit.SelectedValue != Const._Null)
|
|
{
|
|
CodeList[1] = UnitService.GetUnitCodeByUnitId(drpSendUnit.SelectedValue);
|
|
}
|
|
|
|
if (drpProSubject.SelectedValue != Const._Null && !string.IsNullOrEmpty(drpProSubject.SelectedValue))
|
|
{
|
|
CodeList[2] = UnitWorkService.getUnitWorkByUnitWorkId(drpProSubject.SelectedValue).UnitWorkCode;
|
|
|
|
}
|
|
else
|
|
{
|
|
CodeList[2] = "0000";
|
|
|
|
}
|
|
//if (drpDepart.SelectedValue!=Const._Null)
|
|
//{
|
|
// CodeList[3] = DepartService.GetDepartById(drpDepart.SelectedValue).DepartCode;
|
|
//}
|
|
|
|
ArrayList al = new ArrayList(CodeList);
|
|
al.RemoveAt(5);
|
|
CodeList = (string[])al.ToArray(typeof(string));
|
|
|
|
string Code = string.Join("-", CodeList);
|
|
Code += "-";
|
|
txtDocCode.Text = SQLHelper.RunProcNewIdByProjectId("SpGetNewCode5ByProjectId", "dbo.Doc_DocManage", "DocCode", CurrUser.LoginProjectId, Code);
|
|
|
|
}
|
|
}
|
|
} |