public ActionResult DocumentTypeCreateEdit(document_type document_type) { result = documentTypeUtil.CreateEditDocumentType(document_type); ViewBag.Title = document_type == null ? "DocumentType Create" : "DocumentType Edit"; ViewBag.action_name = STUtil.GetListAllActionByController(""); return(Json(result)); }
public ActionResult editarCategoria(string Error, int?typeID) { if (Session["USER_ID"] != null) { if (Session["CURRENT_COMU"] != null) { if (typeID != null) { document_type documentCategory = entities.document_type.Find(typeID); if (documentCategory != null) { try { long userId = (long)Session["USER_ID"]; long communityAct = Convert.ToInt64(Session["CURRENT_COMU"]); user curUser = entities.users.Find(userId); List <ShowMessage> pubMessageList = ep.GetChatMessages(userId); editarcategoriaViewModel viewModel = new editarcategoriaViewModel(); communityList = ep.GetCommunityList(userId); viewModel.communityList = communityList; viewModel.side_menu = "documentos"; viewModel.side_sub_menu = "documentos_categoria"; viewModel.editDocumentType = documentCategory; viewModel.document_category_list = entities.document_type.Where(x => x.community_id == communityAct).ToList(); viewModel.curUser = curUser; viewModel.pubTaskList = ep.GetNotifiTaskList(userId); viewModel.pubMessageList = pubMessageList; viewModel.messageCount = ep.GetUnreadMessageCount(pubMessageList); ViewBag.msgError = Error; return(View(viewModel)); } catch (Exception ex) { return(Redirect(Url.Action("listadoCategoria", "documentos", new { area = "coadmin", Error = "Editar categoría: " + ex.Message }))); } } else { return(Redirect(Url.Action("listadoCategoria", "documentos", new { area = "coadmin", Error = "No existe ese elemento" }))); } } else { return(Redirect(Url.Action("listadoCategoria", "documentos", new { area = "coadmin" }))); } } else { return(Redirect(Url.Action("listadoCategoria", "documentos", new { area = "coadmin", Error = "No puede editar categorias. Usted no administra ninguna comunidad. Comuníquese con el Webmaster..." }))); } } else { return(Redirect(ep.GetLogoutUrl())); } }
/// <summary> /// 根据文档属性来查询文档属性 /// </summary> /// <param name="docType"></param> /// <returns></returns> public document_type getDocumentColumnByType(document_type docType) { //根据文档类型,查找文档的属性 document_type type = new document_type(); doc_attached_property p1 = new doc_attached_property(); p1.cn_name = ""; p1.en_name = ""; return(type); }
public ActionResult DocumentTypeIndex(string id) { STUtil.SetSessionValue(UserInfo.pageTitle.ToString(), "Document Type"); document_type c = new document_type(); if (id != null && id != "") { c = db.document_type.Find(Convert.ToInt32(id)); } return(View(c)); }
// GET: webmaster/documentos public ActionResult listado(int?id, string searchStr = "") { if (Session["USER_ID"] != null) { if (id != null) { long userId = (long)Session["USER_ID"]; user curUser = entities.users.Find(userId); List <ShowMessage> pubMessageList = ep.GetChatMessages(userId); List <document> document_list = new List <document>(); long communityAct = Convert.ToInt64(Session["CURRENT_COMU"]); if (searchStr == "") { var query = (from r in entities.documents where r.type_id == id && r.community_id == communityAct select r); document_list = query.ToList(); } else { var query1 = (from r in entities.documents where r.type_id == id && r.first_name.Contains(searchStr) == true && r.community_id == communityAct select r); document_list = query1.ToList(); } List <document_type> document_category_list = entities.document_type.ToList(); listadoDocumentViewModel viewModel = new listadoDocumentViewModel(); document_type document_type = entities.document_type.Find(id); viewModel.side_menu = "documentos"; viewModel.side_sub_menu = "documentos_" + document_type.type_name; viewModel.document_category_list = document_category_list; viewModel.document_list = document_list; viewModel.searchStr = searchStr; viewModel.typeID = Convert.ToInt32(id); viewModel.curUser = curUser; viewModel.pubTaskList = ep.GetNotifiTaskList(userId); viewModel.pubMessageList = pubMessageList; viewModel.messageCount = ep.GetUnreadMessageCount(pubMessageList); return(View(viewModel)); } else { return(Redirect(Url.Action("NotFound", "Error"))); } } else { return(Redirect(ep.GetLogoutUrl())); } }
public ActionResult editdocumenttype(int typeID, string type_name, int documentTypeShare) { try { document_type editDocumentType = entities.document_type.Find(typeID); editDocumentType.type_name = type_name; editDocumentType.share = documentTypeShare; entities.SaveChanges(); return(Redirect(Url.Action("listadoCategoria", "documentos", new { area = "coadmin" }))); } catch (Exception ex) { return(Redirect(Url.Action("editarCategoria", "documentos", new { area = "coadmin", typeID = typeID, Error = "Error al editar la categoría: " + ex.Message }))); } }
/// <summary> /// add by lijun 2014.2.20 /// 页面加载 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DocPropertyBuild_Load(object sender, EventArgs e) { // 自动加载列 try { document doc = new document(); document_type doctype = WcfServiceLocator.Create <IDocPropertyBuild>().getDocumentProperty(doc); list = doctype.DocProperty; this.gridDocProperty.DataSource = list; } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public JsonResult DeleteDocumentType(int delID) { try { List <document> documentList = entities.documents.Where(m => m.type_id == delID).ToList(); entities.documents.RemoveRange(documentList); document_type document_Type = entities.document_type.Find(delID); entities.document_type.Remove(document_Type); entities.SaveChanges(); return(Json(new { result = "success" })); } catch (Exception ex) { return(Json(new { result = "error", exception = ex.HResult })); } }
public ActionResult createdocumenttype(string type_name, int documentTypeShare) { try { long communityAct = Convert.ToInt64(Session["CURRENT_COMU"]); document_type newDocumentType = new document_type(); newDocumentType.type_name = type_name; newDocumentType.share = documentTypeShare; newDocumentType.community_id = communityAct; entities.document_type.Add(newDocumentType); entities.SaveChanges(); return(Redirect(Url.Action("listadoCategoria", "documentos", new { area = "coadmin" }))); } catch (Exception ex) { return(Redirect(Url.Action("agregarCategoria", "documentos", new { area = "coadmin", Error = "Error al agregar la categoría: " + ex.Message }))); } }
public ActionResult editarcategoria(int?typeID) { if (Session["USER_ID"] != null) { if (typeID != null) { long userId = (long)Session["USER_ID"]; user curUser = entities.users.Find(userId); List <ShowMessage> pubMessageList = ep.GetChatMessages(userId); document_type documentCategory = entities.document_type.Find(typeID); List <document_type> document_category_list = entities.document_type.ToList(); List <DocumentTypeItemViewModel> documentTypeItemList = new List <DocumentTypeItemViewModel>(); foreach (var item in document_category_list) { int ID = item.id; DocumentTypeItemViewModel itemViewModel = new DocumentTypeItemViewModel(); itemViewModel.ID = ID; itemViewModel.DocumentTypeName = item.type_name; itemViewModel.Documents = entities.documents.Where(m => m.type_id == ID).ToList().Count;; itemViewModel.Share = true; documentTypeItemList.Add(itemViewModel); } editarcategoriaViewModel viewModel = new editarcategoriaViewModel(); viewModel.side_menu = ""; viewModel.side_sub_menu = ""; viewModel.document_category_list = document_category_list; viewModel.editDocumentType = documentCategory; viewModel.curUser = curUser; viewModel.pubTaskList = ep.GetNotifiTaskList(userId); viewModel.pubMessageList = pubMessageList; viewModel.messageCount = ep.GetUnreadMessageCount(pubMessageList); viewModel.documentTypeItemList = documentTypeItemList; return(View(viewModel)); } else { return(Redirect(Url.Action("NotFound", "Error"))); } } else { return(Redirect(ep.GetLogoutUrl())); } }
public ActionResult createdocumenttype(string type_name) { try { document_type newDocumentType = new document_type(); newDocumentType.type_name = type_name; entities.document_type.Add(newDocumentType); entities.SaveChanges(); return(Redirect(Url.Action("categoria", "documentos", new { area = "webmaster" }))); } catch (Exception ex) { return(Redirect(Url.Action("categoria", "documentos", new { area = "webmaster", exception = ex.Message }))); } }
/// <summary> /// 保存按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSave_Click(object sender, EventArgs e) { try { document_type docType = new document_type(); docType.DocProperty = list; // 把集合保存到数据库中 bool flag = WcfServiceLocator.Create <IDocPropertyBuild>().insertDocProperty(docType); if (flag) { MessageBox.Show("保存成功!"); } else { MessageBox.Show("保存失败"); } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public ActionResult editdocumenttype(int typeID, string type_name) { try { document_type editDocumentType = entities.document_type.Find(typeID); editDocumentType.type_name = type_name; entities.SaveChanges(); return(Redirect(Url.Action("editarcategoria", "documentos", new { area = "webmaster", typeID = typeID }))); } catch (Exception ex) { return(Redirect(Url.Action("editarcategoria", "documentos", new { area = "webmaster", typeID = typeID, exception = ex.Message }))); } }
/// <summary> /// 自定义扩展列 /// </summary> private void extendPropertyGen() { // 自动加载扩展的列 try { document doc = new document(); doc.document_type_id = docType.id; doc.document_type_name = docType.name; document_type doctype = WcfServiceLocator.Create <IDocPropertyBuild>().getDocumentProperty(doc); docPropertyList = doctype.DocProperty; int Location_y = 10; int actlocation = 0; for (int i = 0; i < docPropertyList.Count; i++) { doc_attached_property docp = docPropertyList[i]; if (!docp.is_display) { continue; } if (actlocation % 2 == 0) { // 为第一列 LabelControl lbk1 = new LabelControl(); lbk1.Name = "lbk1" + i; lbk1.Text = docp.cn_name + ":"; lbk1.Size = new System.Drawing.Size(60, 15); lbk1.Location = new System.Drawing.Point(25, Location_y); this.xtraTabPage2.Controls.Add(lbk1); if (docp.input_type == "SEL") { ComboBoxEdit cbx1 = new ComboBoxEdit(); // 添加下拉框的值 foreach (doc_combobox_value boxvalue in docp.ComboxValue) { cbx1.Properties.Items.Add(boxvalue.value); } cbx1.Name = docp.en_name; cbx1.Size = new System.Drawing.Size(280, 20); cbx1.Location = new System.Drawing.Point(108, Location_y - 4); this.xtraTabPage2.Controls.Add(cbx1); } else { TextEdit txtk1 = new TextEdit(); txtk1.Name = docp.en_name; txtk1.Size = new System.Drawing.Size(280, 20); txtk1.Location = new System.Drawing.Point(108, Location_y - 4); this.xtraTabPage2.Controls.Add(txtk1); } } else { // 为第二列 LabelControl lbk2 = new LabelControl(); lbk2.Name = "lbk2" + i; lbk2.Text = docp.cn_name + ":"; lbk2.Size = new System.Drawing.Size(60, 15); lbk2.Location = new System.Drawing.Point(412, Location_y); this.xtraTabPage2.Controls.Add(lbk2); if (docp.input_type == "SEL") { ComboBoxEdit cbx1 = new ComboBoxEdit(); // 添加下拉框的值 foreach (doc_combobox_value boxvalue in docp.ComboxValue) { cbx1.Properties.Items.Add(boxvalue.value); } cbx1.Name = docp.en_name; cbx1.Size = new System.Drawing.Size(280, 20); cbx1.Location = new System.Drawing.Point(108, Location_y - 4); this.xtraTabPage2.Controls.Add(cbx1); } else { TextEdit txtk2 = new TextEdit(); txtk2.Name = docp.en_name; txtk2.Size = new System.Drawing.Size(264, 20); txtk2.Location = new System.Drawing.Point(500, Location_y - 4); this.xtraTabPage2.Controls.Add(txtk2); } Location_y = Location_y + 30; } actlocation++; } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
/// <summary> /// 根据文档类型,查询文档的扩展属性 /// </summary> /// <returns></returns> public document_type getDocumentProperty(document doc) { document_type doctype = new document_type(); List <doc_attached_property> docProList = new List <doc_attached_property>(); doc_attached_property dp1 = new doc_attached_property(); dp1.en_name = "Docdep"; dp1.cn_name = "文档部门"; dp1.is_user_define = ""; dp1.is_display = true; dp1.display_width = "100"; dp1.input_type = ""; dp1.data_type = "字符型"; dp1.default_value = "测试001"; dp1.data_length = "100"; dp1.order = "1"; docProList.Add(dp1); doc_attached_property dp2 = new doc_attached_property(); dp2.en_name = "wordsize"; dp2.cn_name = "文档大小"; dp2.is_user_define = ""; dp2.is_display = false; dp2.display_width = "100"; dp2.data_type = "数值型"; dp2.default_value = "测试002"; dp2.data_length = "80"; dp2.order = "2"; docProList.Add(dp2); doc_attached_property dp3 = new doc_attached_property(); dp3.en_name = "wordsize"; dp3.cn_name = "文档大小"; dp3.is_user_define = ""; dp3.is_display = true; dp3.display_width = "100"; dp3.data_type = "数值型"; dp3.default_value = "测试002"; dp3.data_length = "80"; dp3.order = "2"; docProList.Add(dp3); doc_attached_property dp4 = new doc_attached_property(); dp4.en_name = "column4"; dp4.cn_name = "文档扩展属性1"; dp4.is_user_define = "是"; dp4.is_display = true; dp4.display_width = "100"; dp4.order = "4"; dp4.input_type = "SEL"; List <doc_combobox_value> selectvlaue = new List <doc_combobox_value>(); doc_combobox_value v1 = new doc_combobox_value(); v1.value = "1000"; doc_combobox_value v2 = new doc_combobox_value(); v2.value = "2000"; selectvlaue.Add(v1); selectvlaue.Add(v2); dp4.ComboxValue = selectvlaue; docProList.Add(dp4); doctype.DocProperty = docProList; return(doctype); }
/// <summary> /// 插入文档属性 /// </summary> /// <param name="docType"></param> /// <returns></returns> public bool insertDocProperty(document_type docType) { // 根据docType中属性集合,插入更新到数据库。 return(true); }
public ActionResult listado(string Error, string searchStr = "", int idCategory = 0) { if (Session["USER_ID"] != null) { long userId = (long)Session["USER_ID"]; user curUser = entities.users.Find(userId); List <ShowMessage> pubMessageList = ep.GetChatMessages(userId); List <document> document_list = new List <document>(); long communityAct = Convert.ToInt64(Session["CURRENT_COMU"]); Dictionary <long, string> categoryDict = new Dictionary <long, string>(); if (searchStr == "" && idCategory == 0) { var query = (from r in entities.documents where r.community_id == communityAct select r); document_list = query.ToList(); } else if (searchStr != "" && idCategory == 0) { var query1 = (from r in entities.documents where r.first_name.Contains(searchStr) == true && r.community_id == communityAct select r); document_list = query1.ToList(); } else if (searchStr == "" && idCategory != 0) { var query2 = (from r in entities.documents where r.document_type.id == idCategory && r.community_id == communityAct select r ); document_list = query2.ToList(); } else { var query3 = (from r in entities.documents where r.first_name.Contains(searchStr) == true && r.document_type.id == idCategory && r.community_id == communityAct select r); document_list = query3.ToList(); } List <document_type> document_category_list = entities.document_type.Where(x => x.community_id == communityAct).ToList(); documentosViewModel viewModel = new documentosViewModel(); communityList = ep.GetCommunityList(userId); viewModel.communityList = communityList; document_type document_type = entities.document_type.Find(idCategory); viewModel.side_menu = "documentos"; if (idCategory != 0) { viewModel.side_sub_menu = "documentos_" + document_type.type_name; } else { viewModel.side_sub_menu = "documentos_listado"; } viewModel.document_category_list = document_category_list; viewModel.document_list = document_list; viewModel.searchStr = searchStr; viewModel.typeID = idCategory; viewModel.curUser = curUser; viewModel.pubTaskList = ep.GetNotifiTaskList(userId); viewModel.pubMessageList = pubMessageList; viewModel.messageCount = ep.GetUnreadMessageCount(pubMessageList); ViewBag.msgError = Error; return(View(viewModel)); } else { return(Redirect(ep.GetLogoutUrl())); } }