コード例 #1
0
        protected void tvTrainTypeChangeCallBack_Callback(object sender, CallBackEventArgs e)
        {
            TrainTypeBLL objTrainType = new TrainTypeBLL();
            TrainType    traintype    = objTrainType.GetTrainTypeInfo(int.Parse(e.Parameters[0]));
            int          cout         = traintype.ParentID == 0 ? tvTrainType.Nodes.Count : tvTrainType.FindNodeById(traintype.ParentID.ToString()).Nodes.Count;

            if (e.Parameters[1] == "MoveUp")
            {
                if (traintype.OrderIndex <= cout && traintype.OrderIndex >= 2)
                {
                    traintype.OrderIndex--;
                    objTrainType.UpdateTrainType(traintype);

                    traintype = objTrainType.GetTrainTypeInfo(int.Parse(tvTrainType.FindNodeById(e.Parameters[0]).PreviousSibling.ID));
                    traintype.OrderIndex++;
                    objTrainType.UpdateTrainType(traintype);
                }
            }
            if (e.Parameters[1] == "MoveDown")
            {
                if (traintype.OrderIndex <= cout - 1 && traintype.OrderIndex >= 1)
                {
                    traintype.OrderIndex++;
                    objTrainType.UpdateTrainType(traintype);

                    traintype = objTrainType.GetTrainTypeInfo(int.Parse(tvTrainType.FindNodeById(e.Parameters[0]).NextSibling.ID));
                    traintype.OrderIndex--;
                    objTrainType.UpdateTrainType(traintype);
                }
            }

            if (e.Parameters[1] == "Insert")
            {
                IList <RailExam.Model.TrainType> objList = objTrainType.GetTrainTypeByWhereClause("1=1", "Train_Type_ID desc");
                hfMaxID.Value = objList[0].TrainTypeID.ToString();
                hfMaxID.RenderControl(e.Output);
            }
            else if (e.Parameters[1] == "Delete")
            {
                hfMaxID.Value = e.Parameters[2];
                hfMaxID.RenderControl(e.Output);
            }

            tvTrainType.Nodes.Clear();
            BindTrainTypeTree();

            tvTrainType.RenderControl(e.Output);
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            TrainEmployeeBLL objTrainEmployeeBll = new TrainEmployeeBLL();

            string str = Request.QueryString.Get("id");

            if (str != null && str != "")
            {
                ViewState["TrainTypeID"] = str;
            }
            else
            {
                if (PrjPub.StudentID == null)
                {
                    Response.Write("<script>alert('已超时,请注销后重新登录!');window.close();</script>");
                    return;
                }
                ViewState["TrainTypeID"] = objTrainEmployeeBll.GetTrainEmployeeByEmployeeID(PrjPub.CurrentStudent.EmployeeID).TrainTypeID.ToString();
            }

            if (ViewState["TrainTypeID"].ToString() == "0")
            {
                Response.Write("<script>alert('请选择培训类别!');window.close();</script>");
                return;
            }

            TrainTypeBLL objTrainTypeBll = new TrainTypeBLL();
            TrainType    objTrainType    = objTrainTypeBll.GetTrainTypeInfo(Convert.ToInt32(ViewState["TrainTypeID"].ToString()));

            lblDescription.Text = objTrainType.Description;
            lblMemo.Text        = objTrainType.Memo;

            BindGrid1();
            BindGrid2();
        }
コード例 #3
0
        private void BindGrid2()
        {
            CoursewareBLL coursewareBLL = new CoursewareBLL();
            IList <RailExam.Model.Courseware> coursewareList = new List <RailExam.Model.Courseware>();

            if (!string.IsNullOrEmpty(Request.QueryString.Get("id")))
            {
                TrainTypeBLL trainTypeBLL = new TrainTypeBLL();
                TrainType    trainType    = trainTypeBLL.GetTrainTypeInfo(Convert.ToInt32(ViewState["TrainAimID"].ToString()));
                coursewareList = coursewareBLL.GetCoursewaresByTrainTypeIDPath(trainType.IDPath, 1);
            }
            else
            {
                coursewareList = coursewareBLL.GetCoursewaresByCoursewareTypeOnline(PrjPub.CurrentLoginUser.StationOrgID,
                                                                                    Convert.ToInt32(ViewState["TrainAimID"].ToString()), "%", true,
                                                                                    5);
            }

            if (coursewareList.Count > 0)
            {
                foreach (RailExam.Model.Courseware courseware in coursewareList)
                {
                    if (courseware.CoursewareName.Length <= 15)
                    {
                        courseware.CoursewareName = "<a onclick=EditCourseware(" + courseware.CoursewareID + ") href=# title=" + courseware.CoursewareName + " > " + courseware.CoursewareName + " </a>";
                    }
                    else
                    {
                        courseware.CoursewareName = "<a onclick=EditCourseware(" + courseware.CoursewareID + ") href=# title=" + courseware.CoursewareName + " > " + courseware.CoursewareName.Substring(0, 15) + "..." + " </a>";
                    }
                }
                gvCourse.DataSource = coursewareList;
                gvCourse.DataBind();
            }
        }
