Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //得到是否是武汉铁路局
            if (PrjPub.IsWuhan())
            {
                hfIswuhan.Value = "1";
            }
            else
            {
                hfIswuhan.Value = "0";
            }

            if (!IsPostBack)
            {
                BindTree();
                BindTrainTypeTree();
            }

            string str1 = Request.Form.Get("Test1");

            if (str1 != null & str1 != "")
            {
                BindTree();
                BindTrainTypeTree();
            }
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (PrjPub.IsWuhan())
                {
                    gradesGrid.Levels[0].Columns[2].HeadingText = "员工编码";
                    lblWorkNo.Text = "上岗证号";
                }
                else
                {
                    gradesGrid.Levels[0].Columns[2].HeadingText = "工资编号";
                    lblWorkNo.Text = "工资编号";
                }

                DataSet ds = GetDataSet();
                if (ds != null && ds.Tables[0].Rows.Count > 0)
                {
                    gradesGrid.DataSource = ds;
                    gradesGrid.DataBind();
                }
                //else
                //{
                //    SessionSet.PageMessage = "数据错误!";
                //    return;
                //}
            }
            else
            {
                if (Request.Form.Get("OutPut") != null && Request.Form.Get("OutPut") != "")
                {
                    OutputData(Request.Form.Get("OutPut"), Request.Form.Get("OutPutOrgID"));
                }
            }
        }
Exemplo n.º 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (PrjPub.IsWuhan())
                {
                    Grid1.Columns[3].HeaderText = "Ô±¹¤±àÂë";
                }
                else
                {
                    Grid1.Columns[3].HeaderText = "¹¤×ʱàºÅ";
                }

                string strId = Request.QueryString.Get("employeeID");
                if (strId != null && strId != "")
                {
                    ViewState["ChooseId"]   = strId;
                    ViewState["UpdateMode"] = 1;
                }
                else
                {
                    ViewState["ChooseId"]   = "";
                    ViewState["UpdateMode"] = 0;
                }

                BindStationStart();
                BindOrgStart();
                BindWorkShopStart();
                BindSystemStart();
                BindTypeStart();
                BindPostStart();

                EmployeeBLL             bll      = new EmployeeBLL();
                RailExam.Model.Employee employee = bll.GetEmployee(Convert.ToInt32(Request.QueryString.Get("nowEmployeeID")));
                OrganizationBLL         orgbll   = new OrganizationBLL();
                int stationOrgID = orgbll.GetStationOrgID(employee.OrgID);
                if (stationOrgID != 200)
                {
                    ddlStation.SelectedValue = stationOrgID.ToString();
                    OrganizationBLL objBll = new OrganizationBLL();
                    IList <RailExam.Model.Organization> objList =
                        objBll.GetOrganizationsByParentID(Convert.ToInt32(ddlStation.SelectedValue));
                    foreach (RailExam.Model.Organization organization in objList)
                    {
                        ListItem item = new ListItem();
                        item.Value = organization.OrganizationId.ToString();
                        item.Text  = organization.ShortName;
                        ddlWorkShop.Items.Add(item);
                    }

                    ddlStation.Enabled = false;
                }

                ViewState["StartRow"] = 0;
                ViewState["EndRow"]   = Grid1.PageSize;

                ViewState["EmploySortField"] = "nlssort(a.employee_name,'NLS_SORT=SCHINESE_PINYIN_M')";
                BindGrid(ViewState["EmploySortField"].ToString());
            }
        }
