221 lines
8.9 KiB
C#
221 lines
8.9 KiB
C#
using BLL;
|
||
using System;
|
||
using System.Linq;
|
||
using System.Web;
|
||
namespace FineUIPro.Web.ZHGL.FinalFileManage
|
||
{
|
||
public partial class SendAndAccepView : PageBase
|
||
{
|
||
#region 定义项
|
||
/// <summary>
|
||
/// 主键
|
||
/// </summary>
|
||
public string FileId
|
||
{
|
||
get
|
||
{
|
||
return (string)ViewState["FileId"];
|
||
}
|
||
set
|
||
{
|
||
ViewState["FileId"] = value;
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 项目主键
|
||
/// </summary>
|
||
public string ProjectId
|
||
{
|
||
get
|
||
{
|
||
return (string)ViewState["ProjectId"];
|
||
}
|
||
set
|
||
{
|
||
ViewState["ProjectId"] = value;
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 类型 1-回复页面
|
||
/// </summary>
|
||
public string Type
|
||
{
|
||
get
|
||
{
|
||
return (string)ViewState["Type"];
|
||
}
|
||
set
|
||
{
|
||
ViewState["Type"] = value;
|
||
}
|
||
}
|
||
|
||
#endregion
|
||
protected void Page_Load(object sender, EventArgs e)
|
||
{
|
||
if (!IsPostBack)
|
||
{
|
||
FileId = Request.Params["FileId"];
|
||
Type = Request.Params["Type"];
|
||
//加载所有单位(公司级)
|
||
BLL.UnitService.InitNoThisAllUnitDownList(this.drpUnit, true);
|
||
|
||
if (!string.IsNullOrEmpty(this.FileId))
|
||
{
|
||
Model.FinalFileManage_SendAndAccep SendAndAccep = BLL.SendAndAccepService.GetSendAndAccepById(this.FileId);
|
||
if (SendAndAccep != null)
|
||
{
|
||
///读取编号
|
||
this.txtFileCode.Text = SendAndAccep.FileCode;
|
||
this.txtFileName.Text = SendAndAccep.FileName;
|
||
this.txtKeyWords.Text = SendAndAccep.KeyWords;
|
||
this.txtFileContent.Text = HttpUtility.HtmlDecode(SendAndAccep.FileContent);
|
||
this.txtReplyDatePlan.Text = string.Format("{0:yyyy-MM-dd}", SendAndAccep.ReplyDatePlan);
|
||
|
||
//加载回复内容
|
||
//如果是本部的加载所有,不是本部加载自己的
|
||
var replyList = Funs.DB.FinalFileManage_SendAndAccep_Reply.Where(x => x.FileId == FileId).ToList();
|
||
if (CurrUser.UserId == Const.sysglyId || CurrUser.UserId == Const.hfnbdId)
|
||
{
|
||
foreach (var item in replyList)
|
||
{
|
||
this.txtReplyContent.Text += "《"+ APIUnitService.getUnitByUnitId(item.UnitId).UnitName + "》回复内容:"+item.ReplyContent+";";
|
||
}
|
||
}else if (CurrUser.UnitId== "A26E718E-C3B3-458E-A5A3-D2568A0F7D49")
|
||
{
|
||
//本部
|
||
foreach (var item in replyList)
|
||
{
|
||
this.txtReplyContent.Text += "《" + APIUnitService.getUnitByUnitId(item.UnitId).UnitName + "》回复内容:" + item.ReplyContent + ";";
|
||
}
|
||
}
|
||
else
|
||
{
|
||
replyList = replyList.Where(x => x.UnitId == CurrUser.UnitId).ToList();
|
||
if (replyList.Count>0)
|
||
{
|
||
this.txtReplyContent.Text += replyList[0].ReplyContent;
|
||
}
|
||
|
||
}
|
||
|
||
|
||
|
||
//单位 和 项目
|
||
if (!string.IsNullOrEmpty(SendAndAccep.UnitId))
|
||
{
|
||
this.drpUnit.SelectedValueArray = SendAndAccep.UnitId.Split(',');
|
||
}
|
||
loadProjectByUnits();
|
||
//BLL.ProjectService.InitUnitProjectDropDownList(this.drpProject, this.drpUnit.SelectedValue, true);
|
||
if (!string.IsNullOrEmpty(SendAndAccep.ProjectId))
|
||
{
|
||
this.drpProject.SelectedValueArray = SendAndAccep.ProjectId.Split(',');
|
||
}
|
||
//回复页面
|
||
if (Type == "1")
|
||
{
|
||
this.hfType.Hidden = false;
|
||
this.btnSubmit.Hidden = false;
|
||
this.txtFileContent.Text = HttpUtility.HtmlDecode("");
|
||
}
|
||
if (SendAndAccep.States == "2")
|
||
{
|
||
this.hfType.Hidden = false;
|
||
}
|
||
else {
|
||
this.hfType.Hidden = false;
|
||
}
|
||
this.ddlFileType.SelectedValue = SendAndAccep.FileType;
|
||
//如果接收人和单位都是空 隐藏回复
|
||
if (string.IsNullOrEmpty(SendAndAccep.UnitId) && string.IsNullOrEmpty(SendAndAccep.ProjectId))
|
||
{
|
||
hfType.Hidden = true;
|
||
Toolbar1.Hidden = true;
|
||
}
|
||
if (SendAndAccep.UnitId=="null")
|
||
{
|
||
hfType.Hidden = true;
|
||
btnSubmit.Hidden = true;
|
||
}
|
||
string fwType = Request.Params["Fwtype"];
|
||
if (fwType=="1")
|
||
{
|
||
drpUnit.Hidden = true;
|
||
drpProject.Hidden = true;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
protected void loadProjectByUnits()
|
||
{
|
||
var units = "";
|
||
for (int i = 0; i < drpUnit.SelectedValueArray.Length; i++)
|
||
{
|
||
if (drpUnit.SelectedValueArray[i] != Const._Null)
|
||
{
|
||
units += "" + drpUnit.SelectedValueArray[i] + ",";
|
||
}
|
||
}
|
||
if (units != "")
|
||
{
|
||
units = units.Substring(0, units.Length - 1);
|
||
BLL.ProjectService.InitUnitProjectDropDownListList(this.drpProject, units, true);
|
||
}
|
||
}
|
||
/// <summary>
|
||
/// 回复按钮
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnSubmit_Click(object sender, EventArgs e)
|
||
{
|
||
if (string.IsNullOrEmpty(this.txtReplyContent.Text.Trim()))
|
||
{
|
||
ShowNotify("请填写回复内容!", MessageBoxIcon.Warning);
|
||
return;
|
||
}
|
||
var model = Funs.DB.FinalFileManage_SendAndAccep_Reply.FirstOrDefault(x => x.UnitId == CurrUser.UnitId && x.FileId == FileId);
|
||
if (model == null)
|
||
{
|
||
model = new Model.FinalFileManage_SendAndAccep_Reply();
|
||
model.ReplyId = Guid.NewGuid().ToString();
|
||
model.FileId = FileId;
|
||
model.UnitId = CurrUser.UnitId;
|
||
model.ReplyContent= this.txtReplyContent.Text.Trim();
|
||
Funs.DB.FinalFileManage_SendAndAccep_Reply.InsertOnSubmit(model);
|
||
Funs.DB.SubmitChanges();
|
||
}
|
||
else {
|
||
model.ReplyContent = this.txtReplyContent.Text.Trim();
|
||
Funs.DB.SubmitChanges();
|
||
}
|
||
////model.States = "2";
|
||
//model.ReplyContent = "《"+APIUnitService.getUnitByUnitId(CurrUser.UnitId).UnitName+"》回复内容:"+ this.txtReplyContent.Text.Trim()+";";
|
||
////当前回复时间
|
||
//model.ReplyDateReal = DateTime.Now;
|
||
//BLL.SendAndAccepService.ReplySendAndAccep(model);
|
||
Alert.ShowInTop("回复成功!", MessageBoxIcon.Success);
|
||
PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference());
|
||
}
|
||
|
||
#region 附件上传
|
||
/// <summary>
|
||
/// 上传附件
|
||
/// </summary>
|
||
/// <param name="sender"></param>
|
||
/// <param name="e"></param>
|
||
protected void btnAttachUrl_Click(object sender, EventArgs e)
|
||
{
|
||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/SendAndAccepAttachUrl&menuId={1}", FileId, BLL.Const.SendAndAccepMenuId)));
|
||
}
|
||
protected void btnTest_Click(object sender, EventArgs e)
|
||
{
|
||
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/SendAndAccepAttachUrl&menuId={1}", FileId + "-test", BLL.Const.SendAndAccepMenuId)));
|
||
}
|
||
#endregion
|
||
|
||
|
||
}
|
||
} |