public void BindShow() { string id = Request.QueryString["id"]; if (!string.IsNullOrEmpty(id)) //修改时加载 { Sys_SoftwareBLL bll = new Sys_SoftwareBLL(); //Sys_NoticeFileBLL bllAttach = new Sys_NoticeFileBLL(); Sys_Software model = bll.Find(p => p.SoftwareID == id); if (model == null) { MessageBox.ShowAndRedirect(this, "该数据不存在!", "SoftwareIndex.aspx"); } else { Software_Title.Text = model.Software_Name; Software_Context.Text = model.Software_Introduction; Software_No.Text = model.Software_No.ToString(); Session.Remove("ww"); this.File.FileOperationType = "Modify"; this.File.FileSizeLimit = "3000"; this.File.FilesNname = "File"; this.File.FileSessionID = "ww"; this.File.FileMulti = "false"; this.File.FileType = "系统必备工具"; this.File.FileTypeDesc = "支持格式:.exe;.msi;.rar;.7z;.zip;"; this.File.FileTypeExts = "*.exe;*.msi;*.rar;*.7z;*.zip;"; this.File.FileOperationID = model.SoftwareID; } } else { Session.Remove("ww"); this.File.FileOperationType = "Add"; this.File.FilesNname = "File"; this.File.FileSessionID = "ww"; this.File.FileMulti = "false"; this.File.FileSizeLimit = "3000"; this.File.FileType = "系统必备工具"; this.File.FileTypeDesc = "支持格式:.exe;.msi;.rar;.7z;.zip;"; this.File.FileTypeExts = "*.exe;*.msi;*.rar;*.7z;*.zip;"; this.File.FileOperationID = Guid.NewGuid().ToString(); //btn_downFile.Visible = false;//新增时不能下载附件 } }
private string DeleteSoftware(string id) { Sys_Software software = sfbll.Find(s => s.SoftwareID == id); // 并不真实删除表中数据,仅仅更新字段,并保留删除信息 software.Software_IsExists = 1; software.Software_DeleteTime = DateTime.Now; software.Software_DeleteUserID = CurrUserInfo().UserID; string msg = string.Empty; bool bol = sfbll.Update(software, out msg); // 得到ModelFile表中对象。 var file = bll.Find(m => m.File_OperationID == id); FileDeleHandler fdh = new FileDeleHandler(); // 删除Download中的文件 string Result = fdh.PublicDele(file.FileID, "ww", file.File_Type); bll.Delete(file); return(Result); }
/// <summary> /// 预存 /// </summary> public void Save() { string id = Request.QueryString["id"]; string msg = string.Empty; if (!string.IsNullOrEmpty(id)) { Sys_SoftwareBLL bll = new Sys_SoftwareBLL(); Sys_Software model = bll.Find(p => p.SoftwareID == id); model.Software_Name = Software_Title.Text; model.Software_Introduction = Software_Context.Text; var no = Software_No.Text; double result = 0; if (double.TryParse(no, out result)) { model.Software_No = double.Parse(no); } else { model.Software_No = 1; } bool bol = bll.Update(model, out msg); if (bol) { new Sys_ModelFileBLL().AddList(Session["ww"] as List <Sys_ModelFile>, out msg); MessageBox.ShowAndRedirect(this, "保存成功!", "SoftwareIndex.aspx"); } else { MessageBox.Show(this, msg); Session.Remove("ww"); } } else { Sys_SoftwareBLL bll = new Sys_SoftwareBLL(); Sys_Software model = new Sys_Software(); model.SoftwareID = this.File.FileOperationID; model.Software_Name = Software_Title.Text; model.Software_Introduction = Software_Context.Text; var no = Software_No.Text; double result = 0; if (double.TryParse(no, out result)) { model.Software_No = double.Parse(no); } else { model.Software_No = 1; } model.Software_UploadUserID = CurrUserInfo().UserID; model.Software_UploadTime = DateTime.Now; model.Software_IsExists = 0; if (bll.Add(model, out msg)) { new Sys_ModelFileBLL().AddList(Session["ww"] as List <Sys_ModelFile>, out msg); MessageBox.ShowAndRedirect(this, "保存成功!", "SoftwareIndex.aspx"); } else { MessageBox.Show(this, msg); Session.Remove("ww"); } } }