Exemplo n.º 4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack && !CallBack.IsCallback)
            {
                NavBarItem parentItem = null;

                if (PrjPub.CurrentLoginUser == null)
                {
                    CallBack.RefreshInterval = 0;
                    return;
                }

                hfEmployeeID.Value = PrjPub.CurrentLoginUser.EmployeeID.ToString();

                foreach (FunctionRight functionRight in PrjPub.CurrentLoginUser.FunctionRights)
                {
                    if (PrjPub.IsWuhan())
                    {
                        if (functionRight.Function.FunctionID == "0406")
                        {
                            continue;
                        }
                    }
                    if (functionRight.Right == 0)
                    {
                        continue;
                    }

                    NavBarItem item = new NavBarItem();

                    item.Text     = functionRight.Function.MenuName;
                    item.Expanded = functionRight.Function.IsDefault;

                    if (functionRight.Function.FunctionID.Length == 2)
                    {
                        item.SelectedLookId       = "TopItemLook";
                        item.SubGroupCssClass     = "Level2Group";
                        item.DefaultSubItemLookId = "Level2ItemLook";

                        SystemMenu.Items.Add(item);
                        parentItem = item;
                    }
                    else
                    {
                        if (parentItem != null)
                        {
                            item.ClientSideCommand = "goToUrl('" + functionRight.Function.PageUrl + "');";
                            //item.NavigateUrl = functionRight.Function.PageUrl;
                            //item.Target = "ContentFrame";

                            parentItem.Items.Add(item);
                        }
                    }
                }
            }
        }
        /// <summary>
        /// 记时
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void Callback1_Callback(object sender, CallBackEventArgs e)
        {
            if (PrjPub.IsWuhan())
            {
                return;
            }

            if (string.IsNullOrEmpty(e.Parameters[0].ToString()) || string.IsNullOrEmpty(e.Parameters[1].ToString()))
            {
                return;
            }

            DateTime starttime;
            DateTime endtime;

            try
            {
                starttime = Convert.ToDateTime(e.Parameters[0]);
                endtime   = Convert.ToDateTime(e.Parameters[1]);
            }
            catch
            {
                return;
            }

            TimeSpan ts            = endtime.Subtract(starttime);
            int      spanLoginTime = ts.Hours * 3600 + ts.Minutes * 60 + ts.Seconds;

            EmployeeBLL employeeBLL  = new EmployeeBLL();
            Employee    employyee    = employeeBLL.GetEmployee(Convert.ToInt32(e.Parameters[2]));
            int         oldLogintime = employyee.LoginTime;

            employyee.LoginTime = oldLogintime + spanLoginTime;

            SystemUserBLL systemUserBLL = new SystemUserBLL();
            SystemUser    loginUser     = systemUserBLL.GetUserByEmployeeID(Convert.ToInt32(e.Parameters[2]));

            SessionSet.UserID           = loginUser.UserID;
            SessionSet.EmployeeID       = loginUser.EmployeeID;
            SessionSet.EmployeeName     = employyee.EmployeeName;
            SessionSet.OrganizationID   = employyee.OrgID;
            SessionSet.OrganizationName = employyee.OrgName;

            if (PrjPub.IsServerCenter)
            {
                employeeBLL.UpdateEmployee(employyee);
            }
            else
            {
                employeeBLL.UpdateEmployeeInStation(employyee);
            }
        }
        protected void btnLast_Click(object sender, ImageClickEventArgs e)
        {
            string strId        = Request.QueryString.Get("id");
            string strStartMode = ViewState["startmode"].ToString();
            string strFlag      = "";

            if (ViewState["mode"].ToString() == "Insert")
            {
                strFlag = "Edit";
            }
            else if (ViewState["mode"].ToString() == "Edit")
            {
                RandomExamResultBLL reBll = new RandomExamResultBLL();
                IList <RailExam.Model.RandomExamResult> examResults = reBll.GetRandomExamResultByExamID(Convert.ToInt32(strId));

                if (examResults.Count > 0)
                {
                    strFlag = "ReadOnly";
                }
                else
                {
                    strFlag = ViewState["mode"].ToString();
                }
            }
            else
            {
                strFlag = ViewState["mode"].ToString();
            }

            if (PrjPub.IsWuhan())
            {
                Response.Redirect("RandomExamManageThird.aspx?startmode=" + strStartMode + "&mode=" + strFlag + "&id=" + strId);
            }
            else
            {
                string strItemType = "";
                RandomExamSubjectBLL      objSubjectBll  = new RandomExamSubjectBLL();
                IList <RandomExamSubject> objSubjectList = objSubjectBll.GetRandomExamSubjectByRandomExamId(Convert.ToInt32(strId));
                foreach (RandomExamSubject subject in objSubjectList)
                {
                    if (strItemType == "")
                    {
                        strItemType = subject.ItemTypeId.ToString();
                    }
                    else
                    {
                        strItemType = strItemType + "|" + subject.ItemTypeId;
                    }
                }
                Response.Redirect("/RailExamBao/RandomExamOther/RandomExamStrategyInfo.aspx?startmode=" + strStartMode + "&mode=" + strFlag + "&itemType=" + strItemType + "&id=" + strId);
            }
        }
Exemplo n.º 7
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                hfIsWuhan.Value = PrjPub.IsWuhan().ToString();
                if (PrjPub.HasEditRight("教材管理") && PrjPub.IsServerCenter)                //&& PrjPub.CurrentLoginUser.SuitRange == 1
                {
                    HfUpdateRight.Value = "True";
                }
                else
                {
                    HfUpdateRight.Value = "False";
                }

                if (PrjPub.HasDeleteRight("教材管理") && PrjPub.IsServerCenter)
                {
                    HasDeleteRight.Value = "True";
                }
                else
                {
                    HasDeleteRight.Value = "False";
                }

                BindDdl();

                DateTime           start   = new DateTime(2000, 1, 1);
                DateTime           end     = new DateTime(2100, 12, 31);
                BookUpdateBLL      objBll  = new BookUpdateBLL();
                IList <BookUpdate> objList = objBll.GetBookUpdateBySelect(0, "", "", start, end, "");
                dgUpdate.DataSource = objList;
                dgUpdate.DataBind();
            }
            string strRefreshGrid = Request.Form.Get("RefreshGrid");

            if (strRefreshGrid != null & strRefreshGrid != "")
            {
                BindGrid();
            }

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

            if (strID != null & strID != "")
            {
                BookUpdateBLL objBll = new BookUpdateBLL();
                objBll.DeleteBookUpdate(Convert.ToInt32(strID));
                BindGrid();
            }
        }
Exemplo n.º 8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (PrjPub.IsEvaluation)
            //{
            //    DateTime strEnd = Convert.ToDateTime(PrjPub.EvaluationDate);

            //    if (DateTime.Today > strEnd)
            //    {
            //        Response.Write(ViewState["OverTime"].ToString());
            //    }
            //}

            if (!IsPostBack)
            {
                //hf.Value = "0";
                hfIsWuhan.Value      = PrjPub.IsWuhan().ToString();
                hfIsShowResult.Value = ConfigurationManager.AppSettings["IsShowResult"];
            }
        }