コード例 #4
0
        private void BindTrainTypeTree()
        {
            TrainTypeBLL trainTypeBLL = new TrainTypeBLL();

            IList <TrainType> trainTypeList = trainTypeBLL.GetTrainTypeInfo(0, 0, 0, "", 0, "", "",
                                                                            false, false, "", 0, 200,
                                                                            "LevelNum,OrderIndex ASC");

            if (trainTypeList.Count > 0)
            {
                TreeViewNode tvn     = null;
                string       strflag = Request.QueryString.Get("flag");

                foreach (TrainType trainType in trainTypeList)
                {
                    tvn         = new TreeViewNode();
                    tvn.ID      = trainType.TrainTypeID.ToString();
                    tvn.Value   = trainType.IDPath;
                    tvn.Text    = trainType.TypeName;
                    tvn.ToolTip = trainType.TypeName;
                    tvn.Attributes.Add("isTrainType", "true");
                    tvn.ImageUrl = "~/App_Themes/" + StyleSheetTheme + "/Images/TreeView/Knowledge.gif";

                    if (strflag != null && strflag == "1")
                    {
                        tvn.ContentCallbackUrl = "~/Common/GetTrainTypeBook.aspx?itemTypeID=" + ViewState["ItemType"].ToString() + "&flag=1&id=" + trainType.IDPath;
                    }
                    else
                    {
                        tvn.ContentCallbackUrl = "~/Common/GetTrainTypeBook.aspx?itemTypeID=" + ViewState["ItemType"].ToString() + "&id=" + trainType.IDPath;
                    }

                    if (trainType.ParentID == 0)
                    {
                        tvBookChapter.Nodes.Add(tvn);
                    }
                    else
                    {
                        try
                        {
                            tvBookChapter.FindNodeById(trainType.ParentID.ToString()).Nodes.Add(tvn);
                        }
                        catch
                        {
                            tvBookChapter.Nodes.Clear();
                            SessionSet.PageMessage = "数据错误!";
                            return;
                        }
                    }
                }
            }
            //tvBookChapter.DataBind();
            //tvBookChapter.ExpandAll();
        }
コード例 #5
0
        private void BindTrainTypeTree()
        {
            TrainTypeBLL trainTypeBLL = new TrainTypeBLL();

            IList <TrainType> trainTypeList = trainTypeBLL.GetTrainTypeInfo(0, 0, 0, "", 0, "", "", false, false, "", 0, 4000, "LevelNum, OrderIndex ASC");

            Pub.BuildComponentArtTreeView(tvTrainType, (IList)trainTypeList,
                                          "TrainTypeID", "ParentID", "TypeName", "TypeName", "IDPath", null, null, null);

            //tvTrainType.ExpandAll();
        }
