public Guid DelDocumentTreeNode(string TreeNodeID, string SysID, string NodeNmae) { C_DocumentTree Model = C_DocumentTreeOperator.Instance.GetDocumentTree(TreeNodeID.ToGuid()); Model.IsDeleted = true; return(C_DocumentTreeOperator.Instance.UpdateDocumentTree(Model)); }
public Guid AddDocumentTreeNode(string TreeNodeID, string SysID, string NodeNmae) { C_DocumentTree Model = new C_DocumentTree(); Model.ParentID = TreeNodeID.ToGuid(); Model.SystemID = SysID.ToGuid(); Model.TreeNodeName = NodeNmae; return(C_DocumentTreeOperator.Instance.AddDocumentTree(Model)); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; HttpPostedFile file = context.Request.Files["FileData"]; string action = context.Request["action"]; string BizID = context.Request["BusinessID"]; string ValueA = context.Request["ValueA"]; string sysID = context.Request["SystemID"]; string ValueB = context.Request["ValueB"]; string ValueC = context.Request["ValueC"]; string ValueD = context.Request["ValueD"]; string FileYear = context.Request["FileYear"]; string[] actions = action.Split(new char[] { '|' }); string filePath = "DocAttachments\\" + WebHelper.DateTimeNow.ToString("yyyy_MM") + "\\"; //string uploadpath = context.Server.MapPath(filePath); string uploadpath = Path.Combine(UploadFilePath, filePath); if (file != null) { try { if (!Directory.Exists(uploadpath)) { Directory.CreateDirectory(uploadpath); } B_DocumentAttachments _attachment = new B_DocumentAttachments(); _attachment.CreatorName = PermissionHelper.GetCurrentUser;// WebHelper.GetCurrentUser().DisplayName; //当前上传附件的人,记录下来 Guid ID = B_DocumentAttachmentsOperator.Instance.AddDocumentAttachments(_attachment); if (ValueA != "0" && !string.IsNullOrEmpty(ValueA)) { C_DocumentTree Model = C_DocumentTreeOperator.Instance.GetDocumentTree(Guid.Parse(ValueA)); _attachment.ValueAString = Model.TreeNodeName; _attachment.ValueA = ValueA.ToGuid(); } if (!string.IsNullOrEmpty(ValueB) && ValueB != null) { C_DocumentTree Model = C_DocumentTreeOperator.Instance.GetDocumentTree(Guid.Parse(ValueB)); _attachment.ValueBString = Model.TreeNodeName; _attachment.ValueB = ValueB.ToGuid(); } if (!string.IsNullOrEmpty(ValueC) && ValueC != "0") { C_DocumentTree Model = C_DocumentTreeOperator.Instance.GetDocumentTree(Guid.Parse(ValueC)); _attachment.ValueCString = Model.TreeNodeName; _attachment.ValueC = ValueC.ToGuid(); } if (!string.IsNullOrEmpty(ValueD) && ValueD != "0") { C_DocumentTree Model = C_DocumentTreeOperator.Instance.GetDocumentTree(Guid.Parse(ValueD)); _attachment.ValueDString = Model.TreeNodeName; _attachment.ValueD = ValueD.ToGuid(); } if (!string.IsNullOrEmpty(FileYear) && FileYear != "0") { _attachment.FinYear = int.Parse(FileYear); } if (!string.IsNullOrEmpty(sysID) && sysID != "0") { _attachment.SystemID = sysID.ToGuid(); } string filename = ID + Path.GetExtension(file.FileName); _attachment.ID = ID; _attachment.BusinessType = action; if (actions.Count() > 1) { _attachment.BusinessType = actions[0]; if (string.IsNullOrEmpty(actions[1])) { _attachment.BusinessID = Guid.Empty; } else { _attachment.BusinessID = Guid.Parse(actions[1]); } } if (_attachment.BusinessID == Guid.Empty && !string.IsNullOrEmpty(BizID)) { _attachment.BusinessID = Guid.Parse(BizID); } _attachment.FileName = file.FileName; _attachment.Url = filePath + filename; if (file.ContentLength > 1024 * 1024) { _attachment.Size = (file.ContentLength / (1024 * 1024)).ToString("D2") + " M"; } else { _attachment.Size = (file.ContentLength / (1024)).ToString("D2") + " KB"; } //_attachment.SystemID = file.SaveAs(uploadpath + filename); context.Response.Write(filePath + filename); B_DocumentAttachmentsOperator.Instance.UpdateDocumentAttachments(_attachment); string response = "{" + string.Format("ID:\"{0}\",CreatorName:\"{1}\",CreateTime:\"{2}\",Url:\"{3}\",Size:\"{4}\",FileName:\"{5}\"" , new string[] { _attachment.ID.ToString(), _attachment.CreatorName, _attachment.CreateTime.ToShortDateString(), HttpUtility.UrlEncode(_attachment.Url), _attachment.Size, _attachment.FileName }) + "}"; response = Encoding.GetEncoding("GB2312").GetString(Encoding.Default.GetBytes(response)); context.Response.Write(response); } catch (Exception exp) { context.Response.Write("Faild:" + exp.Message); } } else { context.Response.Write("Faild:Empty file."); } }