/// <summary> /// 页面初始化 /// </summary> /// <param name="id">操作ID</param> protected void PageInit(string id) { #region 用户控件初始化 this.SingleFileUpload1.CompanyID = this.SiteUserInfo.CompanyId; #endregion if (!string.IsNullOrEmpty(id)) { EyouSoft.Model.GovStructure.MGovDocuments model = new EyouSoft.Model.GovStructure.MGovDocuments(); EyouSoft.BLL.GovStructure.BDocuments BLL = new EyouSoft.BLL.GovStructure.BDocuments(); model = BLL.GetGovFilePersonnelModel(id); if (model != null) { this.hidKeyId.Value = model.DocumentsId; this.txtfileSize.Text = model.FontSize; this.txtcompany.Text = model.Company; this.txttitle.Text = model.Title; //审批或传阅 this.shenpi.Checked = model.FileType == FileType.审批; this.chuanyue.Checked = model.FileType == FileType.阅; //经办人 this.HrSelect1.HrSelectID = model.AttnId; this.HrSelect1.HrSelectName = model.AttnName; //审批人 this.SellsSelect1.SellsID = GetSells(model.GovDocumentsApproveList, 1); this.SellsSelect1.SellsName = GetSells(model.GovDocumentsApproveList, 2); StringBuilder strFile = new StringBuilder(); IList <EyouSoft.Model.ComStructure.MComAttach> lstFile = model.ComAttachList; if (null != lstFile && lstFile.Count > 0) { for (int i = 0; i < lstFile.Count; i++) { strFile.AppendFormat("<span class='upload_filename'><a href='/CommonPage/FileDownLoad.aspx?doType=downLoad&filePath={0}&name={1}' target='_blank'>{1}</a><a href=\"javascript:void(0)\" onclick=\"PageJsData.DelFile(this)\" title='删除附件'><img style='vertical-align:middle' src='/images/cha.gif'></a><input type=\"hidden\" name=\"hideFileInfo\" value='{1}|{0}'/></span>", lstFile[i].FilePath, lstFile[i].Name); } } this.lbFiles.Text = strFile.ToString();//附件 if (!this.SiteUserInfo.IsHandleElse && this.SiteUserInfo.UserId != model.OperatorID) { this.ph_Save.Visible = false; } } } }
/// <summary> /// 页面保存 /// </summary> protected void PageSave(string doType) { #region 表单取值 string documentid = Utils.GetFormValue(hidKeyId.UniqueID); string fontsize = Utils.GetFormValue(txtfileSize.UniqueID); string company = Utils.GetFormValue(txtcompany.UniqueID); string title = Utils.GetFormValue(txttitle.UniqueID); string attnid = Utils.GetFormValue(HrSelect1.HrSelectIDClient); string attnname = Utils.GetFormValue(HrSelect1.HrSelectNameClient); string approveid = Utils.GetFormValue(SellsSelect1.SellsIDClient); string approvename = Utils.GetFormValue(SellsSelect1.SellsNameClient); string isPass = Utils.GetFormValue("isPass"); #endregion #region 表单验证 string msg = ""; bool result = false; if (string.IsNullOrEmpty(fontsize)) { msg += "-请输入文件字号!"; } if (string.IsNullOrEmpty(company)) { msg += "-请输入文件发布单位!"; } if (string.IsNullOrEmpty(title)) { msg += "-请输入文件标题!"; } if (string.IsNullOrEmpty(approveid) || string.IsNullOrEmpty(approvename)) { msg += "-请选择审批或者传阅人!"; } if (string.IsNullOrEmpty(attnid) || string.IsNullOrEmpty(attnname)) { msg += "-请选择经办人!"; } if (!string.IsNullOrEmpty(msg)) { Response.Clear(); Response.Write(UtilsCommons.AjaxReturnJson(result ? "1" : "0", msg)); Response.End(); } #endregion #region 实体赋值 EyouSoft.Model.GovStructure.MGovDocuments model = new EyouSoft.Model.GovStructure.MGovDocuments(); model.AttnId = attnid; model.AttnName = attnname; model.Company = company; model.CompanyId = this.SiteUserInfo.CompanyId; model.DocumentsId = documentid; model.FileType = isPass == "shenpi" ? FileType.审批 : FileType.阅; model.FontSize = fontsize; model.GovDocumentsApproveList = GetList(approveid, approvename); model.IssueTime = DateTime.Now; model.OperatorID = this.SiteUserInfo.UserId; model.Title = title; model.ComAttachList = NewGetAttach(); #endregion #region 保存提交 EyouSoft.BLL.GovStructure.BDocuments BLL = new EyouSoft.BLL.GovStructure.BDocuments(); if (doType == "add") { result = BLL.AddGovDocuments(model); msg = result ? "添加成功!" : "添加失败!"; } else { result = BLL.UpdateGovDocuments(model, AttachItemType.文件管理); msg = result ? "修改成功!" : "修改失败!"; } Response.Clear(); Response.Write(UtilsCommons.AjaxReturnJson(result ? "1" : "0", msg)); Response.End(); #endregion }