コード例 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (PrjPub.CurrentLoginUser == null)
                {
                    Response.Redirect("/RailExamBao/Common/Error.aspx?error=Session过期请重新登录本系统!");
                    return;
                }
                if (!string.IsNullOrEmpty(Request.QueryString.Get("id")))
                {
                    ViewState["TrainAimID"] = Request.QueryString.Get("id");
                    TrainTypeBLL trainTypeBLL = new TrainTypeBLL();
                    TrainType    trainType    = trainTypeBLL.GetTrainTypeInfo(Convert.ToInt32(ViewState["TrainAimID"].ToString()));

                    lblDescription.Text = trainType.Description;
                    lblMemo.Text        = trainType.Memo;
                }
                else
                {
                    ViewState["TrainAimID"] = Request.QueryString.Get("id1");
                    PostBLL postBll = new PostBLL();
                    Post    post    = postBll.GetPost(Convert.ToInt32(ViewState["TrainAimID"].ToString()));
                    lblDescription.Text = post.Description;
                    lblMemo.Text        = post.Memo;
                }

                BindGrid1();
                BindGrid2();
            }

            string strRefresh = Request.Form.Get("Refresh");

            if (!string.IsNullOrEmpty(strRefresh))
            {
                BindGrid1();
                BindGrid2();
            }

            //string strDeleteID = Request.Form.Get("DeleteID");
            //if (strDeleteID != null & strDeleteID != "")
            //{
            //    DeleteExercise(strDeleteID);
            //    BindGrid1();
            //    BindGrid2();
            //}
        }
コード例 #7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string str = Request.QueryString.Get("id");

                TrainStandardBLL objTrainStandardBLL = new TrainStandardBLL();
                int nTypeID = objTrainStandardBLL.GetTrainStandardInfo(Convert.ToInt32(str)).TypeID;

                TrainTypeBLL objTrainTypeBLL = new TrainTypeBLL();
                int          nLevel          = objTrainTypeBLL.GetTrainTypeInfo(nTypeID).LevelNum;

                if (nLevel == 1)
                {
                    Grid1.Visible             = false;
                    btnAddTrainCourse.Visible = false;
                }
                else
                {
                    Grid1.Visible             = true;
                    btnAddTrainCourse.Visible = true;
                }
            }

            string strRefresh = Request.Form.Get("Refresh");

            if (strRefresh != null & strRefresh != "")
            {
                Grid1.DataBind();
            }

            string strDeleteID = Request.Form.Get("DeleteID");

            if (strDeleteID != null & strDeleteID != "")
            {
                DeleteCourse(strDeleteID);
                Grid1.DataBind();
            }

            btnAddTrainCourse.Attributes.Add("onclick", "AddRecord(" + Request.QueryString.Get("id") + ");");
        }
コード例 #8
0
        private string GetType(string strName, int nID)
        {
            string str = "";

            if (nID != 0)
            {
                TrainTypeBLL objTrainTypeBll = new TrainTypeBLL();
                TrainType    objTrainType    = objTrainTypeBll.GetTrainTypeInfo(nID);

                if (objTrainType.ParentID != 0)
                {
                    str = GetType(" - " + objTrainType.TypeName, objTrainType.ParentID) + strName;
                }
                else
                {
                    str = objTrainType.TypeName + strName;
                }
            }

            return(str);
        }
コード例 #9
0
        private string GetTrainTypeName(string strName, int nID)
        {
            string str = strName;

            if (nID != 0)
            {
                TrainTypeBLL             objBll = new TrainTypeBLL();
                RailExam.Model.TrainType obj    = objBll.GetTrainTypeInfo(nID);

                if (obj.ParentID != 0)
                {
                    str = GetTrainTypeName("/" + obj.TypeName, obj.ParentID) + strName;
                }
                else
                {
                    str = obj.TypeName + strName;
                }
            }

            return(str);
        }
コード例 #10
0
        private string GetTrainTypeName(string strName, int nID)
        {
            string strTrainTypeName = string.Empty;

            if (nID != 0)
            {
                TrainTypeBLL trainTypeBLL = new TrainTypeBLL();
                TrainType    trainType    = trainTypeBLL.GetTrainTypeInfo(nID);

                if (trainType.ParentID != 0)
                {
                    strTrainTypeName = GetTrainTypeName("/" + trainType.TypeName, trainType.ParentID) + strName;
                }
                else
                {
                    strTrainTypeName = trainType.TypeName + strName;
                }
            }

            return(strTrainTypeName);
        }