Exemplo n.º 9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //if (PrjPub.IsEvaluation)
            //{
            //    DateTime strEnd = Convert.ToDateTime(PrjPub.EvaluationDate);

            //    if (DateTime.Today > strEnd)
            //    {
            //        Response.Write(ViewState["OverTime"].ToString());
            //    }
            //}

            if (PrjPub.IsWuhan())
            {
                hfIswuhan.Value = "1";
            }
            else
            {
                hfIswuhan.Value = "0";
            }
        }
Exemplo n.º 10
0
        private void DeleteData(int nEmployeID)
        {
            EmployeeBLL employeeBLL = new EmployeeBLL();

            if (employeeBLL.CanDeleteEmployee(nEmployeID))
            {
                if (!PrjPub.IsWuhan())
                {
                    EmployeeDetailBLL objBll = new EmployeeDetailBLL();
                    objBll.DeleteEmployeeDetail(nEmployeID);
                }
                else
                {
                    employeeBLL.DeleteEmployee(nEmployeID);
                }
            }
            else
            {
                SessionSet.PageMessage = "该员工已参加考试,不能删除!";
                return;
            }
        }
Exemplo n.º 11
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (PrjPub.CurrentLoginUser == null && PrjPub.CurrentStudent == null)
                {
                    Response.Redirect("/RailExamBao/Common/Error.aspx?error=Session过期请重新登录本系统!");
                    return;
                }

                string sbInnerHtml = "<ul id='navigation'>";

                if (!string.IsNullOrEmpty(Request.QueryString.Get("type")) && Request.QueryString.Get("type") == "employee")
                {
                    OracleAccess oa  = new OracleAccess();
                    string       sql = "select * from SYSTEM_FUNCTION t where function_type = 4 order by function_id";
                    DataSet      ds  = oa.RunSqlDataSet(sql);
                    if (ds != null && ds.Tables.Count > 0)
                    {
                        foreach (DataRow row in ds.Tables[0].Rows)
                        {
                            if (row["function_id"].ToString().Length == 2)
                            {
                                sbInnerHtml += "<li><a class='head'>" + row["menu_name"] + "</a>";
                                sbInnerHtml += "<ul>";
                                //添加二级功能菜单
                                foreach (DataRow row1 in ds.Tables[0].Rows)
                                {
                                    if (row1["function_id"].ToString().Length == 4 &&
                                        row1["function_id"].ToString().IndexOf(row["function_id"].ToString()) == 0)
                                    {
                                        sbInnerHtml += @"<li><a href='" + row1["page_url"].ToString() + "' target='I2'>" + row1["menu_name"].ToString() + "</a></li>";
                                    }
                                }
                                sbInnerHtml += "</ul>";
                            }
                            sbInnerHtml += "</li>";
                        }
                        sbInnerHtml += "</ul>";

                        this.menu.InnerHtml = sbInnerHtml;
                    }
                }
                else
                {
                    foreach (FunctionRight functionRight in PrjPub.CurrentLoginUser.FunctionRights)
                    {
                        if (PrjPub.IsWuhan())
                        {
                            if (functionRight.Function.FunctionID == "0406")
                            {
                                continue;
                            }
                        }
                        if (functionRight.Right == 0)
                        {
                            continue;
                        }


                        if (functionRight.Function.FunctionID.Length == 2)
                        {
                            sbInnerHtml += "<li><a class='head'>" + functionRight.Function.MenuName + "</a>";
                            sbInnerHtml += "<ul>";
                            //添加二级功能菜单
                            foreach (FunctionRight functionRight1 in PrjPub.CurrentLoginUser.FunctionRights)
                            {
                                if (functionRight1.Right == 0)
                                {
                                    continue;
                                }

                                if (functionRight1.Function.FunctionID.Length == 4 &&
                                    functionRight1.Function.FunctionID.IndexOf(functionRight.Function.FunctionID) == 0)
                                {
                                    sbInnerHtml += @"<li><a href='" + functionRight1.Function.PageUrl + "' target='I2'>" + functionRight1.Function.MenuName + "</a></li>";
                                }
                            }
                            sbInnerHtml += "</ul>";
                        }
                        sbInnerHtml += "</li>";
                    }

                    sbInnerHtml += "</ul>";

                    this.menu.InnerHtml = sbInnerHtml;
                }
            }
        }
