175 lines
6.9 KiB
C#
175 lines
6.9 KiB
C#
using BLL;
|
|
using System;
|
|
|
|
namespace FineUIPro.Web.CQMS.Comprehensive
|
|
{
|
|
public partial class DataReceivingEdit : PageBase
|
|
{
|
|
#region 定义变量
|
|
/// <summary>
|
|
/// 主键
|
|
/// </summary>
|
|
public string DataReceivingId
|
|
{
|
|
get
|
|
{
|
|
return (string)ViewState["DataReceivingId"];
|
|
}
|
|
set
|
|
{
|
|
ViewState["DataReceivingId"] = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 加载
|
|
/// <summary>
|
|
/// 加载页面
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
GetButtonPower();
|
|
this.DataReceivingId = Request.Params["DataReceivingId"];
|
|
BLL.UnitService.GetUnit(this.drpUnitIds, this.CurrUser.LoginProjectId, false);
|
|
Model.Comprehensive_DataReceiving dataReceiving = BLL.DataReceivingService.GetDataReceivingById(this.DataReceivingId);
|
|
if (dataReceiving != null)
|
|
{
|
|
this.DataReceivingId = dataReceiving.DataReceivingId;
|
|
this.hdAttachUrl.Text = this.DataReceivingId;
|
|
this.txtFileCode.Text = dataReceiving.FileCode;
|
|
this.txtFileName.Text = dataReceiving.FileName;
|
|
if (dataReceiving.DataReceivingDate != null)
|
|
{
|
|
this.txtDataReceivingDate.Text = string.Format("{0:yyyy-MM-dd}", dataReceiving.DataReceivingDate);
|
|
}
|
|
|
|
if (!string.IsNullOrEmpty(dataReceiving.SendUnit))
|
|
{
|
|
this.drpUnitIds.SelectedValueArray = dataReceiving.SendUnit.Split(',');
|
|
}
|
|
|
|
this.txtSendMan.Text = dataReceiving.SendMan;
|
|
if (!string.IsNullOrEmpty(dataReceiving.FileType))
|
|
{
|
|
this.drpFileType.SelectedValue = dataReceiving.FileType;
|
|
}
|
|
if (dataReceiving.CopiesCount != null)
|
|
{
|
|
this.txtCopiesCount.Text = Convert.ToString(dataReceiving.CopiesCount);
|
|
}
|
|
this.txtReceivingMan.Text = dataReceiving.ReceivingMan;
|
|
this.txtFileHandler.Text = dataReceiving.FileHandler;
|
|
if (dataReceiving.IsReply == true)
|
|
{
|
|
this.rblIsReply.SelectedValue = "true";
|
|
}
|
|
else
|
|
{
|
|
this.rblIsReply.SelectedValue = "false";
|
|
}
|
|
this.txtRemark.Text = dataReceiving.Remark;
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region 保存
|
|
/// <summary>
|
|
/// 保存按钮
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnSave_Click(object sender, EventArgs e)
|
|
{
|
|
Model.Comprehensive_DataReceiving dataReceiving = new Model.Comprehensive_DataReceiving();
|
|
dataReceiving.ProjectId = this.CurrUser.LoginProjectId;
|
|
dataReceiving.FileCode = this.txtFileCode.Text.Trim();
|
|
dataReceiving.FileName = this.txtFileName.Text.Trim();
|
|
dataReceiving.DataReceivingDate = Funs.GetNewDateTime(this.txtDataReceivingDate.Text);
|
|
dataReceiving.SendMan = this.txtSendMan.Text.Trim();
|
|
dataReceiving.FileType = this.drpFileType.SelectedValue;
|
|
dataReceiving.CopiesCount = Funs.GetNewInt(this.txtCopiesCount.Text.Trim());
|
|
dataReceiving.ReceivingMan = this.txtReceivingMan.Text.Trim();
|
|
dataReceiving.FileHandler = this.txtFileHandler.Text.Trim();
|
|
dataReceiving.IsReply = Convert.ToBoolean(this.rblIsReply.SelectedValue);
|
|
dataReceiving.Remark = this.txtRemark.Text.Trim();
|
|
string unitIds = string.Empty;
|
|
var unitList = this.drpUnitIds.SelectedValueArray;
|
|
foreach (var item in unitList)
|
|
{
|
|
unitIds += item + ",";
|
|
}
|
|
if (!string.IsNullOrEmpty(unitIds))
|
|
{
|
|
unitIds = unitIds.Substring(0, unitIds.LastIndexOf(","));
|
|
}
|
|
dataReceiving.SendUnit = unitIds;
|
|
if (string.IsNullOrEmpty(this.DataReceivingId))
|
|
{
|
|
if (!string.IsNullOrEmpty(this.hdAttachUrl.Text))
|
|
{
|
|
dataReceiving.DataReceivingId = this.hdAttachUrl.Text;
|
|
}
|
|
else
|
|
{
|
|
dataReceiving.DataReceivingId = SQLHelper.GetNewID(typeof(Model.Comprehensive_DataReceiving));
|
|
this.hdAttachUrl.Text = dataReceiving.DataReceivingId;
|
|
}
|
|
dataReceiving.CompileMan = this.CurrUser.UserId;
|
|
dataReceiving.CompileDate = DateTime.Now;
|
|
BLL.DataReceivingService.AddDataReceiving(dataReceiving);
|
|
}
|
|
else
|
|
{
|
|
dataReceiving.DataReceivingId = this.DataReceivingId;
|
|
BLL.DataReceivingService.UpdateDataReceiving(dataReceiving);
|
|
}
|
|
ShowNotify("保存成功!", MessageBoxIcon.Success);
|
|
PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
|
|
}
|
|
#endregion
|
|
|
|
#region 附件上传
|
|
/// <summary>
|
|
/// 附件上传
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
protected void btnAttach_Click(object sender, EventArgs e)
|
|
{
|
|
if (string.IsNullOrEmpty(this.hdAttachUrl.Text)) //新增记录
|
|
{
|
|
this.hdAttachUrl.Text = SQLHelper.GetNewID(typeof(Model.Comprehensive_DataReceiving));
|
|
}
|
|
PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/CQMS/DataReceiving&menuId={1}", this.hdAttachUrl.Text, BLL.Const.DataReceivingMenuId)));
|
|
}
|
|
#endregion
|
|
|
|
#region 获取按钮权限
|
|
/// <summary>
|
|
/// 获取按钮权限
|
|
/// </summary>
|
|
/// <param name="button"></param>
|
|
/// <returns></returns>
|
|
private void GetButtonPower()
|
|
{
|
|
if (Request.Params["value"] == BLL.Const._Null)
|
|
{
|
|
return;
|
|
}
|
|
var buttonList = BLL.CommonService.GetAllButtonList(this.CurrUser.LoginProjectId, this.CurrUser.UserId, BLL.Const.DataReceivingMenuId);
|
|
if (buttonList.Count > 0)
|
|
{
|
|
if (buttonList.Contains(BLL.Const.BtnSave))
|
|
{
|
|
this.btnSave.Hidden = false;
|
|
}
|
|
}
|
|
}
|
|
#endregion
|
|
}
|
|
} |