//找到一专多能节点 private TreeViewNode FindPleuripotentNode() { KnowledgeBLL knowledgeBLL = new KnowledgeBLL(); foreach (TreeViewNode node in this.tvKnowledge.Nodes) { int id = Int32.Parse(node.ID); RailExam.Model.Knowledge knowledge = knowledgeBLL.GetKnowledge(id); if (knowledge.IsTemplate) { return(node); } } return(null); }
private string GetKnowledgeName(string strName, int nID) { string str = strName; if (nID != 0) { KnowledgeBLL objBll = new KnowledgeBLL(); RailExam.Model.Knowledge obj = objBll.GetKnowledge(nID); if (obj.ParentId != 0) { str = GetKnowledgeName("/" + obj.KnowledgeName, obj.ParentId) + strName; } else { str = obj.KnowledgeName + strName; } } return(str); }
protected void Page_Load(object sender, EventArgs e) { if (fvKnowledge.CurrentMode == FormViewMode.Insert) { if (hfInsert.Value == "-1") { ((HiddenField)fvKnowledge.FindControl("hfParentId")).Value = Request.QueryString["id"]; } else { ((HiddenField)fvKnowledge.FindControl("hfParentId")).Value = hfInsert.Value; } } string strDeleteID = Request.Form.Get("DeleteID"); if (strDeleteID != "" && strDeleteID != null) { KnowledgeBLL objBll = new KnowledgeBLL(); string strParentID = objBll.GetKnowledge(Convert.ToInt32(strDeleteID)).ParentId.ToString(); int code = 0; objBll.DeleteKnowledge(Convert.ToInt32(strDeleteID), ref code); if (code != 0)//code=2292 { SessionSet.PageMessage = "该知识体系已被引用,不能删除!"; } else { ClientScript.RegisterStartupScript(GetType(), "jsSelectFirstNode", @"window.parent.tvKnowledgeChangeCallBack.callback('Delete','" + strParentID + @"', 'Rebuild'); if(window.parent.tvKnowledge.get_nodes().get_length() > 0) { window.parent.tvKnowledge.get_nodes().getNode(0).select(); }", true); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (PrjPub.CurrentLoginUser == null) { Response.Redirect("/RailExamBao/Common/Error.aspx?error=Session过期请重新登录本系统!"); return; } hfIsWuhan.Value = PrjPub.IsWuhan().ToString(); string strBookID = Request.QueryString.Get("id"); ViewState["BookID"] = strBookID; hfMode.Value = Request.QueryString.Get("mode"); if (strBookID != null && strBookID != "") { if (PrjPub.CurrentLoginUser.RoleID == 1) { ImgSelectEmployee.Visible = true; } else { ImgSelectEmployee.Visible = false; } if (hfMode.Value == "ReadOnly") { SaveButton.Visible = false; CancelButton.Visible = true; SaveNextButton.Visible = false; SaveExitButton.Visible = false; //ClientScript.RegisterStartupScript(GetType(), "jsHide", "<script>document.all.ImgSelectKnowledge.style.display='none';</script>"); //Response.Write("<script>document.all.ImgSelectKnowledge.style.display='none';</script>"); } else if (hfMode.Value == "Edit") { btnCover.Visible = false; btnChapter.Visible = true; SaveButton.Visible = true; CancelButton.Visible = false; SaveExitButton.Visible = false; SaveNextButton.Visible = false; } FillPage(int.Parse(strBookID)); } else { if (PrjPub.CurrentLoginUser.RoleID != 1) { ImgSelectEmployee.Visible = false; } SaveButton.Visible = false; SaveNextButton.Visible = true; SaveExitButton.Visible = true; CancelButton.Visible = false; datePublishDate.DateValue = DateTime.Today.ToString("yyyy-MM-dd"); string strKnowledgeID = Request.QueryString.Get("knowledgeId"); if (strKnowledgeID != null && strKnowledgeID != string.Empty) { hfKnowledgeID.Value = strKnowledgeID; KnowledgeBLL objBll = new KnowledgeBLL(); RailExam.Model.Knowledge obj = objBll.GetKnowledge(Convert.ToInt32(strKnowledgeID)); txtKnowledgeName.Text = txtKnowledgeName.Text + GetKnowledgeName("/" + obj.KnowledgeName, obj.ParentId); ImgSelectKnowledge.Visible = false; } ArrayList objOrgList = new ArrayList(); if (PrjPub.CurrentLoginUser.SuitRange == 0) { OrganizationBLL orgBll = new OrganizationBLL(); txtPublishOrgName.Text = orgBll.GetOrganization(PrjPub.CurrentLoginUser.StationOrgID).ShortName; hfPublishOrgID.Value = PrjPub.CurrentLoginUser.StationOrgID.ToString(); IList <Organization> objOrganizationList = orgBll.GetOrganizationsByWhereClause("ID_Path || '/' like '/1/" + PrjPub.CurrentLoginUser.StationOrgID + "/%' "); foreach (Organization organization in objOrganizationList) { objOrgList.Add(organization.OrganizationId); } } txtAuthors.Text = PrjPub.CurrentLoginUser.EmployeeName; hfEmployeeID.Value = PrjPub.CurrentLoginUser.EmployeeID.ToString(); //txtPublishOrgName.Text = PrjPub.CurrentLoginUser.OrgName; //hfPublishOrgID.Value = PrjPub.CurrentLoginUser.OrgID.ToString(); BindOrganizationTree(objOrgList); ArrayList objList = new ArrayList(); if (!string.IsNullOrEmpty(Request.QueryString.Get("PostId"))) { objList.Add(Convert.ToInt32(Request.QueryString.Get("PostId"))); } BindPostTree(objList); ddlTech.SelectedValue = "1"; } } if (!string.IsNullOrEmpty(hfTrainTypeID.Value)) { TrainTypeBLL objBll = new TrainTypeBLL(); string[] str = hfTrainTypeID.Value.Split(','); string strTypeName = ""; for (int i = 0; i < str.Length; i++) { TrainType obj = objBll.GetTrainTypeInfo(Convert.ToInt32(str[i])); if (i == 0) { strTypeName = GetTrainTypeName("/" + obj.TypeName, obj.ParentID); } else { strTypeName = strTypeName + "," + GetTrainTypeName("/" + obj.TypeName, obj.ParentID); } } txtTrainTypeName.Text = strTypeName; } if (!string.IsNullOrEmpty(hfPublishOrgID.Value)) { OrganizationBLL orgbll = new OrganizationBLL(); txtPublishOrgName.Text = orgbll.GetOrganization(Convert.ToInt32(hfPublishOrgID.Value)).ShortName; } string strRefresh = Request.Form.Get("RefreshCover"); if (strRefresh != null && strRefresh != "") { //string strPath = "../Book/" + ViewState["BookID"].ToString() + "/cover.htm"; //BookBLL objBill = new BookBLL(); //objBill.UpdateBookUrl(Convert.ToInt32(ViewState["BookID"].ToString()), strPath); //string strBookName = objBill.GetBook(Convert.ToInt32(ViewState["BookID"].ToString())).bookName; //string srcPath = "../Online/Book/" + ViewState["BookID"].ToString() + "/Cover.htm"; //string str = File.ReadAllText(Server.MapPath(srcPath), System.Text.Encoding.UTF8); //if (str.IndexOf("booktitle") < 0) //{ // str = "<link href='book.css' type='text/css' rel='stylesheet' />" // + "<div id='booktitle'>" + strBookName + "</div>" + "<br>" // + str; // File.WriteAllText(Server.MapPath(srcPath), str, System.Text.Encoding.UTF8); //BookChapterBLL objChapterBll = new BookChapterBLL(); //objChapterBll.GetIndex(ViewState["BookID"].ToString()); //SystemLogBLL objLogBll = new SystemLogBLL(); //objLogBll.WriteLog("编辑教材《" + strBookName + "》前言"); //FillPage(Convert.ToInt32(ViewState["BookID"].ToString())); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (PrjPub.CurrentLoginUser == null) { Response.Redirect("/RailExamBao/Common/Error.aspx?error=Session过期请重新登录本系统!"); return; } string strCoursewareID = Request.QueryString.Get("id"); hfMode.Value = Request.QueryString.Get("mode"); if (!string.IsNullOrEmpty(strCoursewareID)) //Update { FillPage(int.Parse(strCoursewareID)); } else //Add { datePublishDate.DateValue = DateTime.Now.ToString("yyyy-MM-dd"); if (Request.QueryString.Get("coursewareTypeID") != null) { if (!string.IsNullOrEmpty(Request.QueryString.Get("coursewareTypeID"))) { hfCoursewareTypeID.Value = Request.QueryString.Get("coursewareTypeID"); KnowledgeBLL objBll = new KnowledgeBLL(); RailExam.Model.Knowledge obj = objBll.GetKnowledge(Convert.ToInt32(hfCoursewareTypeID.Value)); txtCoursewareTypeName.Text = txtCoursewareTypeName.Text + GetKnowledgeName("/" + obj.KnowledgeName, obj.ParentId); ImgSelectCoursewareType.Visible = false; } } //string strId1 = Request.QueryString.Get("CoursewareTypeId"); //if (! string.IsNullOrEmpty(strId1)) //{ // CoursewareTypeBLL coursewareTypeBLL = new CoursewareTypeBLL(); // CoursewareType coursewareType = coursewareTypeBLL.GetCoursewareType(int.Parse(strId1)); // if (coursewareType != null) // { // txtCoursewareTypeName.Text = coursewareType.CoursewareTypeName; // } // hfCoursewareTypeID.Value = strId1; //} //string strTypeId1 = Request.QueryString.Get("TrainTypeId"); //if (! string.IsNullOrEmpty(strTypeId1)) //{ // TrainTypeBLL trainTypeBLL = new TrainTypeBLL(); // TrainType trainType = trainTypeBLL.GetTrainTypeInfo(int.Parse(strTypeId1)); // if (trainType != null) // { // txtTrainTypeName.Text = trainType.TypeName; // } // hfTrainTypeID.Value = strTypeId1; //} //txtProvideOrgName.Text = SessionSet.OrganizationName; ViewState["AddFlag"] = 1; ArrayList orgIDAL = new ArrayList(); ArrayList postIDAL = new ArrayList(); if (PrjPub.CurrentLoginUser.SuitRange == 0) { OrganizationBLL orgBll = new OrganizationBLL(); txtProvideOrgName.Text = orgBll.GetOrganization(PrjPub.CurrentLoginUser.StationOrgID).ShortName; hfProvideOrgID.Value = PrjPub.CurrentLoginUser.StationOrgID.ToString(); IList <Organization> objOrganizationList = orgBll.GetOrganizationsByWhereClause("ID_Path || '/' like '/1/" + PrjPub.CurrentLoginUser.StationOrgID + "/%' "); foreach (Organization organization in objOrganizationList) { orgIDAL.Add(organization.OrganizationId); } } BindOrganizationTree(orgIDAL); BindPostTree(postIDAL); } } }