Exemplo n.º 12
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            if (this.txtPageCount.Text == "")
            {
                this.txtPageCount.Text = "0";
            }

            if (this.txtWordCount.Text == "")
            {
                this.txtWordCount.Text = "0";
            }


            BookBLL kBLL = new BookBLL();

            BookBLL objBookBll = new BookBLL();

            if (txtBookName.Text.Trim() != ViewState["BookName"].ToString())
            {
                if (objBookBll.GetBookByName(txtBookName.Text.Trim()).Count > 0)
                {
                    SessionSet.PageMessage = "该教材名称已经存在";
                    return;
                }
            }

            //修改
            string strId = Request.QueryString.Get("id");

            RailExam.Model.Book book = new RailExam.Model.Book();

            book.bookId           = Convert.ToInt32(strId);
            book.Memo             = txtMemo.Text;
            book.bookName         = txtBookName.Text;
            book.Description      = txtDescription.Text;
            book.pageCount        = int.Parse(this.txtPageCount.Text);
            book.wordCount        = int.Parse(this.txtWordCount.Text);
            book.revisers         = txtRevisers.Text;
            book.authors          = hfEmployeeID.Value;
            book.bookmaker        = txtBookMaker.Text;
            book.bookNo           = txtBookNo.Text;
            book.coverDesigner    = txtCoverDesigner.Text;
            book.keyWords         = txtKeyWords.Text;
            book.knowledgeName    = txtKnowledgeName.Text;
            book.knowledgeId      = int.Parse(hfKnowledgeID.Value);
            book.publishOrg       = int.Parse(hfPublishOrgID.Value);
            book.publishDate      = DateTime.Parse(datePublishDate.DateValue.ToString());
            book.TechnicianTypeID = Convert.ToInt32(ddlTech.SelectedValue);
            book.IsGroupLearder   = Convert.ToInt32(ddlIsGroup.SelectedValue);
            book.OrderIndex       = Convert.ToInt32(hfOrderIndex.Value);
            if (hlUrl.Text != "")
            {
                book.url = "../Book/" + strId + "/cover.htm";
            }


            ArrayList alTrainTypeID = new ArrayList();

            string strTrainTypeID = hfTrainTypeID.Value;

            string[] str1 = strTrainTypeID.Split(new char[] { ',' });

            for (int i = 0; i < str1.Length; i++)
            {
                if (!string.IsNullOrEmpty(str1[i]))
                {
                    alTrainTypeID.Add(str1[i]);
                }
            }

            book.trainTypeidAL = alTrainTypeID;


            ArrayList al = new ArrayList();

            book.orgidAL = GetOrg(tvOrg.Nodes, al);

            ArrayList al1 = new ArrayList();

            foreach (TreeViewNode tn in tvPost.Nodes)
            {
                if (tn.Checked)
                {
                    al1.Add(tn.ID);
                }

                if (tn.Nodes.Count > 0)
                {
                    foreach (TreeViewNode tns in tn.Nodes)
                    {
                        if (tns.Checked)
                        {
                            al1.Add(tns.ID);
                        }

                        if (tns.Nodes.Count > 0)
                        {
                            foreach (TreeViewNode tnss in tns.Nodes)
                            {
                                if (tnss.Checked)
                                {
                                    al1.Add(tnss.ID);
                                }
                            }
                        }
                    }
                }
            }
            book.postidAL = al1;

            kBLL.UpdateBook(book);
            kBLL.UpdateBookVersion(Convert.ToInt32(strId));
            SaveBookCover(strId);

            if (PrjPub.IsWuhan())
            {
                Response.Write("<script>window.opener.form1.Refresh.value='true';window.opener.form1.submit();window.close();</script>");
            }
            else
            {
                Response.Write("<script>top.returnValue='true';top.close();</script>");
            }
        }
Exemplo n.º 13
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()));
            }
        }
