/// <summary> /// Delete a given document from the syste, /// </summary> /// <param name="docID">ID of the document.</param> public static void DeleteDocument(int docID = 0) { if (docID <= 0) { throw new Exception("Doc ID is invalid."); } DocsLinqDataContext db = new DocsLinqDataContext(); document doc = new document(); doc = (from d in db.documents where d.docID.Equals(docID) select d).FirstOrDefault<document>(); List<itemDoc> item_docs = new List<itemDoc>(); item_docs = (from id in db.itemDocs where id.docID.Equals(doc.docID) select id).ToList<itemDoc>(); string dir = @AppDomain.CurrentDomain.BaseDirectory.Replace("\\\\","\\") + doc.documentPath.Replace("~", "").Replace("/","\\").Replace("\\\\","\\"); //string file = System.IO.Directory.GetFiles(dir)[0]; System.IO.File.Delete(dir); db.documents.DeleteOnSubmit(doc); db.itemDocs.DeleteAllOnSubmit<itemDoc>(item_docs); db.SubmitChanges(); }
public el_cdata(document doc) : base(doc) => _skip = true;
/// <summary> /// 删除文档 /// </summary> /// <param name="doc"></param> /// <returns></returns> public bool delDocument(document doc) { return(true); }
/// <summary> /// 查询所有的文档,构建文档树 /// </summary> /// <returns></returns> public List <document> getAllDocument() { List <document> doclist = new List <document>(); document D2 = new document(); D2.cn_name = "文档3"; D2.create_user_name = "李俊1"; D2.create_date = DateTime.Parse("2013-01-01"); D2.modify_count = "0"; D2.modify_date = DateTime.Parse("2013-01-01"); D2.modify_user_name = "李俊1"; D2.doc_page = "A4"; D2.dense_name = "保密"; D2.valid_time = "2013-01-01"; D2.in_valid_time = "2013-01-12"; D2.remark = "备注"; D2.status = "有效"; D2.format_name = "xls"; D2.version = "0002"; D2.abstract_content = "备注"; D2.en_name = "wendang2"; D2.number = "00002"; D2.key = "文档 设计文档 车轮"; D2.doc_template_id = 1; D2.doc_template_name = "需求设计文档"; D2.column1 = "12"; D2.column2 = "23"; D2.column3 = "34"; D2.document_type_id = 3; D2.physical_file_location = "g:\\12.xls"; document D3 = new document(); D3.cn_name = "文档2"; D3.create_user_name = "李俊1"; D3.create_date = DateTime.Parse("2013-01-01"); D3.modify_count = "0"; D3.modify_date = DateTime.Parse("2013-01-01"); D3.modify_user_name = "李俊1"; D3.doc_page = "A4"; D3.dense_name = "保密"; D3.valid_time = "2013-01-01"; D3.in_valid_time = "2013-01-12"; D3.remark = "备注"; D3.status = "有效"; D3.format_name = "xls"; D3.version = "0002"; D3.abstract_content = "备注"; D3.en_name = "wendang2"; D3.number = "00002"; D3.key = "文档 设计文档 车轮"; D3.doc_template_id = 1; D3.doc_template_name = "需求设计文档"; D3.column1 = "12"; D3.column2 = "23"; D3.column3 = "34"; D3.document_type_id = 3; D3.physical_file_location = "g:\\11.xls"; doclist.Add(D2); doclist.Add(D3); return(doclist); }
return(AssertBranchesCovered(document, BuildConfiguration.Debug | BuildConfiguration.Release, lines));
public virtual element create_element(string tag_name, Dictionary <string, string> attributes, document doc) => null;
await this.AddDocumentFixesAsync(document, diagnostics, fixes, fixAllState, cancellationToken).ConfigureAwait(false);
public ActionResult newdocument(string first_name, int document_category, HttpPostedFileBase upload_document, string link, string uploaded_by, string uploaded_date, int share, int notify_email) { try { if (document_category != 0) { document document = new document(); document.first_name = first_name; document.type_id = document_category; document.link = link; document.uploaded_by = uploaded_by; document.community_id = Convert.ToInt64(Session["CURRENT_COMU"]); document.uploaded_date = DateTime.ParseExact(uploaded_date, "yyyy-MM-dd", System.Globalization.CultureInfo.CurrentCulture); if (upload_document != null && upload_document.ContentLength > 0) { var fileName = Path.GetFileName(upload_document.FileName); if (!Directory.Exists(Path.Combine(Server.MapPath("~/"), "Upload"))) { Directory.CreateDirectory(Path.Combine(Server.MapPath("~/"), "Upload")); } if (!Directory.Exists(Path.Combine(Server.MapPath("~/Upload/"), "Upload_Document"))) { Directory.CreateDirectory(Path.Combine(Server.MapPath("~/Upload/"), "Upload_Document")); } var path = Path.Combine(Server.MapPath("~/Upload/Upload_Document"), fileName); upload_document.SaveAs(path); document.upload_document = fileName; } document.share = share; if (notify_email == 1) { document.notify_email = true; } else { document.notify_email = false; } document.created_at = DateTime.Now; entities.documents.Add(document); entities.SaveChanges(); return(Redirect(Url.Action("listado", "documentos", new { area = "webmaster", id = document_category }))); } else { return(Redirect(Url.Action("agregar", "documentos", new { area = "webmaster" }))); } } catch (Exception ex) { return(Redirect(Url.Action("agregar", "documentos", new { area = "webmaster", exception = ex.Message }))); } }
public void AddDocument(document doc) { documents.Add(doc); }
#pragma warning disable RS0030 // Do not used banned APIs builder.AddRange(FilterItems(document, itemsWithPatternMatch.SelectAsArray(item => item.Item1), filterText));
=> FilterItemsImpl(document, itemsWithPatternMatch, filterText, builder);
=> (CleanupDocumentAsyncImpl ?? throw new NotImplementedException()).Invoke(document, spans, options, cancellationToken);
return(SetData(document, data.ToDictionary()));
public el_omnibox(document doc, Control parent, Icontainer container) : base(doc) { Parent = parent; Parent.Controls.Add(_edit); _edit.KeyPress += _edit_KeyPress; }
public el_base(document doc) : base(doc) { }
/// <summary> /// 右键文档夹菜单事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void contextMenuFiles_ItemClicked(object sender, ToolStripItemClickedEventArgs e) { this.contextMenuFiles.Visible = false; if (e.ClickedItem.Name == "cutFileItem") { // 剪切 cutNode = node; this.cutFileItem.Enabled = false; this.cutItem.Enabled = false; this.copyDocClassItem.Enabled = false; this.pasteItem.Enabled = true; } else if (e.ClickedItem.Name == "pasteItem") { // 粘贴 if (cutNode.Tag.GetType() == typeof(document)) { // 更新后台的数据 document doc = ((document)cutNode.Tag); doc.document_type_id = ((document_tree)node.Tag).id; doc.document_type_name = ((document_tree)node.Tag).name; // 调用接口来更新后台数据 //粘贴的当前节点添加 DevExpress.XtraTreeList.Nodes.TreeListNode tns = node.TreeList.AppendNode(doc.id, node); tns.SetValue(DocName, doc.cn_name); tns.SetValue(DocID, doc.id); tns.SetValue(DocType, "File"); tns.Tag = doc; //剪切的当前节点减少 this.treeList1.DeleteNode(cutNode); } else { document_tree docTree = (document_tree)cutNode.Tag; docTree.parent_id = ((document_tree)node.Tag).id; docTree.parent_name = ((document_tree)node.Tag).name; // 调用接口来更新后台数据 //粘贴的当前节点添加 DevExpress.XtraTreeList.Nodes.TreeListNode tns = node.TreeList.AppendNode(docTree.id, node); tns.SetValue(DocName, docTree.name); tns.SetValue(DocID, docTree.id); tns.SetValue(DocType, "Files"); tns.ImageIndex = 0; tns.Tag = docTree; GetCentralChild(tns, docTree.id, docTree.all_name); //剪切的当前节点减少 this.treeList1.DeleteNode(cutNode); } this.cutFileItem.Enabled = true; this.cutItem.Enabled = true; this.copyDocClassItem.Enabled = true; this.pasteItem.Enabled = false; } else if (e.ClickedItem.Name == "copyDocClassItem") { // 复制文档分类 this.cutFileItem.Enabled = false; this.cutItem.Enabled = false; this.copyDocClassItem.Enabled = false; this.pasteItem.Enabled = true; } else if (e.ClickedItem.Name == "expandAllItem") { // 展开 node.ExpandAll(); } else if (e.ClickedItem.Name == "collapseAllItem") { // 折叠 treeList1.CollapseAll(); } else if (e.ClickedItem.Name == "loadingItem") { // 加载文档 // 加载文档是指将该分类的分类和文档呈树形显示供查看其中内容; } else if (e.ClickedItem.Name == "addDocItem") { // 录入已有文档 // 录入已有文档是指将本地已完成的文档录入到PDM系统中; document document = new document(); document.document_type_id = ((document_tree)node.Tag).id; document.document_type_name = ((document_tree)node.Tag).all_name; DocModify docModify = new DocModify(document, 1); if (DialogResult.OK == docModify.ShowDialog()) { DevExpress.XtraTreeList.Nodes.TreeListNode tns = node.TreeList.AppendNode(docModify.docSave.id, node); tns.SetValue(DocName, docModify.docSave.cn_name); tns.SetValue(DocID, docModify.docSave.id); tns.SetValue(DocType, "Files"); tns.Tag = docModify.docSave; // 修改文档成功! MessageBox.Show("创建成功!"); } } else if (e.ClickedItem.Name == "importItem") { // 批量导入文档 // 文档批量导入是指将本地已完成的多个文档一次录入到PDM系统中; DocBulkImport import = new DocBulkImport((document_tree)node.Tag); if (DialogResult.OK == import.ShowDialog()) { // 批量导入成功! } } else if (e.ClickedItem.Name == "downDocItem") { // 下载 // 打开文件夹 FolderBrowserDialog dlg = new FolderBrowserDialog(); if (dlg.ShowDialog() == DialogResult.OK) { // 开启socket文件 SocketServer s = new SocketServer("127.0.0.1", 7774, dlg.SelectedPath + "\\"); s.start(); var files = from d in doclist where d.document_type_id != 0 && d.document_type_id == ((document_tree)node.Tag).id select d; if (files.Count() < 1) { return; } List <document> list = new List <document>(); foreach (document st in files) { st.ipaddress = "127.0.0.1"; st.port = 7774; list.Add(st); } bool flag = WcfServiceLocator.Create <IDocManageTool>().downDocumentAll(list); while (!(flag && s.flag)) { System.Threading.Thread.Sleep(1000); } s.lisner.Stop(); s.TempThread.Abort(); } } else if (e.ClickedItem.Name == "updateDocTreeStatusItem") { // 更新文档状态 // 更新文档状态是指将该分类下文档状态已改变而显示界面上无变化时,点击改变界面显示; } else if (e.ClickedItem.Name == "grantDocItem") { // 发放文档 // } else if (e.ClickedItem.Name == "permissionApplyDocItem") { // 申请权限 } else if (e.ClickedItem.Name == "scanDocGrantRItem") { // 查看文档发放规则 } else if (e.ClickedItem.Name == "addDocTreeItem") { // 增加文档分类 document_tree doct = new document_tree(); doct.parent_id = ((document_tree)node.Tag).id; doct.parent_name = ((document_tree)node.Tag).name; BuildDocCategory docCat = new BuildDocCategory(doct, 1); if (docCat.ShowDialog() == DialogResult.OK) { DevExpress.XtraTreeList.Nodes.TreeListNode tns = node.TreeList.AppendNode(docCat.docTree.id, node); tns.SetValue(DocName, docCat.docTree.name); tns.SetValue(DocID, docCat.docTree.id); tns.SetValue(DocType, "Files"); docCat.docTree.all_name = ((document_tree)(node.Tag)).all_name + @"\" + docCat.docTree.name; tns.Tag = docCat.docTree; // 添加成功! } } else if (e.ClickedItem.Name == "updatedocTreeItem") { // 修改文档分类 document_tree docType = new document_tree(); docType.parent_id = ((document_tree)node.Tag).parent_id; docType.parent_name = ((document_tree)node.Tag).parent_name; docType.id = ((document_tree)node.Tag).id; docType.name = ((document_tree)node.Tag).name; BuildDocCategory docCat = new BuildDocCategory(docType, 2); if (docCat.ShowDialog() == DialogResult.OK) { // 修改成功! ((document_tree)node.Tag).name = docCat.docTree.name; node.SetValue(DocName, docCat.docTree.name); } } else if (e.ClickedItem.Name == "delDocTreeItem") { // 删除文档分类 if (MessageBox.Show("确认删除?", "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { bool flag = WcfServiceLocator.Create <IDocManageTool>().delDocumentTree((document_tree)node.Tag); if (flag) { // 删除文件夹 this.treeList1.DeleteNode(node); } } } else if (e.ClickedItem.Name == "scanDocTypeItem") { // 查看文档分类 document_tree docType = new document_tree(); docType.parent_id = ((document_tree)node.Tag).parent_id; docType.parent_name = ((document_tree)node.Tag).parent_name; docType.id = ((document_tree)node.Tag).id; docType.name = ((document_tree)node.Tag).name; BuildDocCategory docCat = new BuildDocCategory(docType, 3); docCat.ShowDialog(); } else if (e.ClickedItem.Name == "execlEmportItem") { // excel导出 } else if (e.ClickedItem.Name == "userImportItem") { // 自定义导出 } else if (e.ClickedItem.Name == "docCountStaItem") { // 文档数量统计,统计该节点下文件的数目 int count = GetChildNodes(node); MessageBox.Show("共有文档" + count + "个"); } }
public el_para(document doc) : base(doc) { }
// Default implementation just drops the pattern matches and builder, and // calls the public overload of FilterItems instead for compatibility. FilterItems(document, itemsWithPatternMatch.SelectAsArray(item => item.Item1), filterText);
public el_comment(document doc) : base(doc) => _skip = true;
public void link(document doc, element el) { }
public el_anchor(document doc) : base(doc) { }
public virtual void link(document doc, element el) { }
return(ReplaceStatementsAsync(document, statementsInfo, List(newStatements), cancellationToken));
public ActionResult Edit(meeting meeting) { string ReturnUrl = Request.UrlReferrer.ToString(); try { //if (contribution.CheckNumber == null) { contribution.CheckNumber = ""; } if (ModelState.IsValid) { //document foreach (var file in meeting.files) { if (file != null && file.ContentLength > 0) { int documentTypeID = ConstantRepository.GetConstantByName("Property Document").constantID; // Get file info document document = new document(); document.Title = string.Format("{0} document", meeting.Title); document.DocumentTypeID = documentTypeID; document.Status = "Active"; document.EnteredBy = User.Identity.Name.ToString(); document.DateEntered = System.DateTime.Today; document.FileName = Path.GetFileName(file.FileName); document.ContentLength = file.ContentLength; document.ContentType = file.ContentType; document.Author = "Meeting Document"; var path = Path.Combine(Server.MapPath("~/App_Data/ClientFiles"), document.FileName); // var path = Path.Combine(Server.MapPath("~/public_html/ClientFiles"), document.FileName); file.SaveAs(path); db.documents.Add(document); db.SaveChanges(); meeting.DocumentID = document.documentID; } } db.Entry(meeting).State = EntityState.Modified; db.SaveChanges(); TempData["Message2"] = string.Format("meeting record update successfully."); GetData(meeting.ministryID); /* if (CallerType == "Ministry") * { * return Redirect(string.Format("/Home/Admin?Page=Meeting&MinistryID={0}&CallerType={1}", meeting.ministryID, "Ministry")); * } * else * { * return Redirect("/Home/Admin?Page=Meeting"); * } * * if (meeting.ReturnMethod == "AdminList") * { * return RedirectToAction("AdminList", new { bDate=meeting.ReturnBeginDate, eDate=meeting.ReturnEndDate, SearchType =meeting.ReturnSearchType, codeID =meeting.ReturnCodeID, code = meeting.ReturnCode, CallerType =meeting.ReturnCallerType}); * } * else * { * return RedirectToAction("List", new { bDate=meeting.ReturnBeginDate, eDate=meeting.ReturnEndDate, SearchType = meeting.ReturnSearchType, codeID = meeting.ReturnCodeID, code =meeting.ReturnCode}); * } */ return(Redirect(ReturnUrl)); } } catch (Exception ex) { TempData["Message2"] = string.Format("Error editing {0} meeting record.", meeting.Title); } GetData(meeting.ministryID); return(PartialView(meeting)); }
public el_space(string text, document doc) : base(text, doc) { }
/// <summary> /// 更新文档 /// </summary> /// <param name="doc"></param> /// <returns></returns> public document updateDocument(document doc) { return(doc); }
public el_asset(document doc) : base(doc) => _display = style_display.inline_block;
public el_title(document doc) : base(doc) { }
public el_font(document doc) : base(doc) { }
await _progress.OnFindInDocumentStartedAsync(document).ConfigureAwait(false);
public ActionResult EditItem(string item_id, string itemName) { DocsLinqDataContext doc_db = new DocsLinqDataContext(); int itemID = Convert.ToInt32(item_id); // Get the item docItem item = (from di in doc_db.docItems where di.itemID.Equals(itemID) select di).Single<docItem>(); // Reassign form fields itemName = Request.Form["itemName"].Trim(); string itemDescription = Request.Form["itemDescription"].Trim().Replace("\r\n","<br />").Replace("\n","<br />").Replace("\r","<br />"); string executionExample = Request.Form["executionExample"].Trim().Replace("\r\n", "<br />").Replace("\n", "<br />").Replace("\r", "<br />"); string resultExample = Request.Form["resultExample"].Trim().Replace("\r\n", "<br />").Replace("\n", "<br />").Replace("\r", "<br />"); string codeLink = Request.Form["codeLink"].Trim(); string html = Request.Form["html"].Trim(); int author = Convert.ToInt32(Request.Form["author"].Trim()); string[] saved_cats = (Request.Form["cat"] != null)?Request.Form["cat"].Trim().Split(','):new string[' ']; // Validate the submitted info List<string> error_messages = new List<string>(); if (itemName.Length == 0) { error_messages.Add("You must enter a name for this item."); } if (itemDescription.Length == 0) { error_messages.Add("You must enter a brief overview of this item."); } if (saved_cats.Length == 0) { error_messages.Add("You did not specify a category for this item."); } // End Validation if (error_messages.Count == 0) { // Save the item try { item.itemName = itemName; item.itemDescription = itemDescription; item.executionExample = executionExample; item.resultExample = resultExample; item.codeLink = codeLink; item.author = author; item.itemHTML = html; item.dateModified = DateTime.Now; doc_db.SubmitChanges(); // Handle File Upload HttpPostedFileBase hpf = Request.Files[0] as HttpPostedFileBase; if(hpf.ContentLength > 0){ string dir = AppDomain.CurrentDomain.BaseDirectory + "/Content/APIDocs/" + itemName; if (!Directory.Exists(dir)) { Directory.CreateDirectory(dir); } string savedFileName = Path.Combine(dir,Path.GetFileName(hpf.FileName)); hpf.SaveAs(savedFileName); List<document> existing_docs = new List<document>(); existing_docs = (from d in doc_db.documents where d.documentPath.Equals("/Content/APIDocs/" + itemName + "/" + Path.GetFileName(hpf.FileName)) select d).ToList<document>(); foreach (document existing_doc in existing_docs) { itemDoc item_doc = (from item_docs in doc_db.itemDocs where item_docs.docID.Equals(existing_doc.docID) select item_docs).FirstOrDefault<itemDoc>(); doc_db.itemDocs.DeleteOnSubmit(item_doc); } doc_db.documents.DeleteAllOnSubmit<document>(existing_docs); doc_db.SubmitChanges(); document doc = new document { documentPath = "~/Content/APIDocs/"+itemName+"/"+hpf.FileName, documentTitle = Request.Form["documentName"].Trim(), dateAdded = DateTime.Now }; doc_db.documents.InsertOnSubmit(doc); doc_db.SubmitChanges(); itemDoc id = new itemDoc { itemID = item.itemID, docID = doc.docID }; doc_db.itemDocs.InsertOnSubmit(id); doc_db.SubmitChanges(); } return RedirectToAction("Items"); } catch (Exception e) { error_messages.Add(e.Message); } } ViewBag.error_messages = error_messages; ViewBag.item = item; // Get the cateogries that this item is associated with List<docCategory> item_cats = new List<docCategory>(); item_cats = (from ci in doc_db.cat_items join cats in doc_db.docCategories on ci.catID equals cats.catID where ci.itemID.Equals(item.itemID) select cats).ToList<docCategory>(); ViewBag.item_cats = item_cats; // get the comments on this item List<UserComment> comments = Documentation.GetItemComments(item.itemID); ViewBag.comments = comments; // Get all of the categories List<docCategory> categories = Documentation.GetCategories(); ViewBag.categories = categories; // get all of the users ::: this will allow us to designate the author of the new item List<user> users = Users.GetAllUsers(); ViewBag.users = users; return View(); }
return(GetUpdatedDocumentAsync( document, unimplementedMembers, classOrStructType, classOrStructDecl, ImmutableArray <ISymbol> .Empty, cancellationToken));
public el_script(document doc) : base(doc) { }