コード例 #11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (fvTrainType.CurrentMode == FormViewMode.Insert)
            {
                if (hfInsert.Value == "-1")
                {
                    ((HiddenField)fvTrainType.FindControl("hfParentId")).Value = Request.QueryString["id"];
                }
                else
                {
                    ((HiddenField)fvTrainType.FindControl("hfParentId")).Value = hfInsert.Value;
                }
            }

            string strDeleteID = Request.Form.Get("DeleteID");

            if (strDeleteID != "" && strDeleteID != null)
            {
                TrainTypeBLL objBll      = new TrainTypeBLL();
                string       strParentID = objBll.GetTrainTypeInfo(Convert.ToInt32(strDeleteID)).ParentID.ToString();
                int          code        = 0;
                objBll.DeleteTrainType(Convert.ToInt32(strDeleteID), ref code);

                if (code != 0)//code=2292
                {
                    SessionSet.PageMessage = "该培训类别已被引用,不能删除!";
                }
                else
                {
                    ClientScript.RegisterStartupScript(GetType(),
                                                       "jsSelectFirstNode",
                                                       @"window.parent.tvTrainTypeChangeCallBack.callback('-1','Delete','" + strParentID + @"','Rebuild');                       
                            if(window.parent.tvTrainType.get_nodes().get_length() > 0)
                            {
                                window.parent.tvTrainType.get_nodes().getNode(0).select();
                            }",
                                                       true);
                }
            }
        }
コード例 #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string str = Request.QueryString.Get("id");

                TrainStandardBLL objTrainStandardBLL = new TrainStandardBLL();
                int nTypeID = objTrainStandardBLL.GetTrainStandardInfo(Convert.ToInt32(str)).TypeID;

                TrainTypeBLL objTrainTypeBLL = new TrainTypeBLL();
                int          nLevel          = objTrainTypeBLL.GetTrainTypeInfo(nTypeID).LevelNum;

                if (nLevel == 1)
                {
                    fvTrainStandard.Visible = false;
                }
                else
                {
                    fvTrainStandard.Visible = true;
                }
            }
        }
コード例 #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (PrjPub.CurrentStudent != null)
            {
                TrainEmployeeBLL objTrainEmployeeBll = new TrainEmployeeBLL();
                ViewState["TrainTypeID"] = objTrainEmployeeBll.GetTrainEmployeeByEmployeeID(PrjPub.CurrentStudent.EmployeeID).TrainTypeID.ToString();

                if (ViewState["TrainTypeID"].ToString() == "0")
                {
                    lblType.Text = "请选择培训类别";
                }
                else
                {
                    BindGrid1();
                    BindGrid2();
                    //BindGrid3();
                    //BindGrid4();

                    lblType.Text = "";

                    TrainTypeBLL objTrainTypeBll = new TrainTypeBLL();
                    TrainType    objTrainType    = objTrainTypeBll.GetTrainTypeInfo(Convert.ToInt32(ViewState["TrainTypeID"].ToString()));

                    if (objTrainType == null)
                    {
                        lblType.Text = "";
                    }
                    else
                    {
                        lblType.Text = lblType.Text + GetType(" - " + objTrainType.TypeName, objTrainType.ParentID);
                    }
                }
            }
            else
            {
                Response.Redirect("NewStudyInfo.aspx");
            }
        }
コード例 #14
0
        private void AddImplateType(ArrayList objList)
        {
            tvTrainType.Nodes.Clear();
            TrainTypeBLL trainTypeBLL = new TrainTypeBLL();

            IList <TrainType> trainTypeList = trainTypeBLL.GetTrainTypeInfo(0, 0, 0, "", 0, "", "", true, false, "", 0, 200, "LevelNum,OrderIndex ASC");

            if (trainTypeList.Count > 0)
            {
                foreach (TrainType trainType in trainTypeList)
                {
                    if (objList.Count > 0)
                    {
                        if (objList.IndexOf(trainType.TrainTypeID) != -1)
                        {
                            continue;
                        }
                    }

                    TrainStandardBLL             trainStandardBLL = new TrainStandardBLL();
                    RailExam.Model.TrainStandard trainStandard    = new RailExam.Model.TrainStandard();

                    trainStandard.PostID       = Convert.ToInt32(ViewState["PostID"].ToString());
                    trainStandard.TypeID       = Convert.ToInt32(trainType.TrainTypeID);
                    trainStandard.TrainTime    = "";
                    trainStandard.TrainContent = "";
                    trainStandard.TrainForm    = "";
                    trainStandard.ExamForm     = "";
                    trainStandard.Description  = "";
                    trainStandard.Memo         = "";

                    trainStandardBLL.AddTrainStandard(trainStandard);
                }
            }

            BindtvType(ViewState["PostID"].ToString());
        }