Exemplo n.º 14
0
        protected void btnExcel_Click(object sender, EventArgs e)
        {
            RandomExamBLL objBll = new RandomExamBLL();

            RailExam.Model.RandomExam objRandomExam = objBll.GetExam(Convert.ToInt32(Request.QueryString.Get("id")));

            SpreadsheetClass xlsheet = new SpreadsheetClass();
            Worksheet        ws      = (Worksheet)xlsheet.Worksheets[1];

            ws.Cells.Font.set_Size(10);
            ws.Cells.Font.set_Name("宋体");

            ws.Cells[1, 1] = objRandomExam.ExamName + " 参加考试学员名单";
            Range rang1 = ws.get_Range(ws.Cells[1, 1], ws.Cells[1, 7]);

            rang1.set_MergeCells(true);
            rang1.set_HorizontalAlignment(XlHAlign.xlHAlignCenter);
            rang1.Font.set_Name("宋体");


            //write headertext
            ws.Cells[2, 1] = "序号";
            ((Range)ws.Cells[2, 1]).set_HorizontalAlignment(XlHAlign.xlHAlignCenter);


            ws.Cells[2, 2] = "姓名";
            ws.get_Range(ws.Cells[2, 2], ws.Cells[2, 2]).set_MergeCells(true);
            ws.get_Range(ws.Cells[2, 2], ws.Cells[2, 2]).set_HorizontalAlignment(XlHAlign.xlHAlignCenter);

            if (PrjPub.IsWuhan())
            {
                ws.Cells[2, 3] = "员工编码";
            }
            else
            {
                ws.Cells[2, 3] = "工资编号";
            }
            ws.get_Range(ws.Cells[2, 3], ws.Cells[2, 3]).set_MergeCells(true);
            ws.get_Range(ws.Cells[2, 3], ws.Cells[2, 3]).set_HorizontalAlignment(XlHAlign.xlHAlignCenter);

            ws.Cells[2, 4] = "职名";
            ws.get_Range(ws.Cells[2, 4], ws.Cells[2, 4]).set_MergeCells(true);
            ws.get_Range(ws.Cells[2, 4], ws.Cells[2, 4]).set_HorizontalAlignment(XlHAlign.xlHAlignCenter);

            ws.Cells[2, 5] = "组织机构";
            ws.get_Range(ws.Cells[2, 5], ws.Cells[2, 7]).set_MergeCells(true);
            ws.get_Range(ws.Cells[2, 5], ws.Cells[2, 7]).set_HorizontalAlignment(XlHAlign.xlHAlignCenter);

            ws.Cells[2, 8] = "考试地点";
            ws.get_Range(ws.Cells[2, 8], ws.Cells[2, 10]).set_MergeCells(true);
            ws.get_Range(ws.Cells[2, 8], ws.Cells[2, 10]).set_HorizontalAlignment(XlHAlign.xlHAlignCenter);

            for (int j = 0; j < gvChoose.Rows.Count; j++)
            {
                ws.Cells[3 + j, 1] = ((Label)gvChoose.Rows[j].FindControl("lblNo")).Text;

                ws.Cells[3 + j, 2] = ((Label)gvChoose.Rows[j].FindControl("LabelName")).Text;
                ws.get_Range(ws.Cells[3 + j, 2], ws.Cells[3 + j, 2]).set_MergeCells(true);
                ws.get_Range(ws.Cells[3 + j, 2], ws.Cells[3 + j, 2]).set_HorizontalAlignment(XlHAlign.xlHAlignLeft);

                ws.Cells[3 + j, 3] = "'" + ((Label)gvChoose.Rows[j].FindControl("LabelWorkNo")).Text;
                ws.get_Range(ws.Cells[3 + j, 3], ws.Cells[3 + j, 3]).set_MergeCells(true);
                ws.get_Range(ws.Cells[3 + j, 3], ws.Cells[3 + j, 3]).set_HorizontalAlignment(XlHAlign.xlHAlignLeft);


                ws.Cells[3 + j, 4] = ((Label)gvChoose.Rows[j].FindControl("LabelPostName")).Text;
                ws.get_Range(ws.Cells[3 + j, 4], ws.Cells[3 + j, 4]).set_MergeCells(true);
                ws.get_Range(ws.Cells[3 + j, 4], ws.Cells[3 + j, 4]).set_HorizontalAlignment(XlHAlign.xlHAlignLeft);

                ws.Cells[3 + j, 5] = ((Label)gvChoose.Rows[j].FindControl("Labelorgid")).Text;
                ws.get_Range(ws.Cells[3 + j, 5], ws.Cells[3 + j, 7]).set_MergeCells(true);
                ws.get_Range(ws.Cells[3 + j, 5], ws.Cells[3 + j, 7]).set_HorizontalAlignment(XlHAlign.xlHAlignCenter);

                ws.Cells[3 + j, 8] = ((Label)gvChoose.Rows[j].FindControl("lblComputeRoom")).Text;
                ws.get_Range(ws.Cells[3 + j, 8], ws.Cells[3 + j, 10]).set_MergeCells(true);
                ws.get_Range(ws.Cells[3 + j, 8], ws.Cells[3 + j, 10]).set_HorizontalAlignment(XlHAlign.xlHAlignCenter);
            }

            ws.Name = "1-1";
            ws.Cells.Columns.AutoFit();

            try
            {
                ((Worksheet)xlsheet.Worksheets[1]).Activate();

                string path = Server.MapPath("../Excel/Excel.xls");
                if (File.Exists(path))
                {
                    File.Delete(path);
                }
                xlsheet.Export(path, SheetExportActionEnum.ssExportActionNone, SheetExportFormat.ssExportAsAppropriate);

                FileInfo file = new FileInfo(path);
                this.Response.Clear();
                this.Response.Buffer          = true;
                this.Response.Charset         = "utf-7";
                this.Response.ContentEncoding = Encoding.UTF7;
                // 添加头信息,为"文件下载/另存为"对话框指定默认文件名
                this.Response.AddHeader("Content-Disposition",
                                        "attachment; filename=" + HttpUtility.UrlEncode(objRandomExam.ExamName + "参加考试学员名单") + ".xls");
                // 添加头信息,指定文件大小,让浏览器能够显示下载进度
                this.Response.AddHeader("Content-Length", file.Length.ToString());

                // 指定返回的是一个不能被客户端读取的流,必须被下载
                this.Response.ContentType = "application/ms-excel";

                // 把文件流发送到客户端
                this.Response.WriteFile(file.FullName);
            }
            catch
            {
                SessionSet.PageMessage = "系统错误,导出Excel文件失败!";
            }
        }
