using BLL; using System; namespace FineUIPro.Web.CQMS.DataBase { public partial class WBS2FileEdit :PageBase { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { this.drpUnitId.DataValueField = "UnitId"; this.drpUnitId.DataTextField = "UnitName"; this.drpUnitId.DataSource = BLL.UnitService.GetMainAndSubUnitByProjectIdList(this.CurrUser.LoginProjectId); this.drpUnitId.DataBind(); Funs.FineUIPleaseSelect(this.drpUnitId); string fileId = Request.Params["fileId"]; if (!string.IsNullOrEmpty(fileId)) { Model.DataBase_File file = BLL.FileService.GetFileById(fileId); this.txtFileCode.Text = file.FileCode; this.txtFileName.Text = file.FileName; if (!string.IsNullOrEmpty(file.UnitId)) { this.drpUnitId.SelectedValue = file.UnitId; } this.txtPages.Text = file.Pages.HasValue ? file.Pages.ToString() : ""; this.txtRemark.Text = file.Remark; } } } #region 附件上传 /// /// 附件上传 /// /// /// protected void btnAttach_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(this.hdId.Text)) //新增记录 { this.hdId.Text = SQLHelper.GetNewID(typeof(Model.DataBase_File)); } PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("../../AttachFile/webuploader.aspx?type=0&toKeyId={0}&path=FileUpload/CommonUpLoadFile&menuId={1}", this.hdId.Text, BLL.Const.DataBaseProjectMenuId))); } #endregion #region 保存 /// /// 保存按钮 /// /// /// protected void btnSave_Click(object sender, EventArgs e) { string dataTypeProjectId = Request.Params["dataTypeProjectId"]; string divisionProjectId = Request.Params["divisionProjectId"]; string fileId = Request.Params["fileId"]; Model.DataBase_File newFile = new Model.DataBase_File(); newFile.FileCode = this.txtFileCode.Text.Trim(); newFile.FileName = this.txtFileName.Text.Trim(); newFile.Pages = Funs.GetNewInt(this.txtPages.Text.Trim()); newFile.Remark = this.txtRemark.Text.Trim(); if (!string.IsNullOrEmpty(fileId)) { newFile.FileId = fileId; BLL.FileService.UpdateFile(newFile); } else { newFile.DivisionProjectId = divisionProjectId; newFile.FileType = "分项工程质量验收记录"; newFile.DataTypeProjectId = dataTypeProjectId; newFile.ProjectId = this.CurrUser.LoginProjectId; newFile.CompileMan = this.CurrUser.UserId; newFile.CompileDate = DateTime.Now; if (this.drpUnitId.SelectedValue != BLL.Const._Null) { newFile.UnitId = this.drpUnitId.SelectedValue; } if (!string.IsNullOrEmpty(Request.Params["unitId"])) { newFile.UnitId = Request.Params["unitId"]; } if (!string.IsNullOrEmpty(this.hdId.Text.Trim())) { newFile.FileId = this.hdId.Text.Trim(); } else { newFile.FileId = SQLHelper.GetNewID(typeof(Model.DataBase_File)); this.hdId.Text = newFile.FileId; } BLL.FileService.AddFile(newFile); } ShowNotify("保存成功!", MessageBoxIcon.Success); PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference()); } #endregion } }