コード例 #15
0
        //private void DeleteExercise(string strPaperID)
        //{
        //    TrainTypeExerciseBLL objBll = new TrainTypeExerciseBLL();
        //    objBll.DelTrainTypeExercise(Convert.ToInt32(ViewState["TrainTypeID"].ToString()), Convert.ToInt32(strPaperID));
        //}

        private void BindGrid1()
        {
            BookBLL bookBLL = new BookBLL();
            IList <RailExam.Model.Book> bookList = new List <RailExam.Model.Book>();

            if (!string.IsNullOrEmpty(Request.QueryString.Get("id")))
            {
                TrainTypeBLL trainTypeBLL = new TrainTypeBLL();
                TrainType    trainType    = trainTypeBLL.GetTrainTypeInfo(Convert.ToInt32(ViewState["TrainAimID"].ToString()));
                bookList = bookBLL.GetBookByTrainTypeIDPath(trainType.IDPath);
            }
            else
            {
                bookList = bookBLL.GetEmployeeStudyBookInfoByKnowledgeID(-1, PrjPub.CurrentLoginUser.StationOrgID,
                                                                         Convert.ToInt32(ViewState["TrainAimID"].ToString()), 1, 5,
                                                                         0);
            }

            if (bookList.Count > 0)
            {
                foreach (RailExam.Model.Book book in bookList)
                {
                    if (book.bookName.Length <= 15)
                    {
                        book.bookName = "<a onclick=EditBook(" + book.bookId + ") href=# title=" + book.bookName + " > " + book.bookName + " </a>";
                    }
                    else
                    {
                        book.bookName = "<a onclick=EditBook(" + book.bookId + ") href=# title=" + book.bookName + " > " + book.bookName.Substring(0, 15) + " </a>";
                    }
                }

                gvBook.DataSource = bookList;
                gvBook.DataBind();
            }
        }
コード例 #16
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(PrjPub.StudentID))
            {
                Response.Write("<script>alert('您还没有登录,不能查看在线学习信息!');window.close();</script>");
                return;
            }

            TrainEmployeeBLL objTrainEmployeeBll = new TrainEmployeeBLL();

            ViewState["TrainTypeID"] = objTrainEmployeeBll.GetTrainEmployeeByEmployeeID(PrjPub.CurrentStudent.EmployeeID).TrainTypeID.ToString();

            if (ViewState["TrainTypeID"].ToString() == "0")
            {
                lblType.Text = "请选择培训类别";
            }
            else
            {
                BindGrid1();
                BindGrid2();

                lblType.Text = "";

                TrainTypeBLL objTrainTypeBll = new TrainTypeBLL();
                TrainType    objTrainType    = objTrainTypeBll.GetTrainTypeInfo(Convert.ToInt32(ViewState["TrainTypeID"].ToString()));

                if (objTrainType == null)
                {
                    lblType.Text = "";
                }
                else
                {
                    lblType.Text = lblType.Text + GetType(" - " + objTrainType.TypeName, objTrainType.ParentID);
                }
            }
        }