Exemplo n.º 15
0
        protected void SaveButton_Click(object sender, EventArgs e)
        {
            BookUpdateBLL BookUpdateBLL = new BookUpdateBLL();
            BookUpdate    BookUpdate    = new BookUpdate();

            string strUpdateObject = Request.QueryString.Get("Object");

            if (txtCause.Text == string.Empty)
            {
                SessionSet.PageMessage = "更改原因不能为空!";
                return;
            }

            if (txtContent.Text == string.Empty)
            {
                SessionSet.PageMessage = "更改内容不能为空!";
                return;
            }

            if (ViewState["AddFlag"].ToString() == "1")     //新增
            {
                BookBLL objBookBll = new BookBLL();
                BookUpdate.BookId        = int.Parse(ViewState["BookID"].ToString());
                BookUpdate.ChapterId     = int.Parse(ViewState["ChapterID"].ToString());
                BookUpdate.updatePerson  = lblPerson.Text;
                BookUpdate.updateDate    = DateTime.Parse(lblDate.Text);
                BookUpdate.updateCause   = txtCause.Text;
                BookUpdate.updateContent = txtContent.Text;
                BookUpdate.Memo          = txtMemo.Text;
                BookUpdate.BookNameBak   = objBookBll.GetBook(Convert.ToInt32(ViewState["BookID"].ToString())).bookName;
                if (ViewState["ChapterID"].ToString() != "0")
                {
                    BookChapterBLL objChapterBll = new BookChapterBLL();
                    BookUpdate.ChapterNameBak =
                        objChapterBll.GetBookChapter(Convert.ToInt32(ViewState["ChapterID"].ToString())).ChapterName;
                }
                if (strUpdateObject == "insertchapterinfo")
                {
                    BookUpdate.ChapterNameBak = Server.UrlDecode(Request.QueryString.Get("newchaptername"));
                    BookUpdate.UpdateObject   = PrjPub.BOOKUPDATEOBJECT_INSERTCHAPTERINFO;
                }
                else if (strUpdateObject == "updatechapterinfo")
                {
                    BookUpdate.UpdateObject = PrjPub.BOOKUPDATEOBJECT_UPDATECHAPTERINFO;
                }
                else if (strUpdateObject == "chaptercontent")
                {
                    BookUpdate.UpdateObject = PrjPub.BOOKUPDATEOBJECT_CHAPTERCONTENT;
                }
                else if (strUpdateObject == "delbook")
                {
                    BookUpdate.UpdateObject = PrjPub.BOOKUPDATEOBJECT_DELBOOK;
                }
                else if (strUpdateObject == "delchapter")
                {
                    BookUpdate.UpdateObject = PrjPub.BOOKUPDATEOBJECT_DELCHAPTER;
                }
                else
                {
                    BookUpdate.UpdateObject = lblChapterName.Text;
                }
                BookUpdateBLL.AddBookUpdate(BookUpdate);

                Response.Write("<script>top.returnValue='true';window.close();</script>");
            }
            else        //修改
            {
                BookUpdate.BookId        = int.Parse(ViewState["BookID"].ToString());
                BookUpdate.ChapterId     = int.Parse(ViewState["ChapterID"].ToString());
                BookUpdate.updatePerson  = lblPerson.Text;
                BookUpdate.updateDate    = DateTime.Parse(lblDate.Text);
                BookUpdate.updateCause   = txtCause.Text;
                BookUpdate.updateContent = txtContent.Text;
                BookUpdate.Memo          = txtMemo.Text;

                BookUpdate.bookUpdateId = int.Parse(Request.QueryString.Get("id"));
                BookUpdateBLL.UpdateBookUpdate(BookUpdate);

                if (PrjPub.IsWuhan())
                {
                    Response.Write("<script>window.opener.form1.RefreshGrid.value='true';window.opener.form1.submit();window.close();</script>");
                }
                else
                {
                    Response.Write("<script>top.returnValue='true';window.close();</script>");
                }
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                hfOrgID.Value          = PrjPub.CurrentLoginUser.StationOrgID.ToString();
                ViewState["mode"]      = Request.QueryString.Get("mode");
                ViewState["startmode"] = Request.QueryString.Get("startmode");
                hfMode.Value           = ViewState["mode"].ToString();

                _isWuhan     = PrjPub.IsWuhan();
                _isWuhanOnly = PrjPub.IsWuhanOnly();

                dateBeginTime.DateValue = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");
                dateEndTime.DateValue   = DateTime.Now.AddDays(7).ToString("yyyy-MM-dd HH:mm:ss");

                string ExamCategoryID = Request.QueryString.Get("ExamCategoryIDPath");

                if (ExamCategoryID == "0")
                {
                    ExamCategoryID = "";
                }

                if (!string.IsNullOrEmpty(ExamCategoryID))
                {
                    string[] str1 = ExamCategoryID.Split(new char[] { '/' });

                    int nID = int.Parse(str1[str1.LongLength - 1].ToString());

                    hfCategoryId.Value = nID.ToString();
                    ExamCategoryBLL pcl = new ExamCategoryBLL();

                    RailExam.Model.ExamCategory pc = pcl.GetExamCategory(nID);

                    txtCategoryName.Text = pc.CategoryName;
                }

                OracleAccess db     = new OracleAccess();
                string       strSql = "select * from Random_Exam_Modular_Type order by Level_Num";
                DataSet      ds     = db.RunSqlDataSet(strSql);

                ListItem item = new ListItem();
                item.Text  = "--请选择--";
                item.Value = "0";
                ddlModularType.Items.Add(item);

                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    item       = new ListItem();
                    item.Text  = dr["Random_Exam_Modular_Type_Name"].ToString();
                    item.Value = dr["Random_Exam_Modular_Type_ID"].ToString();
                    ddlModularType.Items.Add(item);
                }


                string strExamID = Request.QueryString.Get("id");
                if (!string.IsNullOrEmpty(strExamID))
                {
                    FillPage(int.Parse(strExamID));
                }
                else
                {
                    rbnStyle2.Checked     = true;
                    saveTd.Visible        = true;
                    ddlDate.SelectedValue = "1";
                    dateSaveDate.Visible  = false;

                    SetTrainClassVisible(false);
                }
            }

            if (hfPostID.Value != "")
            {
                txtPost.Text = hfPostName.Value;
            }

            if (hfCategoryId.Value != "")
            {
                ExamCategoryBLL             pcl = new ExamCategoryBLL();
                RailExam.Model.ExamCategory pc  = pcl.GetExamCategory(Convert.ToInt32(hfCategoryId.Value));
                txtCategoryName.Text = pc.CategoryName;
            }

            chkHasTrainClass.Attributes.Add("onclick", "chkHasTrainClassOnchange();");
        }
