using BLL; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; namespace FineUIPro.Web.HJGL.DataImport { public partial class DrawingImportEdit : PageBase { public string UnitWorkId { get { return (string)ViewState["UnitWorkId"]; } set { ViewState["UnitWorkId"] = value; } } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { UnitWorkId = Request.Params["UnitWorkId"]; BLL.DesignProfessionalService.InitDesignProfessionalDownList(this.DropDesignProfessional, true); } } #region 附件 /// /// 上传 /// /// /// protected void btnAttachUrl_Remark_Click(object sender, EventArgs e) { string ContractId = ""; if (string.IsNullOrEmpty(ContractId)) { ContractId = Guid.NewGuid().ToString(); } PageContext.RegisterStartupScript(WindowAtt.GetShowReference(String.Format("~/AttachFile/webuploader.aspx?toKeyId={0}&path=FileUpload/HJGL_DataImport/{1}&menuId={2}&&Type=0", ContractId, UnitWorkId, BLL.Const.HJGL_DrawingImportMenuId))); } #endregion protected void WindowAtt_Close(object sender, WindowCloseEventArgs e) { JArray source = (JArray)Session["AttachFile.webuploader"]; } public string Save() { string result = ""; if (Session["AttachFile.webuploader"] == null) { ShowNotify("请先上传文件!", MessageBoxIcon.Error); return result; } List root = JsonConvert.DeserializeObject>(Session["AttachFile.webuploader"].ToString()); foreach (var item in root) { Model.HJGL_DataImport dataImport = new Model.HJGL_DataImport(); dataImport.DataImportId = SQLHelper.GetNewID(typeof(Model.HJGL_DataImport)); dataImport.ProjectId = this.CurrUser.LoginProjectId; dataImport.UnitWorkId = UnitWorkId; dataImport.DesignProfessionalId = DropDesignProfessional.SelectedValue; dataImport.ImportType = DropImportType.SelectedValue; dataImport.FileName = item.name; dataImport.FilePath = item.folder + item.savedName; dataImport.FileType = item.type; dataImport.FileSize = item.size.ToString(); dataImport.FileId = item.id; dataImport.Version = BLL.HJGL_DataImportService.GetNewVersionByUnitWorkId(UnitWorkId, item.name); dataImport.Remark = txtRemark.Text; dataImport.CreateMan = this.CurrUser.PersonId; dataImport.CreateDate = DateTime.Now; BLL.HJGL_DataImportService.AddHJGL_DataImport(dataImport); if (!BLL.HJGL_DataImportService.UploadFileToOa(Funs.RootPath + dataImport.FilePath, dataImport.UnitWorkId, "2")) { string str =" "+ dataImport.FileName+"推送失败|"; result += str; } } Session.Remove("AttachFile.webuploader"); return result; } protected void btnSave_Click(object sender, EventArgs e) { string result= Save(); if (result =="") { ShowNotify("保存成功!", MessageBoxIcon.Success); } else { ShowNotify(result, MessageBoxIcon.Warning); } PageContext.RegisterStartupScript(ActiveWindow.GetHideRefreshReference()); } } }