コード例 #17
0
        private void BindGrid()
        {
            string strSql;

            strSql = "select a.*,b.Short_Name from Book a inner join Org b on a.Publish_Org=b.Org_ID where Publish_org=" + SessionSet.OrganizationID + ViewState["QuerySql"].ToString() + " order by Book_Name";
            DataSet ds = RunSqlDataSet(strSql);

            IList <RailExam.Model.Book> objList = new List <RailExam.Model.Book>();

            ArrayList objBookList = GetBookList();
            BookBLL   objBookbll  = new BookBLL();
            IList <RailExam.Model.Book> objAllBookList = objBookbll.GetAllBookInfo(SessionSet.OrganizationID);

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                int n = objBookList.IndexOf(Convert.ToInt32(dr["Book_ID"].ToString()));
                if (n != -1)
                {
                    RailExam.Model.Book objBookNew = new RailExam.Model.Book();
                    objBookNew.bookId         = Convert.ToInt32(dr["Book_ID"].ToString());
                    objBookNew.bookName       = dr["Book_Name"].ToString();
                    objBookNew.bookNo         = dr["Book_No"].ToString();
                    objBookNew.authors        = dr["Authors"].ToString();
                    objBookNew.bookmaker      = dr["BookMaker"].ToString();
                    objBookNew.publishOrg     = Convert.ToInt32(dr["Publish_Org"].ToString());
                    objBookNew.publishOrgName = dr["Short_Name"].ToString();
                    objBookNew.revisers       = dr["Revisers"].ToString();
                    objBookNew.coverDesigner  = dr["Cover_Designer"].ToString();
                    objBookNew.keyWords       = dr["Keywords"].ToString();
                    objBookNew.pageCount      = Convert.ToInt32(dr["Page_Count"].ToString());
                    objBookNew.wordCount      = Convert.ToInt32(dr["Word_Count"].ToString());
                    objBookNew.Description    = dr["Description"].ToString();
                    objBookNew.url            = "../Book/" + dr["Book_ID"].ToString() + "/index.html";
                    objBookNew.Memo           = dr["Remark"].ToString();

                    foreach (RailExam.Model.Book obj in objAllBookList)
                    {
                        if (obj.bookId == Convert.ToInt32(dr["Book_ID"].ToString()))
                        {
                            TrainTypeBLL objTrainTypeBll = new TrainTypeBLL();
                            objBookNew.knowledgeId   = obj.knowledgeId;
                            objBookNew.knowledgeName = obj.knowledgeName;

                            BookTrainTypeBLL      objBookTrainTypeBll  = new BookTrainTypeBLL();
                            IList <BookTrainType> objBookTrainTypeList = objBookTrainTypeBll.GetBookTrainTypeByBookID(Convert.ToInt32(dr["Book_ID"].ToString()));
                            string strTypeName = "";
                            foreach (BookTrainType obj1 in objBookTrainTypeList)
                            {
                                if (strTypeName == "")
                                {
                                    strTypeName = strTypeName + GetType("/" + obj1.TrainTypeName, objTrainTypeBll.GetTrainTypeInfo(obj1.TrainTypeID).ParentID);
                                }
                                else
                                {
                                    strTypeName = strTypeName + "," + GetType("/" + obj1.TrainTypeName, objTrainTypeBll.GetTrainTypeInfo(obj1.TrainTypeID).ParentID);
                                }
                            }
                            objBookNew.trainTypeNames = strTypeName;
                        }
                    }

                    objList.Add(objBookNew);
                }
            }

            gvBook.DataSource = objList;
            gvBook.DataBind();
        }
コード例 #18
0
        private void BindGrid()
        {
            ArrayList objList = GetNowBookList();

            BookBLL bookBLL = new BookBLL();
            IList <RailExam.Model.Book> AllBookList = bookBLL.GetAllBookInfo(SessionSet.OrganizationID);
            IList <RailExam.Model.Book> NewBookList = new List <RailExam.Model.Book>();

            foreach (RailExam.Model.Book book in AllBookList)
            {
                if (objList.IndexOf(book.bookId.ToString()) == -1)
                {
                    NewBookList.Add(book);
                }
            }

            TrainTypeBLL     trainTypeBLL     = new TrainTypeBLL();
            BookTrainTypeBLL bookTrainTypeBLL = new BookTrainTypeBLL();

            foreach (RailExam.Model.Book book in NewBookList)
            {
                IList <BookTrainType> bookTrainTypeList = bookTrainTypeBLL.GetBookTrainTypeByBookID(book.bookId);
                string strTrainTypeNames = "";
                foreach (BookTrainType bookTrainType in bookTrainTypeList)
                {
                    if (strTrainTypeNames == "")
                    {
                        strTrainTypeNames = strTrainTypeNames + GetTrainTypeName("/" + bookTrainType.TrainTypeName, trainTypeBLL.GetTrainTypeInfo(bookTrainType.TrainTypeID).ParentID);
                    }
                    else
                    {
                        strTrainTypeNames = strTrainTypeNames + "," + GetTrainTypeName("/" + bookTrainType.TrainTypeName, trainTypeBLL.GetTrainTypeInfo(bookTrainType.TrainTypeID).ParentID);
                    }
                }
                book.trainTypeNames = strTrainTypeNames;
            }

            gvBook.DataSource = NewBookList;
            gvBook.DataBind();
        }
コード例 #19
0
        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()));
            }
        }