Exemplo n.º 17
0
        protected void Page_Load(object sender, EventArgs e)
        {
            hfChapterID.Value = Request.QueryString["id"];
            hfIsWuhan.Value   = PrjPub.IsWuhan().ToString();

            if (fvBookChapter.CurrentMode == FormViewMode.Insert)
            {
                if (hfInsert.Value == "-1")
                {
                    ((HiddenField)fvBookChapter.FindControl("hfParentID")).Value = Request.QueryString["ParentID"];
                    ((HiddenField)fvBookChapter.FindControl("hfBookID")).Value   = Request.QueryString["BookID"];
                }
                else
                {
                    ((HiddenField)fvBookChapter.FindControl("hfParentId")).Value = hfInsert.Value;
                    ((HiddenField)fvBookChapter.FindControl("hfBookID")).Value   = Request.QueryString["BookID"];
                }
                if (Request.QueryString["Mode"] == "Edit")
                {
                    ((HiddenField)fvBookChapter.FindControl("hfIsEdit")).Value = "true";
                }
                else
                {
                    ((HiddenField)fvBookChapter.FindControl("hfIsEdit")).Value = "false";
                }
            }
            else if (fvBookChapter.CurrentMode == FormViewMode.Edit)
            {
                if (Request.QueryString["Mode"] == "Edit")
                {
                    ((HiddenField)fvBookChapter.FindControl("hfIsEdit")).Value = "true";
                }
                else
                {
                    ((HiddenField)fvBookChapter.FindControl("hfIsEdit")).Value = "false";
                }
            }


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

            if (strRefresh != null & strRefresh != "")
            {
                string strPath = "../Online/Book/" + Request.QueryString["BookID"].ToString() + "/" + Request.QueryString["id"].ToString() + ".htm";

                BookChapterBLL objBill = new BookChapterBLL();
                objBill.UpdateBookChapterUrl(Convert.ToInt32(Request.QueryString["id"].ToString()), strPath);
                RailExam.Model.BookChapter objBookChapter = objBill.GetBookChapter(Convert.ToInt32(Request.QueryString["id"].ToString()));
                string strChapterName = objBookChapter.ChapterName;

                string str = File.ReadAllText(Server.MapPath(strPath), Encoding.UTF8);

                if (str.IndexOf("chaptertitle") < 0)
                {
                    if (objBookChapter.LevelNum < 3)
                    {
                        str = "<link href='book.css' type='text/css' rel='stylesheet' />"
                              + "<body oncontextmenu='return false' ondragstart='return false' onselectstart ='return false' oncopy='document.selection.empty()' onbeforecopy='return false'>"
                              + "<div id='chaptertitle" + objBookChapter.LevelNum + "'>" + strChapterName + "</div>" +
                              "<br>"
                              + str + "</body>";
                    }
                    else
                    {
                        str = "<link href='book.css' type='text/css' rel='stylesheet' />"
                              + "<body oncontextmenu='return false' ondragstart='return false' onselectstart ='return false' oncopy='document.selection.empty()' onbeforecopy='return false'>"
                              + "<div id='chaptertitle3'>" + strChapterName + "</div>" +
                              "<br>"
                              + str + "</body>";
                    }

                    File.WriteAllText(Server.MapPath(strPath), str, Encoding.UTF8);
                }


                BookBLL objBookBill = new BookBLL();
                if (Request.QueryString.Get("Mode") == "Edit")
                {
                    objBookBill.UpdateBookVersion(Convert.ToInt32(Request.QueryString["BookID"].ToString()));
                }
                string strBookName = objBookBill.GetBook(Convert.ToInt32(Request.QueryString["BookID"].ToString())).bookName;

                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("编辑教材《" + strBookName + "》中“" + strChapterName + "”的章节内容");

                fvBookChapter.DataBind();
                Grid1.DataBind();

                objBill.GetIndex(Request.QueryString["BookID"].ToString());

                ItemBLL objBll = new ItemBLL();
                IList <RailExam.Model.Item> objList =
                    objBll.GetItemsByBookChapterId(Convert.ToInt32(Request.QueryString["BookID"]), Convert.ToInt32(Request.QueryString["id"]), 0, 0);

                if (objList.Count > 0)
                {
                    ClientScript.RegisterStartupScript(GetType(),
                                                       "jsSelectFirstNode",
                                                       @"var ret = window.showModalDialog('/RailExamBao/Book/ItemEnabled.aspx?BookID=" + Request.QueryString["BookID"] + @"&ChapterID=" + Request.QueryString["id"] + @"','','help:no; status:no;dialogWidth:300px;dialogHeight:120px;');",
                                                       true);
                }
            }

            string strRefreshGrid = Request.Form.Get("RefreshGrid");

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

            string strDeleteBookChapterUpdateID = Request.Form.Get("DeleteBookChapterUpdateID");

            if (!string.IsNullOrEmpty(strDeleteBookChapterUpdateID))
            {
                DeleteData(int.Parse(strDeleteBookChapterUpdateID));
                Grid1.DataBind();
            }
        }
Exemplo n.º 18
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 (PrjPub.HasEditRight("试题管理") && PrjPub.IsServerCenter)                // && PrjPub.CurrentLoginUser.SuitRange == 1
                {
                    HfUpdateRight.Value = "True";
                }
                else
                {
                    HfUpdateRight.Value = "False";
                }
                if (PrjPub.HasDeleteRight("试题管理") && PrjPub.IsServerCenter)                //&& PrjPub.CurrentLoginUser.SuitRange == 1
                {
                    HfDeleteRight.Value = "True";
                }
                else
                {
                    HfDeleteRight.Value = "False";
                }
                HfOrgId.Value = PrjPub.CurrentLoginUser.StationOrgID.ToString();

                if (PrjPub.IsWuhanOnly() && PrjPub.IsServerCenter)
                {
                    btnAddBookItem.Visible = true;
                }
                else
                {
                    btnAddBookItem.Visible = false;
                }

                hfRailSystemId.Value = PrjPub.GetRailSystemId().ToString();
            }


            if (!IsPostBack && !ddlViewChangeCallBack.IsCallback &&
                !treeNodeSelectedCallBack.IsCallback && !itemsGrid.IsCallback)
            {
                BindKnowledgeTree("");
            }
            if (hfIsSearchCommand.Value == "true")
            {
                itemsGrid.CurrentPageIndex = 0;
                itemsGrid.DataBind();
                hfIsSearchCommand.Value = "false";
            }


            if (hfRefresh.Value != "")
            {
                if (PrjPub.IsWuhan())
                {
                    DownloadWord(hfRefresh.Value);
                }
                else
                {
                    DownloadExcel(hfRefresh.Value);
                }
            }

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

            if (!string.IsNullOrEmpty(strRefresh))
            {
                itemsGrid.DataBind();
            }

            if (!string.IsNullOrEmpty(hfPostID.Value))
            {
                PostBLL post = new PostBLL();
                txtPost.Text = post.GetPost(Convert.ToInt32(hfPostID.Value)).PostName;
            }
        }
Exemplo n.º 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;
                }

                if (PrjPub.HasEditRight("角色权限") && PrjPub.IsServerCenter)
                {
                    HfUpdateRight.Value = "True";
                }
                else
                {
                    HfUpdateRight.Value = "False";
                }
                if (PrjPub.HasDeleteRight("角色权限") && PrjPub.IsServerCenter)
                {
                    HfDeleteRight.Value = "True";
                }
                else
                {
                    HfDeleteRight.Value = "False";
                }

                if (PrjPub.HasEditRight("职员管理") && PrjPub.IsServerCenter)
                {
                    HfUpdateRight.Value = "True";
                }
                else
                {
                    HfUpdateRight.Value = "False";
                }
                if (PrjPub.HasDeleteRight("职员管理") && PrjPub.IsServerCenter)
                {
                    HfDeleteRight.Value = "True";
                }
                else
                {
                    HfDeleteRight.Value = "False";
                }

                if (PrjPub.IsWuhan())
                {
                    Grid1.Levels[0].Columns[1].HeadingText = "员工编码";
                    lblTitle.Text = "员工编码";
                }
                else
                {
                    Grid1.Levels[0].Columns[1].HeadingText = "工资编号";
                    lblTitle.Text = "工资编号";
                }

                BindGrid();

                IsWuhan.Value       = PrjPub.IsWuhan().ToString();
                IsWuhanOnly.Value   = PrjPub.IsWuhanOnly().ToString();
                hfAdmin.Value       = PrjPub.CurrentLoginUser.IsAdmin.ToString();
                NowEmployeeID.Value = PrjPub.CurrentLoginUser.EmployeeID.ToString();
            }
            else
            {
                string strDeleteID = Request.Form.Get("DeleteID");
                if (!string.IsNullOrEmpty(strDeleteID))
                {
                    if (strDeleteID == "1" || strDeleteID == "2")
                    {
                        SessionSet.PageMessage = "该员工为最高权限用户,不能被删除!";
                        BindGrid();
                        return;
                    }
                    DeleteData(int.Parse(strDeleteID));
                    BindGrid();
                }

                string strRefresh = Request.Form.Get("Refresh");
                if (strRefresh == "true")
                {
                    BindGrid();
                }
                string strUpdate = Request.Form.Get("UpdatePsw");
                if (!string.IsNullOrEmpty(strUpdate))
                {
                    SystemUserBLL objBll = new SystemUserBLL();
                    SystemUser    obj    = objBll.GetUserByEmployeeID(Convert.ToInt32(strUpdate));
                    if (obj != null)
                    {
                        obj.Password = "******";
                        if (PrjPub.IsServerCenter)
                        {
                            objBll.UpdateUser(obj);
                        }
                        else
                        {
                            objBll.UpdateUserPsw(obj.UserID, "111111");
                        }
                        SessionSet.PageMessage = "初始化密码成功!";
                    }
                    else
                    {
                        SessionSet.PageMessage = "该员工登录帐户不存在,初始化密码失败!";
                    }
                    BindGrid();
                }
            }
        }