示例#1
0
        private DataTable GetEmpByClassID(int classID)
        {
            OracleAccess access = new OracleAccess();

            return(access.RunSqlDataSet(" select employee_id from zj_train_plan_employee where train_class_id=" + classID).Tables[0]);
        }
        protected void btnInput_Click(object sender, EventArgs e)
        {
            if (ViewState["EmptyFlag"].ToString() != null && ViewState["EmptyFlag"].ToString() == "1")
            {
                return;
            }

            string strId    = Request.QueryString.Get("id");
            string strAllId = hfrbnID.Value;
            IList <RailExam.Model.Employee> Employees = null;
            EmployeeBLL psBLL = new EmployeeBLL();

            Employees = psBLL.GetEmployeesSelect(Convert.ToInt32(ddlOrg.SelectedValue), ViewState["PinYin"].ToString(), ViewState["WorkNo"].ToString(), ViewState["EmployeeName"].ToString(), "a.employee_Name");

            for (int i = 0; i < Employees.Count; i++)
            {
                string strEmId     = Employees[i].EmployeeID.ToString();
                string strOldAllId = strAllId;
                if (strOldAllId == strEmId)
                {
                    strAllId = strEmId;
                }
            }

            ViewState["ChooseId"] = strAllId;

            if (strAllId == "")
            {
                SessionSet.PageMessage = "请选择考生!";
                return;
            }
            else
            {
                RandomExamBLL             objBll = new RandomExamBLL();
                RailExam.Model.RandomExam random = objBll.GetExam(int.Parse(strId));

                if (random.RandomExamModularTypeID > 1)
                {
                    OracleAccess db     = new OracleAccess();
                    string       strSql = "select * from Random_Exam_Modular_Type where Random_Exam_Modular_Type_ID=" +
                                          random.RandomExamModularTypeID;
                    DataRow dr = db.RunSqlDataSet(strSql).Tables[0].Rows[0];

                    strSql = "select * from Random_Exam_Modular_Type where Level_Num=" +
                             (Convert.ToInt32(dr["Level_NUM"]) - 1);
                    DataRow drPre = db.RunSqlDataSet(strSql).Tables[0].Rows[0];

                    strSql = " select a.* "
                             + "from Random_Exam_Result a "
                             + " inner join Random_Exam b on a.Random_Exam_ID=b.Random_Exam_ID "
                             +
                             " left join Random_Exam_Modular_Type c on b.Random_Exam_Modular_Type_ID=c.Random_Exam_Modular_Type_ID "
                             + " where c.Level_Num=" + (Convert.ToInt32(dr["Level_NUM"]) - 1);
                    DataSet ds = db.RunSqlDataSet(strSql);

                    strSql = "select * from Employee where Employee_ID = " + strAllId;
                    DataRow drEmp = db.RunSqlDataSet(strSql).Tables[0].Rows[0];

                    string strErrorMessage = string.Empty;

                    DataRow[] drs = ds.Tables[0].Select("EXAMINEE_ID=" + strAllId);

                    if (drs.Length == 0)
                    {
                        strErrorMessage = "所选考生【" + drEmp["Employee_Name"] + "】未能通过【" +
                                          drPre["Random_Exam_Modular_Type_Name"] + "】考试,不能参加【" +
                                          dr["Random_Exam_Modular_Type_Name"] + "】考试!";
                    }


                    if (!string.IsNullOrEmpty(strErrorMessage))
                    {
                        SessionSet.PageMessage = strErrorMessage;
                        return;
                    }
                }
            }

            if (ViewState["UpdateMode"] != null && ViewState["UpdateMode"].ToString() == "0")
            {
                RandomExamArrangeBLL      examArrangeBLL = new RandomExamArrangeBLL();
                IList <RandomExamArrange> objList        = examArrangeBLL.GetRandomExamArranges(int.Parse(strId));

                if (objList.Count == 0)
                {
                    RandomExamArrange examArrange = new RandomExamArrange();
                    examArrange.RandomExamId = int.Parse(strId);
                    examArrange.UserIds      = strAllId;
                    examArrange.Memo         = "";
                    examArrangeBLL.AddRandomExamArrange(examArrange);
                    ViewState["UpdateMode"] = 1;
                    if (txtWorkNo.Text != "")
                    {
                        txtWorkNo.Text = "";
                        txtWorkNo.Focus();
                    }
                    if (txtPinYin.Text != "")
                    {
                        txtPinYin.Text = "";
                        txtPinYin.Focus();
                    }
                    if (txtEmployeeName.Text != "")
                    {
                        txtEmployeeName.Text = "";
                        txtEmployeeName.Focus();
                    }
                    BindEmptyGrid1();
                    SessionSet.PageMessage = "添加成功!";
                    return;
                }
                else
                {
                    ViewState["UpdateMode"] = "1";
                }
            }

            if (ViewState["UpdateMode"] != null && ViewState["UpdateMode"].ToString() == "1")
            {
                RandomExamArrangeBLL examArrangeBLL = new RandomExamArrangeBLL();
                string strEndId = examArrangeBLL.GetRandomExamArranges(int.Parse(strId))[0].UserIds;

                if (("," + strEndId + ",").IndexOf("," + strAllId + ",") >= 0)
                {
                    SessionSet.PageMessage = "该学员已添加!";
                    return;
                }

                if (strEndId == "")
                {
                    examArrangeBLL.UpdateRandomExamArrange(int.Parse(strId), strAllId);
                }
                else
                {
                    examArrangeBLL.UpdateRandomExamArrange(int.Parse(strId), strEndId + "," + strAllId);
                }

                if (txtWorkNo.Text != "")
                {
                    txtWorkNo.Text = "";
                    txtWorkNo.Focus();
                }
                if (txtPinYin.Text != "")
                {
                    txtPinYin.Text = "";
                    txtPinYin.Focus();
                }
                if (txtEmployeeName.Text != "")
                {
                    txtEmployeeName.Text = "";
                    txtEmployeeName.Focus();
                }
                BindEmptyGrid1();
                SessionSet.PageMessage = "添加成功!";

                ClientScript.RegisterClientScriptBlock(GetType(), "", " window.opener.form1.Refresh.value = 'true',window.opener.form1.submit();", true);
                return;
            }
        }
        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.RoleID == 123 || PrjPub.CurrentLoginUser.RoleID == 1))//&& PrjPub.CurrentLoginUser.SuitRange == 1
                {
                    HfUpdateRight.Value = "True";
                }
                else
                {
                    HfUpdateRight.Value = "False";
                }
                if (PrjPub.HasDeleteRight("资料管理") && PrjPub.IsServerCenter && (PrjPub.CurrentLoginUser.RoleID == 123 || PrjPub.CurrentLoginUser.RoleID == 1))//&& PrjPub.CurrentLoginUser.SuitRange == 1
                {
                    HfDeleteRight.Value = "True";
                }
                else
                {
                    HfDeleteRight.Value = "False";
                }

                HfOrgId.Value = PrjPub.CurrentLoginUser.StationOrgID.ToString();

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

                BindGrid();
            }
            else
            {
                if (Request.Form.Get("Refresh") == "true")
                {
                    BindGrid();
                }
            }

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

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

            string strUpID = Request.Form.Get("UpID");

            if (strUpID != null && strUpID != "")
            {
                OracleAccess db = new OracleAccess();
                if (Request.QueryString.Get("id") != null)
                {
                    string strSql = "select * from Information where System_Order_Index<"
                                    + "(select System_Order_Index from Information where  Information_ID=" + strUpID + ")"
                                    + " and Information_System_ID=" + Request.QueryString.Get("id");
                    //在当前领域下存在比上移资料顺序小的资料
                    if (db.RunSqlDataSet(strSql).Tables[0].Rows.Count > 0)
                    {
                        //将当前领域下位置在前的资料顺序+1
                        strSql =
                            "update Information set System_Order_Index=System_Order_Index+1 where System_Order_Index="
                            + "(select System_Order_Index from Information where  Information_ID=" + strUpID + ")-1 "
                            + " and Information_System_ID=" + Request.QueryString.Get("id");
                        db.ExecuteNonQuery(strSql);

                        //将上移资料顺序-1
                        strSql = "update Information set System_Order_Index=System_Order_Index-1 where Information_ID=" + strUpID;
                        db.ExecuteNonQuery(strSql);
                    }
                }

                if (Request.QueryString.Get("id1") != null)
                {
                    string strSql = "select * from Information where Level_Order_Index<"
                                    + "(select Level_Order_Index from Information where  Information_ID=" + strUpID + ")"
                                    + " and Information_Level_ID=" + Request.QueryString.Get("id1");
                    //在当前等级下存在比上移资料顺序小的资料
                    if (db.RunSqlDataSet(strSql).Tables[0].Rows.Count > 0)
                    {
                        //将当前等级下位置在前的资料顺序+1
                        strSql =
                            "update Information set Level_Order_Index=Level_Order_Index+1 where Level_Order_Index="
                            + "(select Level_Order_Index from Information where  Information_ID=" + strUpID + ")-1 "
                            + " and Information_Level_ID=" + Request.QueryString.Get("id1");
                        db.ExecuteNonQuery(strSql);

                        //将上移资料顺序-1
                        strSql = "update Information set Level_Order_Index=Level_Order_Index-1 where Information_ID=" +
                                 strUpID;
                        db.ExecuteNonQuery(strSql);
                    }
                }
                BindGrid();
            }

            string strDownID = Request.Form.Get("DownID");

            if (strDownID != null && strDownID != "")
            {
                OracleAccess db = new OracleAccess();
                if (Request.QueryString.Get("id") != null)
                {
                    string strSql = "select * from Information where System_Order_Index>"
                                    + "(select System_Order_Index from Information where  Information_ID=" + strDownID + ")"
                                    + " and Information_System_ID=" + Request.QueryString.Get("id");
                    //在当前领域下存在比上移资料顺序大的资料
                    if (db.RunSqlDataSet(strSql).Tables[0].Rows.Count > 0)
                    {
                        //将当前领域下位置在前的资料顺序-1
                        strSql =
                            "update Information set System_Order_Index=System_Order_Index-1 where System_Order_Index="
                            + "(select System_Order_Index from Information where  Information_ID=" + strDownID + ")+1 "
                            + " and Information_System_ID=" + Request.QueryString.Get("id");
                        db.ExecuteNonQuery(strSql);

                        //将上移资料顺序+1
                        strSql =
                            "update Information set System_Order_Index=System_Order_Index+1 where Information_ID=" + strDownID;
                        db.ExecuteNonQuery(strSql);
                    }
                }

                if (Request.QueryString.Get("id1") != null)
                {
                    string strSql = "select * from Information where Level_Order_Index>"
                                    + "(select Level_Order_Index from Information where  Information_ID=" + strDownID + ")"
                                    + " and Information_Level_ID=" + Request.QueryString.Get("id1");
                    //在当前等级下存在比上移资料顺序小的资料
                    if (db.RunSqlDataSet(strSql).Tables[0].Rows.Count > 0)
                    {
                        //将当前等级下位置在前的资料顺序-1
                        strSql =
                            "update Information set Level_Order_Index=Level_Order_Index-1 where Level_Order_Index="
                            + "(select Level_Order_Index from Information where  Information_ID=" + strDownID + ")+1 "
                            + " and Information_Level_ID=" + Request.QueryString.Get("id1");
                        db.ExecuteNonQuery(strSql);

                        //将上移资料顺序+1
                        strSql = "update Information set Level_Order_Index=Level_Order_Index+1 where Information_ID=" + strDownID;
                        db.ExecuteNonQuery(strSql);
                    }
                }
                BindGrid();
            }

            string strRefreshDown = Request.Form.Get("RefreshDown");

            if (strRefreshDown != null && strRefreshDown != "")
            {
                if (!DownloadBook(strRefreshDown))
                {
                    SessionSet.PageMessage = "当前资料不存在电子版资料!";
                    BindGrid();
                    return;
                }
                BindGrid();
            }
        }
示例#4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //if (PrjPub.IsWuhan())
                //{
                //    gradesGrid.Levels[0].Columns[3].HeadingText = "员工编码";
                //    lblWorkNo.Text = "上岗证号";
                //}
                //else
                //{
                //    gradesGrid.Levels[0].Columns[3].HeadingText = "工资编号";
                //    lblWorkNo.Text = "工资编号";
                //}

                hfRoleID.Value = PrjPub.CurrentLoginUser.RoleID.ToString();

                if (PrjPub.HasEditRight("成绩查询"))
                {
                    HfUpdateRight.Value = "True";
                }
                else
                {
                    HfUpdateRight.Value = "False";
                }

                if (!PrjPub.IsServerCenter)
                {
                    btnExam.Visible = false;
                }

                lblWorkNo.Text = "上岗证号";

                hfOrganizationId.Value = ConfigurationManager.AppSettings["StationID"].ToString();

                string qsExamId = Request.QueryString.Get("eid");
                int    orgID    = Convert.ToInt32(Request.QueryString.Get("OrgID"));

                string  OrganizationName = "";
                string  strExamineeName  = "";
                decimal dScoreLower      = 0;
                decimal dScoreUpper      = 1000;

                IList <RandomExamResult> examResults   = null;
                RandomExamResultBLL      bllExamResult = new RandomExamResultBLL();
                string       strSql = "";
                OracleAccess db     = new OracleAccess();

                //examResults = bllExamResult.GetRandomExamResults(Convert.ToInt32(qsExamId), OrganizationName,string.Empty,
                //                                                 strExamineeName, string.Empty, dScoreLower,
                //                                                 dScoreUpper, Convert.ToInt32(orgID));


                RandomExamBLL             objBll  = new RandomExamBLL();
                RailExam.Model.RandomExam objExam = objBll.GetExam(Convert.ToInt32(qsExamId));

                RandomExamArrangeBLL      objArrangebll  = new RandomExamArrangeBLL();
                IList <RandomExamArrange> objArrangeList = objArrangebll.GetRandomExamArranges(Convert.ToInt32(qsExamId));
                string strChooseID = string.Empty;
                if (objArrangeList.Count > 0)
                {
                    if (PrjPub.IsServerCenter && orgID == objExam.OrgId)
                    {
                        strChooseID = objArrangeList[0].UserIds;
                        int         count          = 0;
                        EmployeeBLL objEmployeeBll = new EmployeeBLL();
                        string[]    str            = strChooseID.Split(',');
                        for (int i = 0; i < str.Length; i++)
                        {
                            if (str[i] == string.Empty)
                            {
                                continue;
                            }

                            Employee employee = objEmployeeBll.GetChooseEmployeeInfo(str[i]);
                            if (employee.EmployeeID == 0)
                            {
                                continue;
                            }

                            count++;
                        }
                        lblMaxCount.Text = count.ToString();
                    }
                    else if (PrjPub.IsServerCenter && orgID != objExam.OrgId)
                    {
                        string[] strEmployee = objArrangeList[0].UserIds.Split(',');

                        OrganizationBLL orgBll      = new OrganizationBLL();
                        EmployeeBLL     employeeBll = new EmployeeBLL();
                        int             count       = 0;
                        for (int i = 0; i < strEmployee.Length; i++)
                        {
                            Employee employee     = employeeBll.GetChooseEmployeeInfo(strEmployee[i]);
                            int      stationOrgID = orgBll.GetStationOrgID(employee.OrgID);

                            if (stationOrgID == orgID)
                            {
                                count++;
                            }
                        }
                        lblMaxCount.Text = count.ToString();
                    }
                    else
                    {
                        strSql = "select a.* from Random_Exam_Arrange_Detail a "
                                 + " inner join Computer_Room b on a.Computer_Room_ID=b.Computer_Room_ID "
                                 + " inner join Computer_Server c on b.Computer_Server_ID=c.Computer_Server_ID "
                                 + " where c.Computer_Server_No='" + PrjPub.ServerNo + "'"
                                 + " and a.Random_Exam_ID=" + qsExamId;

                        DataSet dsArrange = db.RunSqlDataSet(strSql);
                        foreach (DataRow dr in dsArrange.Tables[0].Rows)
                        {
                            if (strChooseID == string.Empty)
                            {
                                strChooseID = dr["User_Ids"].ToString();
                            }
                            else
                            {
                                strChooseID += "," + dr["User_Ids"].ToString();
                            }
                        }

                        int         count          = 0;
                        EmployeeBLL objEmployeeBll = new EmployeeBLL();
                        string[]    str            = strChooseID.Split(',');
                        for (int i = 0; i < str.Length; i++)
                        {
                            if (str[i] == string.Empty)
                            {
                                continue;
                            }

                            Employee employee = objEmployeeBll.GetChooseEmployeeInfo(str[i]);
                            if (employee.EmployeeID == 0)
                            {
                                continue;
                            }

                            count++;
                        }
                        lblMaxCount.Text = count.ToString();
                    }
                }


                DataSet ds = GetDataSet(true);
                if (ds != null && ds.Tables.Count == 2)
                {
                    //foreach (DataRow dr in ds.Tables[0].Rows)
                    //{
                    //    if(dr["OrganizationId"].ToString() != hfOrganizationId.Value)
                    //    {
                    //        btnOutPutWord.Enabled = false;
                    //        break;
                    //    }
                    //}

                    gradesGrid.DataSource = ds;
                    gradesGrid.DataBind();
                    BindGrid();
                }
                else
                {
                    SessionSet.PageMessage = "数据错误!";
                    return;
                }
                hfIsServer.Value = PrjPub.IsServerCenter.ToString();

                //当是路局服务器时,屏蔽上传按钮
                if (PrjPub.IsServerCenter)
                {
                    btnUpload.Visible = false;
                }
            }
            else
            {
                if (Request.Form.Get("OutPut") != null && Request.Form.Get("OutPut") != "")
                {
                    OutputWord(Request.Form.Get("OutPut"));
                }
                if (Request.Form.Get("Refresh") != null && Request.Form.Get("Refresh") != "")
                {
                    DownloadAll(Request.Form.Get("Refresh"));
                }

                if (Request.Form.Get("RefreshExcel") != null && Request.Form.Get("RefreshExcel") != "")
                {
                    DownloadExcel();
                }

                if (Request.Form.Get("IsUpload") != null && Request.Form.Get("IsUpload") != "")
                {
                    DataSet ds = GetDataSet(false);
                    gradesGrid.DataSource = ds;
                    gradesGrid.DataBind();
                    BindGrid();
                    //string strId = Request.QueryString.Get("eid");
                    //RandomExamBLL objBll = new RandomExamBLL();
                    //RailExam.Model.RandomExam obj = objBll.GetExam(Convert.ToInt32(strId));
                    //SystemLogBLL objLogBll = new SystemLogBLL();
                    //objLogBll.WriteLog("“" + obj.ExamName + "”上传考试成绩和答卷");
                    SessionSet.PageMessage = "上传成功!";
                }

                if (Request.Form.Get("RefreshList") != null && Request.Form.Get("RefreshList") != "")
                {
                    DataSet ds = GetDataSet(false);
                    gradesGrid.DataSource = ds;
                    gradesGrid.DataBind();
                    BindGrid();
                }
            }
            btnUpload.Visible = false;     // 包神这里用不著上传 2014-03-18
        }
        protected void Grid_RowCreated(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.Header)
            {
                TableCellCollection tcl = e.Row.Cells;
                tcl.Clear();
                tcl.Add(new TableHeaderCell());
                tcl[0].Text    = "序号";
                tcl[0].Wrap    = false;
                tcl[0].RowSpan = 3;

                tcl.Add(new TableHeaderCell());
                tcl[1].Text    = "单位";
                tcl[1].Wrap    = false;
                tcl[1].RowSpan = 3;

                OracleAccess access = new OracleAccess();
                string       strSql = "select a.* from ZJ_CERTIFICATE_LEVEL a "
                                      + "inner join ZJ_CERTIFICATE c on a.CERTIFICATE_ID=c.CERTIFICATE_ID "
                                      + " order by c.CERTIFICATE_ID,a.ORDER_INDEX";
                DataTable dtLevel = access.RunSqlDataSet(strSql).Tables[0];

                strSql = "select * from  ZJ_CERTIFICATE order by CERTIFICATE_ID";
                DataTable dt = access.RunSqlDataSet(strSql).Tables[0];

                tcl.Add(new TableHeaderCell());
                tcl[2].Text       = "证书名称</th></tr>";
                tcl[2].Wrap       = false;
                tcl[2].ColumnSpan = dtLevel.Rows.Count + 1;

                tcl.Add(new TableHeaderCell());
                tcl[3].Text    = "合计";
                tcl[3].Wrap    = false;
                tcl[3].RowSpan = 2;

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    tcl.Add(new TableHeaderCell());
                    if (i + 1 == dt.Rows.Count)
                    {
                        tcl[4 + i].Text = dt.Rows[i]["CERTIFICATE_NAME"] + "</th></tr>";
                    }
                    else
                    {
                        tcl[4 + i].Text = dt.Rows[i]["CERTIFICATE_NAME"].ToString();
                    }
                    tcl[4 + i].Wrap = false;

                    DataRow[] drs = dtLevel.Select("CERTIFICATE_ID=" + dt.Rows[i]["CERTIFICATE_ID"]);

                    tcl[4 + i].ColumnSpan = drs.Length;
                }

                int index = 3 + dt.Rows.Count + 1;

                for (int i = 0; i < dtLevel.Rows.Count; i++)
                {
                    tcl.Add(new TableHeaderCell());
                    if (i + 1 == dtLevel.Rows.Count)
                    {
                        tcl[index + i].Text = dtLevel.Rows[i]["CERTIFICATE_Level_NAME"] + "</th></tr>";
                    }
                    else
                    {
                        tcl[index + i].Text = dtLevel.Rows[i]["CERTIFICATE_Level_NAME"].ToString();
                    }
                    tcl[index + i].Wrap = false;
                }
            }


            if (e.Row.RowType == DataControlRowType.Header)
            {
                e.Row.Attributes.Add("class", "HeadingRow");
            }

            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.Attributes.Add("onclick", "selectCol(this)");
            }
        }
示例#6
0
 /// <summary>
 /// 下移
 /// </summary>
 /// <param name="editDownID"></param>
 protected void DownData(string editDownID)
 {
     if (OrgList.SelectedIndex == 0)
     {
         EducationLevelBLL objBll            = new EducationLevelBLL();
         EducationLevel    objEducationLevel = objBll.GetEducationLevelByEducationLevelID(Convert.ToInt32(editDownID));
         objEducationLevel.OrderIndex = objEducationLevel.OrderIndex + 1;
         objBll.UpdateEducationLevel(objEducationLevel);
         BindGrid(OrgList.SelectedIndex);
     }
     else if (OrgList.SelectedIndex == 1)
     {
         PoliticalStatusBLL objBll = new PoliticalStatusBLL();
         PoliticalStatus    obj    = objBll.GetPoliticalStatusByPoliticalStatusID(Convert.ToInt32(editDownID));
         obj.OrderIndex = obj.OrderIndex + 1;
         objBll.UpdatePoliticalStatus(obj);
         BindGrid(OrgList.SelectedIndex);
     }
     else if (OrgList.SelectedIndex == 2)
     {
         WorkGroupLeaderLevelBLL objBll = new WorkGroupLeaderLevelBLL();
         WorkGroupLeaderLevel    obj    = objBll.GetWorkGroupLeaderLevelByWorkGroupLeaderLevelID(Convert.ToInt32(editDownID));
         obj.OrderIndex = obj.OrderIndex + 1;
         objBll.UpdateWorkGroupLeaderLevel(obj);
         BindGrid(OrgList.SelectedIndex);
     }
     else if (OrgList.SelectedIndex == 4)
     {
         TechnicianTitleTypeBLL objBll = new TechnicianTitleTypeBLL();
         TechnicianTitleType    obj    = objBll.GetTechnicianTitleTypeByTechnicianTitleTypeID(Convert.ToInt32(editDownID));
         obj.OrderIndex = obj.OrderIndex + 1;
         objBll.UpdateTechnicianTitleType(obj);
         BindGrid(OrgList.SelectedIndex);
     }
     else if (OrgList.SelectedIndex == 7)
     {
         RandomExamModularTypeBLL objBll = new RandomExamModularTypeBLL();
         RandomExamModularType    obj    = objBll.GetRandomExamModularTypeByTypeID(Convert.ToInt32(editDownID));
         obj.LevelNum = obj.LevelNum + 1;
         objBll.UpdateRandomExamModularType(obj);
         BindGrid(OrgList.SelectedIndex);
     }
     else if (OrgList.SelectedIndex == 9)
     {
         try
         {
             OracleAccess access = new OracleAccess();
             DataTable    dt     = access.RunSqlDataSet("select * from zj_safe_level where safe_level_id=" + editDownID).Tables[0];
             int          index  = Convert.ToInt32(dt.Rows[0]["order_index"]) + 1;
             access.ExecuteNonQuery(" update zj_safe_level set order_index=order_index-1 where order_index=" + index);
             access.ExecuteNonQuery("update zj_safe_level set order_index=" + index + " where safe_level_id=" + editDownID);
             BindGrid(OrgList.SelectedIndex);
         }
         catch
         {
         }
     }
     else if (OrgList.SelectedIndex == 10)
     {
         try
         {
             OracleAccess access = new OracleAccess();
             DataTable    dt     = access.RunSqlDataSet("select * from zj_certificate where certificate_id=" + editDownID).Tables[0];
             int          index  = Convert.ToInt32(dt.Rows[0]["order_index"]) + 1;
             access.ExecuteNonQuery(" update zj_certificate set order_index=order_index-1 where order_index=" + index);
             access.ExecuteNonQuery("update zj_certificate set order_index=" + index + " where certificate_id=" + editDownID);
             BindGrid(OrgList.SelectedIndex);
         }
         catch
         {
         }
     }
     else if (OrgList.SelectedIndex == 11)
     {
         try
         {
             OracleAccess access = new OracleAccess();
             DataTable    dt     = access.RunSqlDataSet("select * from zj_certificate_level where certificate_level_id=" + editDownID).Tables[0];
             int          index  = Convert.ToInt32(dt.Rows[0]["order_index"]) + 1;
             access.ExecuteNonQuery(" update zj_certificate_level set order_index=order_index-1 where order_index=" + index);
             access.ExecuteNonQuery("update zj_certificate_level set order_index=" + index + " where certificate_level_id=" + editDownID);
             BindGrid(OrgList.SelectedIndex);
         }
         catch
         {
         }
     }
     else if (OrgList.SelectedIndex == 12)
     {
         try
         {
             OracleAccess access = new OracleAccess();
             DataTable    dt     = access.RunSqlDataSet("select * from zj_certificate_unit where certificate_unit_id=" + editDownID).Tables[0];
             int          index  = Convert.ToInt32(dt.Rows[0]["order_index"]) + 1;
             access.ExecuteNonQuery(" update zj_certificate_unit set order_index=order_index-1 where order_index=" + index);
             access.ExecuteNonQuery("update zj_certificate_unit set order_index=" + index + " where certificate_unit_id=" + editDownID);
             BindGrid(OrgList.SelectedIndex);
         }
         catch
         {
         }
     }
     else if (OrgList.SelectedIndex == 13)
     {
         try
         {
             OracleAccess access = new OracleAccess();
             DataTable    dt     = access.RunSqlDataSet("select * from zj_train_unit where train_unit_id=" + editDownID).Tables[0];
             int          index  = Convert.ToInt32(dt.Rows[0]["order_index"]) + 1;
             access.ExecuteNonQuery(" update zj_train_unit set order_index=order_index-1 where order_index=" + index);
             access.ExecuteNonQuery("update zj_train_unit set order_index=" + index + " where train_unit_id=" + editDownID);
             BindGrid(OrgList.SelectedIndex);
         }
         catch
         {
         }
     }
 }
示例#7
0
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="strLogID"></param>
        protected void DeleteData(string strLogID)
        {
            EmployeeDetailBLL employeeDetailBLL = new EmployeeDetailBLL();

            if (OrgList.SelectedIndex == 0)
            {
                if (employeeDetailBLL.GetEmployeeByWhere("Education_Level_ID=" + strLogID) > 0)
                {
                    hfMessage.Value = "该数据字典已被引用,不能删除!";
                    BindGrid(OrgList.SelectedIndex);
                    return;
                }
                EducationLevelBLL objBll        = new EducationLevelBLL();
                string            educationName = objBll.GetEducationLevelByEducationLevelID(Convert.ToInt32(strLogID)).EducationLevelName;
                objBll.DeleteEducationLevel(Convert.ToInt32(strLogID), "");
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("删除" + OrgList.Items[0].Text + ":" + educationName);
                BindGrid(OrgList.SelectedIndex);
            }
            if (OrgList.SelectedIndex == 1)
            {
                if (employeeDetailBLL.GetEmployeeByWhere("POLITICAL_STATUS_ID=" + strLogID) > 0)
                {
                    hfMessage.Value = "该数据字典已被引用,不能删除!";
                    BindGrid(OrgList.SelectedIndex);
                    return;
                }
                PoliticalStatusBLL objBll        = new PoliticalStatusBLL();
                string             politicalName = objBll.GetPoliticalStatusByPoliticalStatusID(Convert.ToInt32(strLogID)).PoliticalStatusName;
                objBll.DeletePoliticalStatus(Convert.ToInt32(strLogID));
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("删除" + OrgList.Items[1].Text + ":" + politicalName);
                BindGrid(OrgList.SelectedIndex);
            }
            if (OrgList.SelectedIndex == 2)
            {
                if (employeeDetailBLL.GetEmployeeByWhere("workgroupleader_type_id=" + strLogID) > 0)
                {
                    hfMessage.Value = "该数据字典已被引用,不能删除!";
                    BindGrid(OrgList.SelectedIndex);
                    return;
                }
                WorkGroupLeaderLevelBLL objBll = new WorkGroupLeaderLevelBLL();
                string wrokgroupName           = objBll.GetWorkGroupLeaderLevelByWorkGroupLeaderLevelID(Convert.ToInt32(strLogID)).LevelName;
                objBll.DeleteWorkGroupLeaderLevel(Convert.ToInt32(strLogID));
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("删除" + OrgList.Items[2].Text + ":" + wrokgroupName);
                BindGrid(OrgList.SelectedIndex);
            }
            if (OrgList.SelectedIndex == 3)
            {
                if (employeeDetailBLL.GetEmployeeByWhere("TECHNICIAN_TYPE_ID=" + strLogID) > 0)
                {
                    hfMessage.Value = "该数据字典已被引用,不能删除!";
                    BindGrid(OrgList.SelectedIndex);
                    return;
                }
                TechnicianTypeBLL objBll         = new TechnicianTypeBLL();
                string            technicianName = objBll.GetTechnicianTypeByTechnicianTypeID(Convert.ToInt32(strLogID)).TypeName;
                objBll.DeleteTechnicianType(Convert.ToInt32(strLogID), "");
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("删除" + OrgList.Items[3].Text + ":" + technicianName);
                BindGrid(OrgList.SelectedIndex);
            }
            if (OrgList.SelectedIndex == 4)
            {
                if (employeeDetailBLL.GetEmployeeByWhere("TECHNICAL_TITLE_ID=" + strLogID) > 0)
                {
                    hfMessage.Value = "该数据字典已被引用,不能删除!";
                    BindGrid(OrgList.SelectedIndex);
                    return;
                }

                TechnicianTitleTypeBLL objBll = new TechnicianTitleTypeBLL();
                string technicianTitleName    =
                    objBll.GetTechnicianTitleTypeByTechnicianTitleTypeID(Convert.ToInt32(strLogID)).TypeName;
                objBll.DeleteTechnicianTitleType(Convert.ToInt32(strLogID));
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("删除" + OrgList.Items[4].Text + ":" + technicianTitleName);
                BindGrid(OrgList.SelectedIndex);
            }
            if (OrgList.SelectedIndex == 5)
            {
                if (employeeDetailBLL.GetEmployeeByWhere("education_employee_type_id=" + strLogID) > 0)
                {
                    hfMessage.Value = "该数据字典已被引用,不能删除!";
                    BindGrid(OrgList.SelectedIndex);
                    return;
                }
                EducationEmployeeTypeBLL objBll = new EducationEmployeeTypeBLL();
                string technicianTitleName      =
                    objBll.GetEducationEmployeeTypeByEducationEmployeeTypeID(Convert.ToInt32(strLogID)).TypeName;
                objBll.DeleteEducationEmployeeType(Convert.ToInt32(strLogID));
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("删除" + OrgList.Items[5].Text + ":" + technicianTitleName);
                BindGrid(OrgList.SelectedIndex);
            }
            if (OrgList.SelectedIndex == 6)
            {
                if (employeeDetailBLL.GetEmployeeByWhere("committee_head_ship_id=" + strLogID) > 0)
                {
                    hfMessage.Value = "该数据字典已被引用,不能删除!";
                    BindGrid(OrgList.SelectedIndex);
                    return;
                }
                CommitteeHeadShipBLL objBll = new CommitteeHeadShipBLL();
                string ShipName             =
                    objBll.GetCommitteeHeadShipByCommitteeHeadShipID(Convert.ToInt32(strLogID)).CommitteeHeadShipName;
                objBll.DeleteCommitteeHeadShip(Convert.ToInt32(strLogID));
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("删除" + OrgList.Items[6].Text + ":" + ShipName);
                BindGrid(OrgList.SelectedIndex);
            }
            if (OrgList.SelectedIndex == 7)
            {
                RandomExamModularTypeBLL objBll = new RandomExamModularTypeBLL();
                if (objBll.GetRandomExam(Convert.ToInt32(strLogID)) > 0)
                {
                    hfMessage.Value = "该数据字典已被引用,不能删除!";
                    BindGrid(OrgList.SelectedIndex);
                    return;
                }
                string TypeName =
                    objBll.GetRandomExamModularTypeByTypeID(Convert.ToInt32(strLogID)).RandomExamModularTypeName;
                objBll.DeleteCommitteeHeadShip(Convert.ToInt32(strLogID));
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("删除" + OrgList.Items[7].Text + ":" + TypeName);
                BindGrid(OrgList.SelectedIndex);
            }
            if (OrgList.SelectedIndex == 8)
            {
                OracleAccess oracle = new OracleAccess();
                DataTable    dt     =
                    oracle.RunSqlDataSet(
                        string.Format(" select * from zj_train_plan where train_plan_type_id={0}",
                                      Convert.ToInt32(strLogID))).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    hfMessage.Value = "该数据字典已被引用,不能删除!";
                    BindGrid(OrgList.SelectedIndex);
                    return;
                }
                string TypeName =
                    oracle.RunSqlDataSet(
                        string.Format("select trainplan_type_name from zj_trainplan_type where trainplan_type_id={0}",
                                      Convert.ToInt32(strLogID))).Tables[0].Rows[0]["trainplan_type_name"].ToString();
                oracle.ExecuteNonQuery(string.Format("delete from zj_trainplan_type  where trainplan_type_id={0}",
                                                     Convert.ToInt32(strLogID)));
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("删除" + OrgList.Items[8].Text + ":" + TypeName);
                BindGrid(OrgList.SelectedIndex);
            }
            if (OrgList.SelectedIndex == 9)
            {
                OracleAccess access = new OracleAccess();
                DataTable    dt     = access.RunSqlDataSet("select count(1) from employee where safe_level_id=" + strLogID).Tables[0];
                if (Convert.ToInt32(dt.Rows[0][0]) > 0)
                {
                    hfMessage.Value = "该数据字典已被引用,不能删除!";
                    BindGrid(OrgList.SelectedIndex);
                    return;
                }
                string    sql = "select safe_level_name from zj_safe_level where safe_level_id=" + strLogID;
                DataTable dt1 = access.RunSqlDataSet(sql).Tables[0];
                try
                {
                    access.ExecuteNonQuery(@"
                                           update zj_safe_level set order_index=order_index-1 where order_index>
                                          (select order_index from zj_safe_level where  safe_level_id=" + strLogID + ")");
                    access.ExecuteNonQuery("delete from zj_safe_level where safe_level_id=" + strLogID);
                }
                catch
                {
                    hfMessage.Value = "该数据字典已被引用,不能删除!";
                    BindGrid(OrgList.SelectedIndex);
                    return;
                }
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("删除" + OrgList.Items[9].Text + ":" + dt1.Rows[0][0]);
                BindGrid(OrgList.SelectedIndex);
            }
            if (OrgList.SelectedIndex == 10)
            {
                OracleAccess access = new OracleAccess();

                string    sql = "select certificate_name from zj_certificate where certificate_id=" + strLogID;
                DataTable dt1 = access.RunSqlDataSet(sql).Tables[0];
                try
                {
                    access.ExecuteNonQuery(
                        @"
                                           update zj_certificate set order_index=order_index-1 where order_index>
                                          (select order_index from zj_certificate where  certificate_id=" +
                        strLogID + ")");
                    access.ExecuteNonQuery("delete from zj_certificate where certificate_id=" + strLogID);
                }
                catch
                {
                    hfMessage.Value = "该数据字典已被引用,不能删除!";
                    BindGrid(OrgList.SelectedIndex);
                    return;
                }
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("删除" + OrgList.Items[10].Text + ":" + dt1.Rows[0][0]);
                BindGrid(OrgList.SelectedIndex);
            }
            if (OrgList.SelectedIndex == 11)
            {
                OracleAccess access = new OracleAccess();

                string    sql = "select certificate_level_name from zj_certificate_level where certificate_level_id=" + strLogID;
                DataTable dt1 = access.RunSqlDataSet(sql).Tables[0];
                try
                {
                    access.ExecuteNonQuery(
                        @"
                                           update zj_certificate_level set order_index=order_index-1 where order_index>
                                          (select order_index from zj_certificate_level where  certificate_level_id=" +
                        strLogID + ")");
                    access.ExecuteNonQuery("delete from zj_certificate_level where certificate_level_id=" + strLogID);
                }
                catch
                {
                    hfMessage.Value = "该数据字典已被引用,不能删除!";
                    BindGrid(OrgList.SelectedIndex);
                    return;
                }
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("删除" + OrgList.Items[11].Text + ":" + dt1.Rows[0][0]);
                BindGrid(OrgList.SelectedIndex);
            }
            if (OrgList.SelectedIndex == 12)
            {
                OracleAccess access = new OracleAccess();

                string    sql = "select certificate_unit_name from zj_certificate_unit where certificate_unit_id=" + strLogID;
                DataTable dt1 = access.RunSqlDataSet(sql).Tables[0];
                try
                {
                    access.ExecuteNonQuery(
                        @"
                                           update zj_certificate_unit set order_index=order_index-1 where order_index>
                                          (select order_index from zj_certificate_unit where  certificate_unit_id=" +
                        strLogID + ")");
                    access.ExecuteNonQuery("delete from zj_certificate_unit where certificate_unit_id=" + strLogID);
                }
                catch
                {
                    hfMessage.Value = "该数据字典已被引用,不能删除!";
                    BindGrid(OrgList.SelectedIndex);
                    return;
                }
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("删除" + OrgList.Items[12].Text + ":" + dt1.Rows[0][0]);
                BindGrid(OrgList.SelectedIndex);
            }
            if (OrgList.SelectedIndex == 13)
            {
                OracleAccess access = new OracleAccess();

                string    sql = "select train_unit_name from zj_train_unit where train_unit_id=" + strLogID;
                DataTable dt1 = access.RunSqlDataSet(sql).Tables[0];
                try
                {
                    access.ExecuteNonQuery(
                        @"
                                           update zj_train_unit set order_index=order_index-1 where order_index>
                                          (select order_index from zj_train_unit where  train_unit_id=" +
                        strLogID + ")");
                    access.ExecuteNonQuery("delete from zj_train_unit where train_unit_id=" + strLogID);
                }
                catch
                {
                    hfMessage.Value = "该数据字典已被引用,不能删除!";
                    BindGrid(OrgList.SelectedIndex);
                    return;
                }
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("删除" + OrgList.Items[13].Text + ":" + dt1.Rows[0][0]);
                BindGrid(OrgList.SelectedIndex);
            }
        }
        private string GetSql()
        {
            StringBuilder sql = new StringBuilder("");

            if (PrjPub.CurrentLoginUser.EmployeeID != 0)
            {
                string str          = "";
                int    railSystemId = PrjPub.GetRailSystemId();
                if (railSystemId != 0)
                {
                    str = " or SPONSOR_UNIT_ID in (select Org_ID from Org where Rail_System_ID=" + railSystemId +
                          " and level_num=2)  or undertake_unit_id in (select Org_ID from Org where Rail_System_ID=" +
                          railSystemId +
                          " and level_num=2) ";

                    string strSql = "select Org_ID from Org where Rail_System_ID=" + railSystemId +
                                    " and level_num=2";
                    OracleAccess db = new OracleAccess();
                    DataSet      ds = db.RunSqlDataSet(strSql);

                    string strOrgIDs = string.Empty;
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        //str += "or  ','|| orgids||',' like '%," + dr["Org_ID"] + ",%'";

                        strOrgIDs += strOrgIDs == string.Empty ? dr["Org_ID"].ToString() : "," + dr["Org_ID"];
                    }

                    str +=
                        @" or Train_Plan_ID in (select distinct b.Train_Plan_ID from ZJ_TRAIN_PLAN_POST_CLASS_ORG a
                        inner join ZJ_TRAIN_PLAN_POST_CLASS b on a.TRAIN_PLAN_POST_CLASS_ID=b.TRAIN_PLAN_POST_CLASS_ID 
                        where a.Org_ID in (" +
                        strOrgIDs + "))";
                }

                // ','|| orgids||',' like '%," + PrjPub.CurrentLoginUser.StationOrgID + ",%'
                sql =
                    new StringBuilder("select * from zj_train_plan_view where (SPONSOR_UNIT_ID=" +
                                      PrjPub.CurrentLoginUser.StationOrgID
                                      + " or undertake_unit_id=" + PrjPub.CurrentLoginUser.StationOrgID + str +
                                      @" or Train_Plan_ID in (select distinct b.Train_Plan_ID from                         ZJ_TRAIN_PLAN_POST_CLASS_ORG a
                        inner join ZJ_TRAIN_PLAN_POST_CLASS b on a.TRAIN_PLAN_POST_CLASS_ID=b.TRAIN_PLAN_POST_CLASS_ID 
                        where a.Org_ID=" +
                                      PrjPub.CurrentLoginUser.StationOrgID + "))");
            }
            else
            {
                sql =
                    new StringBuilder("select * from zj_train_plan_view where 1=1");
            }

            if (ddlOrg.SelectedValue != "0")
            {
                sql.AppendFormat(" and SPONSOR_UNIT_ID={0}", ddlOrg.SelectedValue);
            }

            if (ddlYear.SelectedValue != "--请选择--")
            {
                sql.AppendFormat(" and Year={0}", ddlYear.SelectedValue);
            }
            if (txtTrainPlanName.Text.Length != 0)
            {
                sql.AppendFormat(" and TRAIN_PLAN_NAME like '%{0}%'", txtTrainPlanName.Text);
            }
            if (ddlTrainPlanType.SelectedValue != "--请选择--")
            {
                sql.AppendFormat(" and TRAIN_PLAN_TYPE_ID={0}", ddlTrainPlanType.SelectedValue);
            }
            if (ddlTrainPlanPhase.SelectedValue != "0")
            {
                sql.AppendFormat(" and TRAIN_PLAN_PHASE_ID={0}", ddlTrainPlanPhase.SelectedValue);
            }
            sql.Append("  order by MAKEDATE desc");
            return(sql.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 strInformationId = Request.QueryString.Get("id");
                ViewState["InformationID"] = strInformationId;

                hfMode.Value = Request.QueryString.Get("mode");

                if (!string.IsNullOrEmpty(strInformationId))
                {
                    if (hfMode.Value == "ReadOnly")
                    {
                        SaveButton.Visible     = false;
                        CancelButton.Visible   = true;
                        SaveNextButton.Visible = false;
                        SaveExitButton.Visible = false;
                    }
                    else if (hfMode.Value == "Edit")
                    {
                        btnChapter.Visible     = true;
                        SaveButton.Visible     = true;
                        CancelButton.Visible   = false;
                        SaveExitButton.Visible = false;
                        SaveNextButton.Visible = false;
                    }

                    FillPage(int.Parse(strInformationId));
                }
                else
                {
                    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 (!string.IsNullOrEmpty(strKnowledgeID))
                    {
                        hfKnowledgeID.Value        = strKnowledgeID;
                        ImgSelectKnowledge.Visible = false;
                    }

                    string strTrainTypeID = Request.QueryString.Get("TrainTypeId");
                    if (!string.IsNullOrEmpty(strTrainTypeID))
                    {
                        hfTrainTypeID.Value        = strTrainTypeID;
                        ImgSelectTrainType.Visible = false;
                    }

                    txtCreatePerson.Text = PrjPub.CurrentLoginUser.EmployeeName;
                    hfEmployeeID.Value   = PrjPub.CurrentLoginUser.EmployeeID.ToString();
                    OrganizationBLL org = new OrganizationBLL();
                    txtOrg.Text = org.GetOrganization(PrjPub.CurrentLoginUser.StationOrgID).ShortName;
                }
            }

            OracleAccess oa = new OracleAccess();

            if (!string.IsNullOrEmpty(hfKnowledgeID.Value))
            {
                string  strSql = "select * from Information_System where Information_System_ID=" + hfKnowledgeID.Value;
                DataSet ds     = oa.RunSqlDataSet(strSql);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    txtKnowledgeName.Text = ds.Tables[0].Rows[0]["Information_System_Name"].ToString();
                }
            }

            if (!string.IsNullOrEmpty(hfTrainTypeID.Value))
            {
                string  strSql = "select * from Information_Level where Information_Level_ID=" + hfTrainTypeID.Value;
                DataSet ds     = oa.RunSqlDataSet(strSql);

                if (ds.Tables[0].Rows.Count > 0)
                {
                    txtTrainTypeName.Text = ds.Tables[0].Rows[0]["Information_Level_Name"].ToString();
                }
            }
        }
示例#10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (PrjPub.CurrentLoginUser == null)
                {
                    Response.Redirect("../Common/Error.aspx?error=Session过期请重新登录本系统!");
                    return;
                }

                int railSystemId = PrjPub.RailSystemId();

                string str = "";
                if (railSystemId != 0)
                {
                    str = " and (Rail_System_ID= " + railSystemId + " or org_id=" + PrjPub.CurrentLoginUser.StationOrgID + ")";
                }
                string strSql = "select * from org where level_num=2 " + str + "  and Is_Effect=1 order by parent_id,order_index";

                OracleAccess db = new OracleAccess();
                DataSet      ds = db.RunSqlDataSet(strSql);

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

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

                //ddlOrg.SelectedValue = PrjPub.CurrentLoginUser.StationOrgID.ToString();

                if (PrjPub.CurrentLoginUser.SuitRange == 0)
                {
                    ddlOrg.Visible = false;
                    lblOrg.Visible = false;
                }

                for (int i = 2010; i < 2027; i++)
                {
                    ListItem item = new ListItem();
                    item.Text  = i.ToString();
                    item.Value = i.ToString();
                    ddlYear.Items.Add(item);
                }
                ddlYear.Items.Insert(0, "--请选择--");
                ddlYear.SelectedValue = DateTime.Now.Year.ToString();
                //绑定培训计划类别
                OracleAccess oracleAccess = new OracleAccess();
                DataSet      ds1          = oracleAccess.RunSqlDataSet("select * from ZJ_TRAINPLAN_TYPE");
                ddlTrainPlanType.DataSource     = ds1.Tables[0].DefaultView;
                ddlTrainPlanType.DataTextField  = "TRAINPLAN_TYPE_NAME";
                ddlTrainPlanType.DataValueField = "TRAINPLAN_TYPE_ID";
                ddlTrainPlanType.DataBind();
                hfSelect.Value = GetSql();


                if (PrjPub.HasEditRight("培训计划") && PrjPub.IsServerCenter)
                {
                    HfUpdateRight.Value = "True";
                }
                else
                {
                    HfUpdateRight.Value = "False";
                }

                if (PrjPub.HasDeleteRight("培训计划") && PrjPub.IsServerCenter)
                {
                    HfDeleteRight.Value = "True";
                }
                else
                {
                    HfDeleteRight.Value = "False";
                }
            }
        }
示例#11
0
        protected void grdEntity_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string Id = e.CommandArgument.ToString();

            if (string.IsNullOrEmpty(Id))
            {
                return;
            }

            if (e.CommandName == "del")
            {
                try
                {
                    OracleAccess oracleAccess = new OracleAccess();
                    string       sql          = "select * from zj_train_class where train_plan_id=" + Id;
                    DataSet      dsClass      = oracleAccess.RunSqlDataSet(sql);
                    string       strInfo      = string.Empty;
                    foreach (DataRow dr in dsClass.Tables[0].Rows)
                    {
                        strInfo += strInfo == string.Empty ? "【" + dr["Train_Class_Name"] + "】":
                                   "、【" + dr["Train_Class_Name"] + "】";
                    }

                    if (strInfo != string.Empty)
                    {
                        strInfo = "该培训计划下存在以下培训培训班:" + strInfo;
                    }

                    sql = "select b.Exam_Name from Random_Exam_Train_Class a "
                          + " inner join Random_Exam b on a.Random_Exam_ID=b.Random_Exam_ID "
                          + " inner join ZJ_Train_Class c on a.Train_Class_ID=c.Train_Class_ID "
                          + " where c.Train_Plan_ID=" + Id;
                    DataSet dsExam  = oracleAccess.RunSqlDataSet(sql);
                    string  strExam = string.Empty;
                    foreach (DataRow dr in dsExam.Tables[0].Rows)
                    {
                        strExam += strExam == string.Empty ? "【" + dr["Exam_Name"] + "】" :
                                   "、【" + dr["Exam_Name"] + "】";
                    }

                    if (strExam != string.Empty)
                    {
                        strInfo = strInfo + "该培训计划下存在以下考试:" + strExam;
                    }

                    if (strInfo != string.Empty)
                    {
                        ClientScript.RegisterStartupScript(GetType(), "Error", "alert('" + strInfo + "');", true);
                        return;
                    }

                    sql = "delete from zj_train_plan_employee where train_plan_id=" + Id;
                    oracleAccess.ExecuteNonQuery(sql);

                    sql = "delete from ZJ_TRAIN_PLAN_POST_CLASS_ORG where TRAIN_PLAN_POST_CLASS_ID in (select TRAIN_PLAN_POST_CLASS_ID from ZJ_TRAIN_PLAN_POST_CLASS where Train_Plan_ID=" + Id + ")";
                    oracleAccess.ExecuteNonQuery(sql);

                    sql = "delete from ZJ_TRAIN_PLAN_POST_CLASS where Train_Plan_ID=" + Id;
                    oracleAccess.ExecuteNonQuery(sql);

                    sql = "delete from ZJ_TRAIN_PLAN_POST where Train_Plan_ID=" + Id;
                    oracleAccess.ExecuteNonQuery(sql);

                    sql = "delete from zj_train_plan where train_plan_id=" + Id;
                    oracleAccess.ExecuteNonQuery(sql);
                }
                catch (Exception ex)
                {
                    ClientScript.RegisterStartupScript(GetType(), "Error", "alert('该培训计划已被引用,不能删除!');", true);
                    return;
                }

                //ClientScript.RegisterStartupScript(GetType(), "OK", "alert('删除成功!');", true);
                hfSelect.Value = GetSql();
                grdEntity.DataBind();
            }
        }
        /// <summary>
        /// 填充页面
        /// </summary>
        protected void FillPage()
        {
            string value = Request.QueryString["TypeValue"];
            string id    = Request.QueryString["ID"];

            trType.Visible = false;
            trMemo.Visible = true;

            //修改 需要填充
            if (!string.IsNullOrEmpty(value) && !string.IsNullOrEmpty(id))
            {
                if (value == "education_level")
                {
                    EducationLevelBLL objBLL            = new EducationLevelBLL();
                    EducationLevel    objEducationLevel = objBLL.GetEducationLevelByEducationLevelID(Convert.ToInt32(id));
                    txtItemName.Text = objEducationLevel.EducationLevelName;
                    txtMemo.Text     = objEducationLevel.Memo;
                }
                if (value == "political_status")
                {
                    PoliticalStatusBLL objBLL             = new PoliticalStatusBLL();
                    PoliticalStatus    objPoliticalStatus = objBLL.GetPoliticalStatusByPoliticalStatusID(Convert.ToInt32(id));
                    txtItemName.Text = objPoliticalStatus.PoliticalStatusName;
                    txtMemo.Text     = objPoliticalStatus.Memo;
                }
                if (value == "workgroupleader_level")
                {
                    WorkGroupLeaderLevelBLL objBLL = new WorkGroupLeaderLevelBLL();
                    WorkGroupLeaderLevel    objWorkGroupLeaderLevel =
                        objBLL.GetWorkGroupLeaderLevelByWorkGroupLeaderLevelID(Convert.ToInt32(id));
                    txtItemName.Text = objWorkGroupLeaderLevel.LevelName;
                    txtMemo.Text     = objWorkGroupLeaderLevel.Memo;
                }
                if (value == "technician_type")
                {
                    TechnicianTypeBLL objBLL            = new TechnicianTypeBLL();
                    TechnicianType    objTechnicianType = objBLL.GetTechnicianTypeByTechnicianTypeID(Convert.ToInt32(id));
                    txtItemName.Text = objTechnicianType.TypeName;
                    txtMemo.Text     = objTechnicianType.Memo;
                }
                if (value == "technician_title_type")
                {
                    trType.Visible = true;
                    trMemo.Visible = false;
                    TechnicianTitleTypeBLL objBLL = new TechnicianTitleTypeBLL();
                    TechnicianTitleType    objTechnicianTitleType = objBLL.GetTechnicianTitleTypeByTechnicianTitleTypeID(Convert.ToInt32(id));
                    txtItemName.Text      = objTechnicianTitleType.TypeName;
                    ddlType.SelectedValue = objTechnicianTitleType.TypeLevel.ToString();
                    txtMemo.ReadOnly      = true;
                }
                if (value == "education_employee_type")
                {
                    trType.Visible = false;
                    trMemo.Visible = false;
                    EducationEmployeeTypeBLL objBLL = new EducationEmployeeTypeBLL();
                    EducationEmployeeType    obj    = objBLL.GetEducationEmployeeTypeByEducationEmployeeTypeID(Convert.ToInt32(id));
                    txtItemName.Text = obj.TypeName;
                    txtMemo.ReadOnly = true;
                }
                if (value == "committee_head_ship")
                {
                    trType.Visible = false;
                    trMemo.Visible = false;
                    CommitteeHeadShipBLL objBLL = new CommitteeHeadShipBLL();
                    CommitteeHeadShip    obj    = objBLL.GetCommitteeHeadShipByCommitteeHeadShipID(Convert.ToInt32(id));
                    txtItemName.Text = obj.CommitteeHeadShipName;
                    txtMemo.ReadOnly = true;
                }
                if (value == "random_exam_modular_type")
                {
                    trType.Visible = false;
                    trMemo.Visible = false;
                    RandomExamModularTypeBLL objBLL = new RandomExamModularTypeBLL();
                    RandomExamModularType    obj    = objBLL.GetRandomExamModularTypeByTypeID(Convert.ToInt32(id));
                    txtItemName.Text = obj.RandomExamModularTypeName;
                    txtMemo.ReadOnly = true;
                }
                if (value == "trainplan_type")
                {
                    trType.Visible = false;
                    trMemo.Visible = false;
                    OracleAccess oracle = new OracleAccess();
                    DataTable    dt     =
                        oracle.RunSqlDataSet(string.Format(
                                                 "select * from zj_trainplan_type where trainplan_type_id={0}", Convert.ToInt32(id))).Tables[
                            0];
                    txtItemName.Text = dt.Rows[0]["trainplan_type_name"].ToString();
                }

                if (value == "safe_level")
                {
                    trType.Visible = false;
                    trMemo.Visible = false;
                    OracleAccess access = new OracleAccess();
                    DataTable    dt     = access.RunSqlDataSet("select * from zj_safe_level where  safe_level_id =" + id).Tables[0];
                    txtItemName.Text = dt.Rows[0]["safe_level_name"].ToString();
                }
                if (value == "certificate")
                {
                    trType.Visible = false;
                    trMemo.Visible = false;
                    OracleAccess access = new OracleAccess();
                    DataTable    dt     = access.RunSqlDataSet("select * from zj_certificate where  certificate_id =" + id).Tables[0];
                    txtItemName.Text = dt.Rows[0]["certificate_name"].ToString();
                }
                if (value == "certificate_level")
                {
                    trType.Visible = true;
                    trMemo.Visible = false;
                    OracleAccess access = new OracleAccess();
                    DataTable    dt     = access.RunSqlDataSet("select * from zj_certificate_level where  certificate_level_id =" + id).Tables[0];
                    txtItemName.Text       = dt.Rows[0]["certificate_level_name"].ToString();
                    ddlType.DataSource     = access.RunSqlDataSet("select * from zj_certificate order by order_index").Tables[0];
                    ddlType.DataTextField  = "certificate_name";
                    ddlType.DataValueField = "certificate_id";
                    ddlType.DataBind();
                    ddlType.SelectedValue = dt.Rows[0]["certificate_id"].ToString();
                }
                if (value == "certificate_unit")
                {
                    trType.Visible = false;
                    trMemo.Visible = false;
                    OracleAccess access = new OracleAccess();
                    DataTable    dt     = access.RunSqlDataSet("select * from zj_certificate_unit where  certificate_unit_id =" + id).Tables[0];
                    txtItemName.Text = dt.Rows[0]["certificate_unit_name"].ToString();
                }
                if (value == "train_unit")
                {
                    trType.Visible = false;
                    trMemo.Visible = false;
                    OracleAccess access = new OracleAccess();
                    DataTable    dt     = access.RunSqlDataSet("select * from zj_train_unit where  train_unit_id =" + id).Tables[0];
                    txtItemName.Text = dt.Rows[0]["train_unit_name"].ToString();
                }
            }
            else
            {
                if (value == "technician_title_type")
                {
                    trType.Visible = true;
                    trMemo.Visible = false;
                }
                if (value == "education_employee_type")
                {
                    trMemo.Visible = false;
                }
                if (value == "committee_head_ship")
                {
                    trMemo.Visible = false;
                }
                if (value == "random_exam_modular_type")
                {
                    trMemo.Visible = false;
                }
                if (value == "trainplan_type")
                {
                    trMemo.Visible = false;
                }
                if (value == "safe_level")
                {
                    trMemo.Visible = false;
                }
                if (value == "certificate")
                {
                    trMemo.Visible = false;
                }
                if (value == "certificate_level")
                {
                    trMemo.Visible = false;
                    trType.Visible = true;
                    OracleAccess access = new OracleAccess();
                    ddlType.DataSource     = access.RunSqlDataSet("select * from zj_certificate order by order_index").Tables[0];
                    ddlType.DataTextField  = "certificate_name";
                    ddlType.DataValueField = "certificate_id";
                    ddlType.DataBind();
                }
                if (value == "certificate_unit")
                {
                    trMemo.Visible = false;
                }
                if (value == "train_unit")
                {
                    trMemo.Visible = false;
                }
            }
        }
        /// <summary>
        /// 保存数据项
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void InsertButton_Click(object sender, EventArgs e)
        {
            string value = Request.QueryString["TypeValue"];
            string id    = Request.QueryString["ID"];
            string mode  = Request.QueryString["Mode"];

            if (value == "education_level" && mode == "Update")
            {
                EducationLevelBLL objBLL = new EducationLevelBLL();
                EducationLevel    obj    = objBLL.GetEducationLevelByEducationLevelID(Convert.ToInt32(id));
                obj.EducationLevelID = Convert.ToInt32(id);
                string educationName = obj.EducationLevelName;

                if (objBLL.GetEducationLevelByWhereClause("Education_Level_ID !=" + id + " and Education_Level_Name='" + txtItemName.Text + "'").Count > 0)
                {
                    SessionSet.PageMessage = "系统中已存在该文化程度,请重新输入!";
                    txtItemName.Focus();
                    return;
                }

                obj.EducationLevelName = txtItemName.Text;
                obj.Memo = txtMemo.Text;
                objBLL.UpdateEducationLevel(obj);
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("修改文化程度:(" + educationName + ")为(" + txtItemName.Text + ")");
                Response.Write("<script>window.opener.gridCallBack.callback('');window.close();</script>");
            }
            if (value == "political_status" && mode == "Update")
            {
                PoliticalStatusBLL objBLL = new PoliticalStatusBLL();
                PoliticalStatus    obj    = objBLL.GetPoliticalStatusByPoliticalStatusID(Convert.ToInt32(id));
                obj.PoliticalStatusID = Convert.ToInt32(id);
                string politicalStatusName = obj.PoliticalStatusName;

                if (objBLL.GetPoliticalStatusByWhereClause("Political_Status_ID !=" + id + " and Political_Status_Name='" + txtItemName.Text + "'").Count > 0)
                {
                    SessionSet.PageMessage = "系统中已存在该政治面貌,请重新输入!";
                    txtItemName.Focus();
                    return;
                }

                obj.PoliticalStatusName = txtItemName.Text;
                obj.Memo = txtMemo.Text;
                objBLL.UpdatePoliticalStatus(obj);
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("修改政治面貌:(" + politicalStatusName + ")为(" + txtItemName.Text + ")");
                Response.Write("<script>window.opener.gridCallBack.callback('');window.close();</script>");
            }
            if (value == "workgroupleader_level" && mode == "Update")
            {
                WorkGroupLeaderLevelBLL objBLL = new WorkGroupLeaderLevelBLL();
                WorkGroupLeaderLevel    obj    = objBLL.GetWorkGroupLeaderLevelByWorkGroupLeaderLevelID(Convert.ToInt32(id));
                obj.WorkGroupLeaderLevelID = Convert.ToInt32(id);
                string levelName = obj.LevelName;

                if (objBLL.GetWorkGroupLeaderLevelByWhereClause("WorkGroupLeader_Level_ID !=" + id + " and Level_Name='" + txtItemName.Text + "'").Count > 0)
                {
                    SessionSet.PageMessage = "系统中已存在该班组长类别,请重新输入!";
                    txtItemName.Focus();
                    return;
                }

                obj.LevelName = txtItemName.Text;
                obj.Memo      = txtMemo.Text;
                objBLL.UpdateWorkGroupLeaderLevel(obj);
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("修改班组长类别:(" + levelName + ")为(" + txtItemName.Text + ")");
                Response.Write("<script>window.opener.gridCallBack.callback('');window.close();</script>");
            }
            if (value == "technician_type" && mode == "Update")
            {
                TechnicianTypeBLL objBLL = new TechnicianTypeBLL();
                TechnicianType    obj    = objBLL.GetTechnicianTypeByTechnicianTypeID(Convert.ToInt32(id));
                obj.TechnicianTypeID = Convert.ToInt32(id);
                string typeName = obj.TypeName;

                if (objBLL.GetTechnicianTypeByWhereClause("Technician_Type_ID !=" + id + " and Type_Name='" + txtItemName.Text + "'", "").Count > 0)
                {
                    SessionSet.PageMessage = "系统中已存在该工人技能等级,请重新输入!";
                    txtItemName.Focus();
                    return;
                }

                obj.TypeName = txtItemName.Text;
                obj.Memo     = txtMemo.Text;
                objBLL.UpdateTechnicianType(obj, "");
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("修改工人技能等级:(" + typeName + ")为(" + txtItemName.Text + ")");
                Response.Write("<script>window.opener.gridCallBack.callback('');window.close();</script>");
            }
            if (value == "technician_title_type" && mode == "Update")
            {
                TechnicianTitleTypeBLL objBLL = new TechnicianTitleTypeBLL();
                TechnicianTitleType    obj    = objBLL.GetTechnicianTitleTypeByTechnicianTitleTypeID(Convert.ToInt32(id));
                obj.TechnicianTitleTypeID = Convert.ToInt32(id);
                string typeTitleName = obj.TypeName;

                if (objBLL.GetTechnicianTitleTypeByWhereClause("Technician_Title_Type_ID !=" + id + " and Type_Name='" + txtItemName.Text + "'").Count > 0)
                {
                    SessionSet.PageMessage = "系统中已存在该干部技术职称,请重新输入!";
                    txtItemName.Focus();
                    return;
                }

                obj.TypeName  = txtItemName.Text;
                obj.TypeLevel = Convert.ToInt32(ddlType.SelectedValue);
                objBLL.UpdateTechnicianTitleType(obj);
                txtMemo.ReadOnly = true;
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("修改干部技术职称:(" + typeTitleName + ")为(" + txtItemName.Text + ")");
                Response.Write("<script>window.opener.gridCallBack.callback('');window.close();</script>");
            }

            if (value == "education_employee_type" && mode == "Update")
            {
                EducationEmployeeTypeBLL objBLL = new EducationEmployeeTypeBLL();
                EducationEmployeeType    obj    = objBLL.GetEducationEmployeeTypeByEducationEmployeeTypeID(Convert.ToInt32(id));
                obj.EducationEmployeeTypeID = Convert.ToInt32(id);
                string typeTitleName = obj.TypeName;

                if (objBLL.GetAllEducationEmployeeTypeByWhereClause("Education_Employee_Type_ID !=" + id + " and Education_Employee_Type_Name='" + txtItemName.Text + "'").Count > 0)
                {
                    SessionSet.PageMessage = "系统中已存在该职教人员类型,请重新输入!";
                    txtItemName.Focus();
                    return;
                }
                obj.TypeName = txtItemName.Text;
                objBLL.UpdateEducationEmployeeType(obj);
                txtMemo.ReadOnly = true;
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("修改该职教人员类型:(" + typeTitleName + ")为(" + txtItemName.Text + ")");
                Response.Write("<script>window.opener.gridCallBack.callback('');window.close();</script>");
            }
            if (value == "committee_head_ship" && mode == "Update")
            {
                CommitteeHeadShipBLL objBLL = new CommitteeHeadShipBLL();
                CommitteeHeadShip    obj    = objBLL.GetCommitteeHeadShipByCommitteeHeadShipID(Convert.ToInt32(id));
                obj.CommitteeHeadShipID = Convert.ToInt32(id);
                string ShipName = obj.CommitteeHeadShipName;

                if (objBLL.GetAllCommitteeHeadShipByWhereClause("committee_head_ship_id !=" + id + " and committee_head_ship_name='" + txtItemName.Text + "'").Count > 0)
                {
                    SessionSet.PageMessage = "系统中已存在该职教委员会职务,请重新输入!";
                    txtItemName.Focus();
                    return;
                }
                obj.CommitteeHeadShipName = txtItemName.Text;
                objBLL.UpdateCommitteeHeadShip(obj);
                txtMemo.ReadOnly = true;
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("修改职教委员会职务:(" + ShipName + ")为(" + txtItemName.Text + ")");
                Response.Write("<script>window.opener.gridCallBack.callback('');window.close();</script>");
            }
            if (value == "random_exam_modular_type" && mode == "Update")
            {
                RandomExamModularTypeBLL objBLL = new RandomExamModularTypeBLL();
                RandomExamModularType    obj    = objBLL.GetRandomExamModularTypeByTypeID(Convert.ToInt32(id));
                obj.RandomExamModularTypeID = Convert.ToInt32(id);
                string TpyeName = obj.RandomExamModularTypeName;

                if (objBLL.GetAllRandomExamModularTypeByWhereClause("random_exam_modular_type_id !=" + id + " and random_exam_modular_type_name='" + txtItemName.Text + "'").Count > 0)
                {
                    SessionSet.PageMessage = "系统中已存在该模块考试类别,请重新输入!";
                    txtItemName.Focus();
                    return;
                }
                obj.RandomExamModularTypeName = txtItemName.Text;
                objBLL.UpdateRandomExamModularType(obj);
                txtMemo.ReadOnly = true;
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("修改模块考试类别:(" + TpyeName + ")为(" + txtItemName.Text + ")");
                Response.Write("<script>window.opener.gridCallBack.callback('');window.close();</script>");
            }
            if (value == "trainplan_type" && mode == "Update")
            {
                OracleAccess oracle = new OracleAccess();
                DataTable    dt     =
                    oracle.RunSqlDataSet(
                        string.Format(
                            "select * from zj_trainplan_type where trainplan_type_id!={0} and trainplan_type_name='{1}'",
                            Convert.ToInt32(id), txtItemName.Text)).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    SessionSet.PageMessage = "系统中已存在该培训类别,请重新输入!";
                    txtItemName.Focus();
                    return;
                }
                DataTable dt1 =
                    oracle.RunSqlDataSet(
                        string.Format(
                            "select * from zj_trainplan_type where trainplan_type_id={0}",
                            Convert.ToInt32(id))).Tables[0];
                oracle.ExecuteNonQuery(
                    string.Format("update zj_trainplan_type set trainplan_type_name='{0}' where trainplan_type_id={1}",
                                  txtItemName.Text, (Convert.ToInt32(id))));
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("修改模块考试类别:(" + dt1.Rows[0]["trainplan_type_name"] + ")为(" + txtItemName.Text + ")");
                Response.Write("<script>window.opener.gridCallBack.callback('');window.close();</script>");
            }

            if (value == "safe_level" && mode == "Update")
            {
                OracleAccess access = new OracleAccess();
                DataTable    dt     = access.RunSqlDataSet(
                    string.Format("select count(1) from zj_safe_level where safe_level_id!={0} and safe_level_name='{1}'",
                                  Convert.ToInt32(id), txtItemName.Text.Trim())).Tables[0];
                if (Convert.ToInt32(dt.Rows[0][0]) > 0)
                {
                    SessionSet.PageMessage = "系统中已存在该安全等级,请重新输入!";
                    txtItemName.Focus();
                    return;
                }
                DataTable dt1 = access.RunSqlDataSet("select * from zj_safe_level where  safe_level_id =" + id).Tables[0];
                access.ExecuteNonQuery(
                    string.Format("update zj_safe_level set safe_level_name='{0}' where safe_level_id={1}", txtItemName.Text.Trim(),
                                  Convert.ToInt32(id)));
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("修改安全等级:(" + dt1.Rows[0]["safe_level_name"] + ")为(" + txtItemName.Text + ")");
                Response.Write("<script>window.opener.gridCallBack.callback('');window.close();</script>");
            }

            if (value == "certificate" && mode == "Update")
            {
                OracleAccess access = new OracleAccess();
                DataTable    dt     = access.RunSqlDataSet(
                    string.Format("select count(1) from zj_certificate where certificate_id!={0} and certificate_name='{1}'",
                                  Convert.ToInt32(id), txtItemName.Text.Trim())).Tables[0];
                if (Convert.ToInt32(dt.Rows[0][0]) > 0)
                {
                    SessionSet.PageMessage = "系统中已存在该证书,请重新输入!";
                    txtItemName.Focus();
                    return;
                }
                DataTable dt1 = access.RunSqlDataSet("select * from zj_certificate where  certificate_id =" + id).Tables[0];
                access.ExecuteNonQuery(
                    string.Format("update zj_certificate set certificate_name='{0}' where certificate_id={1}", txtItemName.Text.Trim(),
                                  Convert.ToInt32(id)));
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("修改证书:(" + dt1.Rows[0]["certificate_name"] + ")为(" + txtItemName.Text + ")");
                Response.Write("<script>window.opener.gridCallBack.callback('');window.close();</script>");
            }

            if (value == "certificate_level" && mode == "Update")
            {
                OracleAccess access = new OracleAccess();
                DataTable    dt1    = access.RunSqlDataSet("select * from zj_certificate_level where  certificate_level_id =" + id).Tables[0];
                access.ExecuteNonQuery(
                    string.Format("update zj_certificate_level set certificate_level_name='{0}',certificate_id={2} where certificate_level_id={1}", txtItemName.Text.Trim(),
                                  Convert.ToInt32(id), ddlType.SelectedValue));
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("修改证书等级:(" + dt1.Rows[0]["certificate_level_name"] + ")为(" + txtItemName.Text + ")");
                Response.Write("<script>window.opener.gridCallBack.callback('');window.close();</script>");
            }
            if (value == "certificate_unit" && mode == "Update")
            {
                OracleAccess access = new OracleAccess();
                DataTable    dt     = access.RunSqlDataSet(
                    string.Format("select count(1) from zj_certificate_unit where certificate_unit_id!={0} and certificate_unit_name='{1}'",
                                  Convert.ToInt32(id), txtItemName.Text.Trim())).Tables[0];
                if (Convert.ToInt32(dt.Rows[0][0]) > 0)
                {
                    SessionSet.PageMessage = "系统中已存在该发证单位,请重新输入!";
                    txtItemName.Focus();
                    return;
                }
                DataTable dt1 = access.RunSqlDataSet("select * from zj_certificate_unit where  certificate_unit_id =" + id).Tables[0];
                access.ExecuteNonQuery(
                    string.Format("update zj_certificate_unit set certificate_unit_name='{0}' where certificate_unit_id={1}", txtItemName.Text.Trim(),
                                  Convert.ToInt32(id)));
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("修改发证单位:(" + dt1.Rows[0]["certificate_unit_name"] + ")为(" + txtItemName.Text + ")");
                Response.Write("<script>window.opener.gridCallBack.callback('');window.close();</script>");
            }
            if (value == "train_unit" && mode == "Update")
            {
                OracleAccess access = new OracleAccess();
                DataTable    dt     = access.RunSqlDataSet(
                    string.Format("select count(1) from zj_train_unit where train_unit_id!={0} and train_unit_name='{1}'",
                                  Convert.ToInt32(id), txtItemName.Text.Trim())).Tables[0];
                if (Convert.ToInt32(dt.Rows[0][0]) > 0)
                {
                    SessionSet.PageMessage = "系统中已存在该培训单位,请重新输入!";
                    txtItemName.Focus();
                    return;
                }
                DataTable dt1 = access.RunSqlDataSet("select * from zj_train_unit where  train_unit_id =" + id).Tables[0];
                access.ExecuteNonQuery(
                    string.Format("update zj_train_unit set train_unit_name='{0}' where train_unit_id={1}", txtItemName.Text.Trim(),
                                  Convert.ToInt32(id)));
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("修改培训单位:(" + dt1.Rows[0]["train_unit_name"] + ")为(" + txtItemName.Text + ")");
                Response.Write("<script>window.opener.gridCallBack.callback('');window.close();</script>");
            }



            if (value == "education_level" && mode == "Insert")
            {
                EducationLevelBLL objBLL = new EducationLevelBLL();
                if (objBLL.GetEducationLevelByWhereClause("Education_Level_Name='" + txtItemName.Text + "'").Count > 0)
                {
                    SessionSet.PageMessage = "系统中已存在该文化程度,请重新输入!";
                    txtItemName.Focus();
                    return;
                }
                objBLL.InsertEducationLevel(txtItemName.Text, txtMemo.Text);
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("新增文化程度:" + txtItemName.Text);
                Response.Write("<script>window.opener.gridCallBack.callback('');window.close();</script>");
            }
            if (value == "political_status" && mode == "Insert")
            {
                PoliticalStatusBLL objBLL = new PoliticalStatusBLL();
                if (objBLL.GetPoliticalStatusByWhereClause("Political_Status_Name='" + txtItemName.Text + "'").Count > 0)
                {
                    SessionSet.PageMessage = "系统中已存在该政治面貌,请重新输入!";
                    txtItemName.Focus();
                    return;
                }
                objBLL.InsertPoliticalStatus(txtItemName.Text, txtMemo.Text);
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("新增政治面貌:" + txtItemName.Text);
                Response.Write("<script>window.opener.gridCallBack.callback('');window.close();</script>");
            }
            if (value == "workgroupleader_level" && mode == "Insert")
            {
                WorkGroupLeaderLevelBLL objBLL = new WorkGroupLeaderLevelBLL();
                if (objBLL.GetWorkGroupLeaderLevelByWhereClause("Level_Name='" + txtItemName.Text + "'").Count > 0)
                {
                    SessionSet.PageMessage = "系统中已存在该班组长类别,请重新输入!";
                    txtItemName.Focus();
                    return;
                }
                objBLL.InsertWorkGroupLeaderLevel(txtItemName.Text, txtMemo.Text);
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("新增班组长类别:" + txtItemName.Text);
                Response.Write("<script>window.opener.gridCallBack.callback('');window.close();</script>");
            }
            if (value == "technician_type" && mode == "Insert")
            {
                TechnicianTypeBLL objBLL = new TechnicianTypeBLL();
                if (objBLL.GetTechnicianTypeByWhereClause("Type_Name='" + txtItemName.Text + "'", "").Count > 0)
                {
                    SessionSet.PageMessage = "系统中已存在该工人技能等级,请重新输入!";
                    txtItemName.Focus();
                    return;
                }
                objBLL.InsertTechnicianType(txtItemName.Text, txtMemo.Text, "");
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("新增工人技能等级:" + txtItemName.Text);
                Response.Write("<script>window.opener.gridCallBack.callback('');window.close();</script>");
            }
            if (value == "technician_title_type" && mode == "Insert")
            {
                TechnicianTitleTypeBLL objBLL = new TechnicianTitleTypeBLL();
                if (objBLL.GetTechnicianTitleTypeByWhereClause("Type_Name='" + txtItemName.Text + "'").Count > 0)
                {
                    SessionSet.PageMessage = "系统中已存在该干部技术职称,请重新输入!";
                    txtItemName.Focus();
                    return;
                }
                TechnicianTitleType obj = new TechnicianTitleType();
                obj.TypeName  = txtItemName.Text;
                obj.TypeLevel = Convert.ToInt32(ddlType.SelectedValue);
                objBLL.InsertTechnicianTitleType(obj);
                txtMemo.ReadOnly = true;
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("新增干部技术职称:" + txtItemName.Text);
                Response.Write("<script>window.opener.gridCallBack.callback('');window.close();</script>");
            }
            if (value == "education_employee_type" && mode == "Insert")
            {
                EducationEmployeeTypeBLL objBLL = new EducationEmployeeTypeBLL();
                if (objBLL.GetAllEducationEmployeeTypeByWhereClause("Education_Employee_Type_Name='" + txtItemName.Text + "'").Count > 0)
                {
                    SessionSet.PageMessage = "系统中已存在该干部技术职称,请重新输入!";
                    txtItemName.Focus();
                    return;
                }
                EducationEmployeeType obj = new EducationEmployeeType();
                obj.TypeName = txtItemName.Text;
                objBLL.InsertEducationEmployeeType(obj);
                txtMemo.Visible = false;
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("新增职教人员类型:" + txtItemName.Text);
                Response.Write("<script>window.opener.gridCallBack.callback('');window.close();</script>");
            }
            if (value == "committee_head_ship" && mode == "Insert")
            {
                CommitteeHeadShipBLL objBLL = new CommitteeHeadShipBLL();
                if (objBLL.GetAllCommitteeHeadShipByWhereClause("committee_head_ship_name='" + txtItemName.Text + "'").Count > 0)
                {
                    SessionSet.PageMessage = "系统中已存在该职教委员会职务,请重新输入!";
                    txtItemName.Focus();
                    return;
                }
                CommitteeHeadShip obj = new CommitteeHeadShip();
                obj.CommitteeHeadShipName = txtItemName.Text;
                objBLL.InsertCommitteeHeadShip(obj);
                txtMemo.Visible = false;
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("新增职教委员会职务:" + txtItemName.Text);
                Response.Write("<script>window.opener.gridCallBack.callback('');window.close();</script>");
            }
            if (value == "random_exam_modular_type" && mode == "Insert")
            {
                RandomExamModularTypeBLL objBLL = new RandomExamModularTypeBLL();
                if (objBLL.GetAllRandomExamModularTypeByWhereClause("random_exam_modular_type_name='" + txtItemName.Text + "'").Count > 0)
                {
                    SessionSet.PageMessage = "系统中已存在该模块考试类别,请重新输入!";
                    txtItemName.Focus();
                    return;
                }
                RandomExamModularType obj = new RandomExamModularType();
                obj.RandomExamModularTypeName = txtItemName.Text;
                objBLL.InsertRandomExamModularType(obj);
                txtMemo.Visible = false;
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("新增模块考试类别:" + txtItemName.Text);
                Response.Write("<script>window.opener.gridCallBack.callback('');window.close();</script>");
            }
            if (value == "trainplan_type" && mode == "Insert")
            {
                OracleAccess oracle = new OracleAccess();
                DataTable    dt     =
                    oracle.RunSqlDataSet(
                        string.Format(
                            "select * from zj_trainplan_type where  trainplan_type_name='{0}'",
                            txtItemName.Text)).Tables[0];
                if (dt.Rows.Count > 0)
                {
                    SessionSet.PageMessage = "系统中已存在该培训类别,请重新输入!";
                    txtItemName.Focus();
                    return;
                }

                oracle.ExecuteNonQuery(
                    string.Format(
                        "insert into zj_trainplan_type values(TRAIN_PLAN_TYPE_SEQ.Nextval,'{0}')",
                        txtItemName.Text.Trim()));
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("新增模块考试类别:(" + txtItemName.Text.Trim() + ")");
                Response.Write("<script>window.opener.gridCallBack.callback('');window.close();</script>");
            }
            if (value == "safe_level" && mode == "Insert")
            {
                OracleAccess access = new OracleAccess();
                DataTable    dt     = access.RunSqlDataSet(
                    string.Format("select count(1) from zj_safe_level where safe_level_name='{0}'", txtItemName.Text.Trim())).Tables[0];
                if (Convert.ToInt32(dt.Rows[0][0]) > 0)
                {
                    SessionSet.PageMessage = "系统中已存在该安全等级,请重新输入!";
                    txtItemName.Focus();
                    return;
                }

                try
                {
                    DataTable dtcount  = access.RunSqlDataSet("select count(1) from zj_safe_level").Tables[0];
                    string    strIndex = "(select max(order_index)+1 from zj_safe_level)";
                    if (Convert.ToInt32(dtcount.Rows[0][0]) == 0)
                    {
                        strIndex = "1";
                    }
                    string sql =
                        string.Format(
                            "insert into zj_safe_level values(safe_level_seq.nextval,'{0}',{1})",
                            txtItemName.Text.Trim(), strIndex);
                    access.ExecuteNonQuery(sql);
                    SystemLogBLL objLogBll = new SystemLogBLL();
                    objLogBll.WriteLog("新增安全等级:(" + txtItemName.Text.Trim() + ")");
                    Response.Write("<script>window.opener.gridCallBack.callback('');window.close();</script>");
                }
                catch
                {
                    SessionSet.PageMessage = "数据新增失败!";
                }
            }
            if (value == "certificate" && mode == "Insert")
            {
                OracleAccess access = new OracleAccess();
                DataTable    dt     = access.RunSqlDataSet(
                    string.Format("select count(1) from zj_certificate where certificate_name='{0}'", txtItemName.Text.Trim())).Tables[0];
                if (Convert.ToInt32(dt.Rows[0][0]) > 0)
                {
                    SessionSet.PageMessage = "系统中已存在该证书,请重新输入!";
                    txtItemName.Focus();
                    return;
                }

                try
                {
                    DataTable dtcount  = access.RunSqlDataSet("select count(1) from zj_certificate").Tables[0];
                    string    strIndex = "(select max(order_index)+1 from zj_certificate)";
                    if (Convert.ToInt32(dtcount.Rows[0][0]) == 0)
                    {
                        strIndex = "1";
                    }
                    string sql =
                        string.Format(
                            "insert into zj_certificate values(zj_certificate_seq.nextval,'{0}',{1})",
                            txtItemName.Text.Trim(), strIndex);
                    access.ExecuteNonQuery(sql);
                    SystemLogBLL objLogBll = new SystemLogBLL();
                    objLogBll.WriteLog("新增证书:(" + txtItemName.Text.Trim() + ")");
                    Response.Write("<script>window.opener.gridCallBack.callback('');window.close();</script>");
                }
                catch
                {
                    SessionSet.PageMessage = "数据新增失败!";
                }
            }
            if (value == "certificate_level" && mode == "Insert")
            {
                OracleAccess access = new OracleAccess();
                try
                {
                    DataTable dtcount  = access.RunSqlDataSet("select count(1) from zj_certificate_level").Tables[0];
                    string    strIndex = "(select max(order_index)+1 from zj_certificate_level)";
                    if (Convert.ToInt32(dtcount.Rows[0][0]) == 0)
                    {
                        strIndex = "1";
                    }
                    string sql =
                        string.Format(
                            "insert into zj_certificate_level values(zj_certificate_level_seq.nextval,'{0}','{1}',{2})",
                            Convert.ToInt32(ddlType.SelectedValue), txtItemName.Text.Trim(), strIndex);
                    access.ExecuteNonQuery(sql);
                    SystemLogBLL objLogBll = new SystemLogBLL();
                    objLogBll.WriteLog("新增证书级别:(" + txtItemName.Text.Trim() + ")");
                    Response.Write("<script>window.opener.gridCallBack.callback('');window.close();</script>");
                }
                catch
                {
                    SessionSet.PageMessage = "数据新增失败!";
                }
            }
            if (value == "certificate_unit" && mode == "Insert")
            {
                OracleAccess access = new OracleAccess();
                DataTable    dt     = access.RunSqlDataSet(
                    string.Format("select count(1) from zj_certificate_unit where certificate_unit_name='{0}'", txtItemName.Text.Trim())).Tables[0];
                if (Convert.ToInt32(dt.Rows[0][0]) > 0)
                {
                    SessionSet.PageMessage = "系统中已存在该发证单位,请重新输入!";
                    txtItemName.Focus();
                    return;
                }

                try
                {
                    DataTable dtcount  = access.RunSqlDataSet("select count(1) from zj_certificate_unit").Tables[0];
                    string    strIndex = "(select max(order_index)+1 from zj_certificate_unit)";
                    if (Convert.ToInt32(dtcount.Rows[0][0]) == 0)
                    {
                        strIndex = "1";
                    }
                    string sql =
                        string.Format(
                            "insert into zj_certificate_unit values(zj_certificate_unit_seq.nextval,'{0}',{1})",
                            txtItemName.Text.Trim(), strIndex);
                    access.ExecuteNonQuery(sql);
                    SystemLogBLL objLogBll = new SystemLogBLL();
                    objLogBll.WriteLog("新增发证单位:(" + txtItemName.Text.Trim() + ")");
                    Response.Write("<script>window.opener.gridCallBack.callback('');window.close();</script>");
                }
                catch
                {
                    SessionSet.PageMessage = "数据新增失败!";
                }
            }
            if (value == "train_unit" && mode == "Insert")
            {
                OracleAccess access = new OracleAccess();
                DataTable    dt     = access.RunSqlDataSet(
                    string.Format("select count(1) from zj_train_unit where train_unit_name='{0}'", txtItemName.Text.Trim())).Tables[0];
                if (Convert.ToInt32(dt.Rows[0][0]) > 0)
                {
                    SessionSet.PageMessage = "系统中已存在该培训单位,请重新输入!";
                    txtItemName.Focus();
                    return;
                }

                try
                {
                    DataTable dtcount  = access.RunSqlDataSet("select count(1) from zj_train_unit").Tables[0];
                    string    strIndex = "(select max(order_index)+1 from zj_train_unit)";
                    if (Convert.ToInt32(dtcount.Rows[0][0]) == 0)
                    {
                        strIndex = "1";
                    }
                    string sql =
                        string.Format(
                            "insert into zj_train_unit values(zj_train_unit_seq.nextval,'{0}',{1})",
                            txtItemName.Text.Trim(), strIndex);
                    access.ExecuteNonQuery(sql);
                    SystemLogBLL objLogBll = new SystemLogBLL();
                    objLogBll.WriteLog("新增培训单位:(" + txtItemName.Text.Trim() + ")");
                    Response.Write("<script>window.opener.gridCallBack.callback('');window.close();</script>");
                }
                catch
                {
                    SessionSet.PageMessage = "数据新增失败!";
                }
            }
        }
        private void ExportArrange()
        {
            // 根据 ProgressBar.htm 显示进度条界面
            string       templateFileName = Path.Combine(Server.MapPath("."), "ProgressBar.htm");
            StreamReader reader           = new StreamReader(@templateFileName, System.Text.Encoding.GetEncoding("gb2312"));
            string       html             = reader.ReadToEnd();

            reader.Close();
            Response.Write(html);
            Response.Flush();
            System.Threading.Thread.Sleep(200);

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

            RandomExamArrangeBLL eaBll = new RandomExamArrangeBLL();
            IList <RailExam.Model.RandomExamArrange> ExamArranges = eaBll.GetRandomExamArranges(int.Parse(strExamId));

            RandomExamBLL objBll = new RandomExamBLL();

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

            EmployeeBLL psBLL = new EmployeeBLL();
            DataSet     ds    = new DataSet();

            string[]         str     = ExamArranges[0].UserIds.Split(',');
            IList <Employee> objList = new List <Employee>();

            if (str[0] != "")
            {
                OracleAccess db = new OracleAccess();
                string       strSql;

                OrganizationBLL orgBll = new OrganizationBLL();
                for (int i = 0; i < str.Length; i++)
                {
                    Employee obj = psBLL.GetChooseEmployeeInfo(str[i]);
                    obj.RowNum = i + 1;

                    if (PrjPub.CurrentLoginUser.RoleID != 1)
                    {
                        if (orgBll.GetStationOrgID(obj.OrgID) == PrjPub.CurrentLoginUser.StationOrgID)
                        {
                            objList.Add(obj);
                        }
                    }
                    else
                    {
                        objList.Add(obj);
                    }
                }

                if (objList.Count > 0)
                {
                    ds.Tables.Add(ConvertToDataTable((IList)objList));

                    if (ViewState["Sort"] != null)
                    {
                        ds.Tables[0].DefaultView.Sort = ViewState["Sort"].ToString();
                    }

                    DataColumn dc = ds.Tables[0].Columns.Add("ComputeRoom");

                    strSql = "select a.*,c.Short_Name||'-'||b.Computer_Room_Name as ComputeRoom "
                             + " from Random_Exam_Arrange_Detail a "
                             + " inner join Computer_Room b on a.Computer_Room_ID=b.Computer_Room_ID"
                             + " inner join Org c on b.Org_ID=c.Org_ID"
                             + " where Random_Exam_ID='" + strExamId + "'";
                    DataSet dsDetail = db.RunSqlDataSet(strSql);
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        string    strUser = "******" + dr["EmployeeID"] + ",";
                        DataRow[] drs     = dsDetail.Tables[0].Select("','+User_Ids+',' like '%" + strUser + "%'");

                        if (drs.Length > 0)
                        {
                            dr["ComputeRoom"] = drs[0]["ComputeRoom"].ToString();
                        }
                        else
                        {
                            dr["ComputeRoom"] = string.Empty;
                        }
                    }
                }

                System.Threading.Thread.Sleep(10);
                string jsBlock = "<script>SetPorgressBar('导出考生信息','" + ((1 * 100) / ((double)(ds.Tables[0].Rows.Count + 1))).ToString("0.00") + "'); </script>";
                Response.Write(jsBlock);
                Response.Flush();

                #region OWC11

                /*
                 * 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 range = ws.get_Range(ws.Cells[1, 1], ws.Cells[1, 7]);
                 * range.set_MergeCells(true);
                 * range.set_HorizontalAlignment(XlHAlign.xlHAlignCenter);
                 * range.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);
                 *
                 * int j = 0;
                 * foreach(DataRow dr in ds.Tables[0].Rows)
                 * {
                 *  ws.Cells[3 + j, 1] = j + 1;
                 *
                 *  ws.Cells[3 + j, 2] = dr["EmployeeName"].ToString();
                 *  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] = "'" + dr["StrWorkNo"].ToString();
                 *  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] = dr["PostName"].ToString();
                 *  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] = dr["OrgName"].ToString();
                 *  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] = dr["ComputeRoom"].ToString();
                 *  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);
                 *
                 *  j++;
                 *
                 *  System.Threading.Thread.Sleep(10);
                 *  jsBlock = "<script>SetPorgressBar('导出考生信息','" + (((j + 1) * 100) / ((double)(ds.Tables[0].Rows.Count + 1))).ToString("0.00") + "'); </script>";
                 *  Response.Write(jsBlock);
                 *  Response.Flush();
                 * }
                 *
                 * ws.Name = "1-1";
                 * ws.Cells.Columns.AutoFit();
                 *
                 *
                 * ((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);
                 */
                #endregion

                Excel.Application objApp   = new Excel.ApplicationClass();
                Excel.Workbooks   objbooks = objApp.Workbooks;
                Excel.Workbook    objbook  = objbooks.Add(Excel.XlWBATemplate.xlWBATWorksheet);
                Excel.Worksheet   objSheet = (Excel.Worksheet)objbook.Worksheets[1];              //取得sheet1
                Excel.Range       rang1;
                string            filename = "";

                try
                {
                    //生成.xls文件完整路径名
                    filename = Server.MapPath("/RailExamBao/Excel/Excel.xls");

                    if (File.Exists(filename.ToString()))
                    {
                        File.Delete(filename.ToString());
                    }
                    objSheet.Cells.Font.Size = 10;
                    objSheet.Cells.Font.Name = "宋体";

                    objSheet.Cells[1, 1] = objRandomExam.ExamName + " 参加考试学员名单";
                    rang1 = objSheet.get_Range(objSheet.Cells[1, 1], objSheet.Cells[1, 6]);
                    rang1.Merge(0);
                    rang1.HorizontalAlignment = XlHAlign.xlHAlignCenter;
                    rang1.Font.Bold           = true;
                    objSheet.Cells.Font.Size  = 17;
                    objSheet.Cells.Font.Name  = "宋体";


                    objSheet.Cells.Font.Size = 12;
                    objSheet.Cells.Font.Name = "宋体";

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


                    objSheet.Cells[2, 2] = "姓名";
                    objSheet.get_Range(objSheet.Cells[2, 2], objSheet.Cells[2, 2]).Merge(0);
                    objSheet.get_Range(objSheet.Cells[2, 2], objSheet.Cells[2, 2]).HorizontalAlignment = XlHAlign.xlHAlignCenter;

                    objSheet.Cells[2, 3] = "员工编码";
                    objSheet.get_Range(objSheet.Cells[2, 3], objSheet.Cells[2, 3]).Merge(0);
                    objSheet.get_Range(objSheet.Cells[2, 3], objSheet.Cells[2, 3]).HorizontalAlignment = XlHAlign.xlHAlignCenter;

                    objSheet.Cells[2, 4] = "职名";
                    objSheet.get_Range(objSheet.Cells[2, 4], objSheet.Cells[2, 4]).Merge(0);
                    objSheet.get_Range(objSheet.Cells[2, 4], objSheet.Cells[2, 4]).HorizontalAlignment = XlHAlign.xlHAlignCenter;

                    objSheet.Cells[2, 5] = "组织机构(车间)";
                    objSheet.get_Range(objSheet.Cells[2, 5], objSheet.Cells[2, 5]).Merge(0);
                    objSheet.get_Range(objSheet.Cells[2, 5], objSheet.Cells[2, 5]).HorizontalAlignment = XlHAlign.xlHAlignCenter;

                    objSheet.Cells[2, 6] = "考试地点";
                    objSheet.get_Range(objSheet.Cells[2, 6], objSheet.Cells[2, 6]).Merge(0);
                    objSheet.get_Range(objSheet.Cells[2, 6], objSheet.Cells[2, 6]).HorizontalAlignment = XlHAlign.xlHAlignCenter;

                    int j = 0;
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        objSheet.Cells[3 + j, 1] = j + 1;

                        objSheet.Cells[3 + j, 2] = dr["EmployeeName"].ToString();
                        objSheet.get_Range(objSheet.Cells[6 + j, 2], objSheet.Cells[6 + j, 2]).Merge(0);
                        objSheet.get_Range(objSheet.Cells[6 + j, 2], objSheet.Cells[6 + j, 2]).HorizontalAlignment =
                            XlHAlign.xlHAlignLeft;

                        objSheet.Cells[3 + j, 3] = "'" + dr["StrWorkNo"].ToString();
                        objSheet.get_Range(objSheet.Cells[3 + j, 3], objSheet.Cells[3 + j, 3]).Merge(0);
                        objSheet.get_Range(objSheet.Cells[3 + j, 3], objSheet.Cells[3 + j, 3]).HorizontalAlignment =
                            XlHAlign.xlHAlignLeft;

                        objSheet.Cells[3 + j, 4] = dr["PostName"].ToString();
                        objSheet.get_Range(objSheet.Cells[3 + j, 4], objSheet.Cells[3 + j, 4]).Merge(0);
                        objSheet.get_Range(objSheet.Cells[3 + j, 4], objSheet.Cells[3 + j, 4]).HorizontalAlignment = XlHAlign.xlHAlignLeft;


                        objSheet.Cells[3 + j, 5] = dr["OrgName"].ToString();
                        objSheet.get_Range(objSheet.Cells[3 + j, 5], objSheet.Cells[3 + j, 5]).Merge(0);
                        objSheet.get_Range(objSheet.Cells[3 + j, 5], objSheet.Cells[3 + j, 5]).HorizontalAlignment = XlHAlign.xlHAlignLeft;

                        objSheet.Cells[3 + j, 6] = dr["ComputeRoom"].ToString();
                        objSheet.get_Range(objSheet.Cells[3 + j, 6], objSheet.Cells[3 + j, 6]).Merge(0);
                        objSheet.get_Range(objSheet.Cells[3 + j, 6], objSheet.Cells[3 + j, 6]).HorizontalAlignment =
                            XlHAlign.xlHAlignLeft;

                        j++;

                        System.Threading.Thread.Sleep(10);
                        jsBlock = "<script>SetPorgressBar('导出考生信息','" + (((j + 1) * 100) / ((double)(ds.Tables[0].Rows.Count + 1))).ToString("0.00") + "'); </script>";
                        Response.Write(jsBlock);
                        Response.Flush();
                    }

                    objSheet.Cells.Columns.AutoFit();

                    objApp.Visible = false;

                    objbook.Saved = true;
                    objbook.SaveCopyAs(filename);
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    objbook.Close(Type.Missing, filename, Type.Missing);
                    objbooks.Close();
                    objApp.Application.Workbooks.Close();
                    objApp.Application.Quit();
                    objApp.Quit();
                    GC.Collect();
                }
            }

            Response.Write("<script>top.returnValue='true';window.close();</script>");
        }
        private void BindChoosedGrid(string strId)
        {
            HasExamId();

            string strExamId = Request.QueryString.Get("id");
            //已经参加考试的考生自动填充上

            RandomExamResultBLL reBll = new RandomExamResultBLL();
            IList <RailExam.Model.RandomExamResult> examResults = reBll.GetRandomExamResultByExamID(int.Parse(strExamId));

            for (int i = 0; i < examResults.Count; i++)
            {
                string strEmId     = examResults[i].ExamineeId.ToString();
                string strOldAllId = "," + strId + ",";
                if (strOldAllId.IndexOf("," + strEmId + ",") == -1)
                {
                    if (strId.Length == 0)
                    {
                        strId += strEmId;
                    }
                    else
                    {
                        strId = strEmId + "," + strId;
                    }
                }
            }

            EmployeeBLL psBLL = new EmployeeBLL();
            DataSet     ds    = new DataSet();

            //string strIDs = "," + strId + ",";
            //if (strIDs.Length > 2000)
            //{
            //    ds = psBLL.GetEmployeesByEmployeeIdS(strIDs);
            //    if (ds.Tables[0].Rows.Count > 0)
            //    {
            //        gvChoose.DataSource = ds;
            //        gvChoose.DataBind();
            //    }
            //    else
            //    {
            //        BindEmptyGrid2();
            //    }
            //}
            //else
            //{
            //    IList<Employee> objList = psBLL.GetEmployeesByEmployeeId(strIDs);
            //    if (objList.Count > 0)
            //    {
            //        ds.Tables.Add(ConvertToDataTable((IList)objList));
            //        gvChoose.DataSource = objList;
            //        gvChoose.DataBind();
            //    }
            //    else
            //    {
            //        BindEmptyGrid2();
            //    }
            //}

            string[]         str     = strId.Split(',');
            IList <Employee> objList = new List <Employee>();

            if (str[0] != "")
            {
                OracleAccess db = new OracleAccess();
                string       strSql;

                string    strQuery       = GetSql();
                ArrayList objEmloyeeList = new ArrayList();
                if (!string.IsNullOrEmpty(strQuery))
                {
                    IList <Employee> objSelectList = psBLL.GetEmployeeByWhereClause("1=1" + strQuery);

                    foreach (Employee employee in objSelectList)
                    {
                        objEmloyeeList.Add(employee.EmployeeID.ToString());
                    }
                }

                for (int i = 0; i < str.Length; i++)
                {
                    if (string.IsNullOrEmpty(str[i]))
                    {
                        continue;
                    }

                    Employee obj = psBLL.GetChooseEmployeeInfo(str[i]);
                    obj.RowNum = i + 1;
                    //if(string.IsNullOrEmpty(obj.WorkNo))
                    //{
                    //    strSql = "select identity_cardno from Employee where Employee_ID=" + str[i];
                    //    obj.WorkNo = db.RunSqlDataSet(strSql).Tables[0].Rows[0][0].ToString();
                    //}

                    if (!string.IsNullOrEmpty(strQuery))
                    {
                        if (objEmloyeeList.IndexOf(str[i]) >= 0)
                        {
                            objList.Add(obj);
                        }
                    }
                    else
                    {
                        objList.Add(obj);
                    }
                }

                if (objList.Count > 0)
                {
                    ds.Tables.Add(ConvertToDataTable((IList)objList));

                    if (ViewState["Sort"] != null)
                    {
                        try
                        {
                            ds.Tables[0].DefaultView.Sort = ViewState["Sort"].ToString();
                        }
                        catch
                        {
                        }
                    }

                    DataColumn dc = ds.Tables[0].Columns.Add("ComputeRoom");

                    strSql = "select a.*,c.Short_Name||'-'||b.Computer_Room_Name as ComputeRoom "
                             + " from Random_Exam_Arrange_Detail a "
                             + " inner join Computer_Room b on a.Computer_Room_ID=b.Computer_Room_ID"
                             + " inner join Org c on b.Org_ID=c.Org_ID"
                             + " where Random_Exam_ID='" + strExamId + "'";
                    DataSet dsDetail = db.RunSqlDataSet(strSql);
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        string    strUser = "******" + dr["EmployeeID"] + ",";
                        DataRow[] drs     = dsDetail.Tables[0].Select("','+User_Ids+',' like '%" + strUser + "%'");

                        if (drs.Length > 0)
                        {
                            dr["ComputeRoom"] = drs[0]["ComputeRoom"].ToString();
                        }
                        else
                        {
                            dr["ComputeRoom"] = string.Empty;
                        }
                    }

                    gvChoose.DataSource = ds;
                    gvChoose.DataBind();
                }
                else
                {
                    BindEmptyGrid2();
                }
            }
            else
            {
                BindEmptyGrid2();
            }
        }
        public int SaveNewBook()
        {
            OracleAccess oa = new OracleAccess();

            string  strSql = "select Information_Seq.nextval from dual";
            DataSet dsKey  = oa.RunSqlDataSet(strSql);

            string strNewID = dsKey.Tables[0].Rows[0][0].ToString();

            int levelIndex, systemIndex;

            strSql = "select * from Information where Information_System_ID=" + hfKnowledgeID.Value + " order by SYSTEM_ORDER_INDEX desc";
            DataSet dsSystem = oa.RunSqlDataSet(strSql);

            if (dsSystem.Tables[0].Rows.Count > 0)
            {
                systemIndex = Convert.ToInt32(dsSystem.Tables[0].Rows[0]["SYSTEM_ORDER_INDEX"]) + 1;
            }
            else
            {
                systemIndex = 1;
            }

            strSql = "select * from Information where Information_Level_ID=" + hfTrainTypeID.Value + " order by LEVEL_ORDER_INDEX desc";
            DataSet dsLevel = oa.RunSqlDataSet(strSql);

            if (dsLevel.Tables[0].Rows.Count > 0)
            {
                levelIndex = Convert.ToInt32(dsLevel.Tables[0].Rows[0]["LEVEL_ORDER_INDEX"]) + 1;
            }
            else
            {
                levelIndex = 1;
            }

            strSql = @"insert into Information(Information_ID,Information_Name,Information_System_ID,Information_No,
                Publish_Org,Publish_Date,Authors,KeyWords,Page_Count,Word_Count,Description,Last_Update_Person,
                Last_Update_Date,Memo,Version,Information_Level_ID,Create_Person,Create_Org_ID,
                SYSTEM_ORDER_INDEX,LEVEL_ORDER_INDEX) values( 
                " + strNewID + ",'" + txtBookName.Text.Trim() + @"'," + hfKnowledgeID.Value + @",'" + txtBookNo.Text.Trim() + @"',
                '" + txtPublishOrgName.Text.Trim() + @"',
                " + (datePublishDate.DateValue == null ? "null" : "to_date('" + datePublishDate.DateValue + "','yyyy-MM-dd')") + @",
                '" + txtAuthors.Text.Trim() + @"','" + txtKeyWords.Text.Trim() + @"',
                " + (txtPageCount.Text.Trim() == string.Empty ? "null" : txtPageCount.Text.Trim()) + @",
                " + (txtWordCount.Text.Trim() == string.Empty ? "null" : txtWordCount.Text.Trim()) + @",
                '" + txtDescription.Text.Trim() + @"','" + PrjPub.CurrentLoginUser.EmployeeName + @"',
                sysdate,'" + txtMemo.Text.Trim() + @"',1," + hfTrainTypeID.Value + @" ,
                " + PrjPub.CurrentLoginUser.EmployeeID + @"," + PrjPub.CurrentLoginUser.StationOrgID + @",
                " + systemIndex + @"," + levelIndex + @")";

            oa.RunSqlDataSet(strSql);

            string strPath = Server.MapPath("../Online/AssistBook/" + strNewID);

            Directory.CreateDirectory(strPath);
            Directory.CreateDirectory(strPath + "/Upload");
            CopyTemplate(Server.MapPath("../Online/AssistBook/template/"), Server.MapPath("../Online/AssistBook/" + strNewID + "/"));

            SaveBookCover(strNewID);
            return(Convert.ToInt32(strNewID));
        }
        protected void ButtonOutPut_Click(object sender, EventArgs e)
        {
            string strAllId = ViewState["ChooseId"].ToString();

            if (strAllId == "")
            {
                return;
            }

            string strOldAllId = "," + strAllId + ",";
            string strRemove   = string.Empty;

            for (int i = 0; i < this.gvChoose.Rows.Count; i++)
            {
                CheckBox CheckBox1 = (CheckBox)this.gvChoose.Rows[i].FindControl("chkSelect2");
                string   strEmId   = ((Label)this.gvChoose.Rows[i].FindControl("LabelEmployeeID")).Text;
                if (CheckBox1.Checked)
                {
                    strOldAllId = strOldAllId.Replace(strEmId + ",", "");

                    if (strRemove == string.Empty)
                    {
                        strRemove = strEmId;
                    }
                    else
                    {
                        strRemove += "," + strEmId;
                    }
                }
            }

            int n = strOldAllId.Length;

            if (n == 1)
            {
                if (ViewState["HasTrainClass"].ToString() == "1")
                {
                    SessionSet.PageMessage = "培训班考试不能移除全部考生!";
                    return;
                }
                ViewState["ChooseId"] = "";
            }
            else
            {
                ViewState["ChooseId"] = strOldAllId.Substring(1, n - 2);
            }

            //移除考生需要清楚考生安排明细
            string       strID = Request.QueryString.Get("id");
            OracleAccess db    = new OracleAccess();
            //查询当前考试所有考生安排明细
            string  strSql  = "select * from Random_Exam_Arrange_Detail where Random_Exam_ID=" + strID;
            DataSet dsOther = db.RunSqlDataSet(strSql);

            //遍历当前需要移除的考生信息,查询考生安排明细是否存在当前需要移除的考生,如果存在则需修改去除该考生
            string[] str = strRemove.Split(',');
            for (int i = 0; i < str.Length; i++)
            {
                string    strReplace = "," + str[i] + ",";
                DataRow[] drs        = dsOther.Tables[0].Select("','+User_Ids+',' like '%" + strReplace + "%'");

                if (drs.Length > 0)
                {
                    strSql = "update Random_Exam_Arrange_Detail "
                             + "set User_ids = substr(Replace(','||User_ids||',','" + strReplace +
                             "',','),2,length(Replace(','||User_ids||',','" + strReplace + "',','))-2) "
                             + "where  ','|| User_ids || ',' like '%" + strReplace + "%' and Random_Exam_ID=" + strID;

                    db.ExecuteNonQuery(strSql);
                }
            }

            //移除User_Ids为空的考生安排明细
            strSql = "delete from Random_Exam_Arrange_Detail where Random_Exam_ID=" + strID +
                     " and  User_Ids is null";
            db.ExecuteNonQuery(strSql);

            //删除没有相关微机教室的Random_Exam_Computer_Server数据
            strSql =
                @"delete from random_exam_computer_server 
                    where Random_Exam_ID=" + strID + @"
                    and Computer_Server_No not in (select  to_number(c.Computer_Server_No)
                    from Random_Exam_Arrange_Detail a
                    inner join Computer_Room b on a.Computer_Room_ID=b.Computer_Room_ID
                    inner join Computer_Server c on b.Computer_Server_ID=c.Computer_Server_ID
                    where Random_Exam_ID=" + strID + @")";
            db.ExecuteNonQuery(strSql);

            BindChoosedGrid(ViewState["ChooseId"].ToString());

            SaveChoose();
        }
示例#18
0
        private DataTable GetInfo()
        {
            try
            {
                string strwhere = "";
                if (hfOrgID.Value != "0")
                {
                    strwhere += " and getstationorgid(a.org_id)=" + hfOrgID.Value;
                }
                else
                {
                    int railSystemId = PrjPub.GetRailSystemId();
                    if (railSystemId != 0)
                    {
                        strwhere += " and (GetRailSystemId(a.org_id)=" + railSystemId + " or getstationorgid(a.org_id)=" + PrjPub.CurrentLoginUser.StationOrgID + ")";
                    }
                }

                OracleAccess  access = new OracleAccess();
                StringBuilder sql    = new StringBuilder();
                sql.Append("select v.* from (select to_char(b.short_name),b.Order_Index,");
                sql.Append(" count(*) as 合计1,");
                sql.Append(" sum(case   when Unit='全国' then 1 else 0 end) as 全国,");
                sql.Append(" sum(case   when Unit='铁道部' then 1 else 0 end) as 铁道部,");
                sql.Append(" sum(case   when Unit='铁路局' then 1 else 0 end) as 铁路局,");
                sql.Append(" sum(case   when Unit='站段' then 1 else 0 end) as 站段,");
                sql.Append(" count(*) as 合计2,");
                sql.Append(" sum(case   when MATCH_TYPE='单项' then 1 else 0 end) as 单项,");
                sql.Append(" sum(case   when MATCH_TYPE='全能' then 1 else 0 end) as 全能,");
                sql.Append(" sum(case   when MATCH_TYPE='团体' then 1 else 0 end) as 团体,");
                sql.Append(" sum(case   when MATCH_TYPE='全国' then 1 else 0 end) as 其他");
                sql.AppendFormat(" from zj_employee_match c "
                                 + " inner join Employee a on a.Employee_ID=c.Employee_ID"
                                 + " inner join org b on getstationorgid(a.org_id)=b.org_id where a.ISREGISTERED=1 {0}", strwhere);
                sql.Append(" group by b.Short_Name,b.Order_Index   ");

                sql.Append(" union select '合计',0, ");
                sql.Append(" count(*) as 合计1,");
                sql.Append(" sum(case   when Unit='全国' then 1 else 0 end) as 全国,");
                sql.Append(" sum(case   when Unit='铁道部' then 1 else 0 end) as 铁道部,");
                sql.Append(" sum(case   when Unit='铁路局' then 1 else 0 end) as 铁路局,");
                sql.Append(" sum(case   when Unit='站段' then 1 else 0 end) as 站段,");
                sql.Append(" count(*) as 合计2,");
                sql.Append(" sum(case   when MATCH_TYPE='单项' then 1 else 0 end) as 单项,");
                sql.Append(" sum(case   when MATCH_TYPE='全能' then 1 else 0 end) as 全能,");
                sql.Append(" sum(case   when MATCH_TYPE='团体' then 1 else 0 end) as 团体,");
                sql.Append(" sum(case   when MATCH_TYPE='全国' then 1 else 0 end) as 其他");
                strwhere = "";
                if (hfOrgID.Value != "0")
                {
                    strwhere += " and getstationorgid(a.org_id)=" + hfOrgID.Value;
                }
                else
                {
                    int railSystemId = PrjPub.GetRailSystemId();
                    if (railSystemId != 0)
                    {
                        strwhere += " and (GetRailSystemId(a.org_id)=" + railSystemId + " or getstationorgid(a.org_id)=" + PrjPub.CurrentLoginUser.StationOrgID + ")";
                    }
                }
                sql.AppendFormat(" from zj_employee_match c "
                                 + " inner join Employee a on a.Employee_ID=c.Employee_ID"
                                 + " inner join org b on getstationorgid(a.org_id)=b.org_id where a.ISREGISTERED=1 {0}", strwhere);
                sql.Append(" ) v order by v.order_index");
                DataTable dt = access.RunSqlDataSet(sql.ToString()).Tables[0];
                //dt.Columns.Remove("Order_Index");

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    dt.Rows[i]["Order_Index"] = i;
                }

                return(dt);
            }
            catch
            {
                return(null);
            }
        }
示例#19
0
 private void BindGrid(int n)
 {
     if (n == 0)
     {
         EducationLevelBLL      objBLL  = new EducationLevelBLL();
         IList <EducationLevel> objList = objBLL.GetAllEducationLevel();
         Grid1.DataSource = objList;
         Grid1.DataBind();
         Grid1.Visible = true;
         Grid2.Visible = false;
         Grid3.Visible = false;
         Grid4.Visible = false;
         Grid5.Visible = false;
         Grid6.Visible = false;
         Grid7.Visible = false;
         Grid8.Visible = false;
         Grid9.Visible = false;
     }
     if (n == 1)
     {
         PoliticalStatusBLL      objBLL  = new PoliticalStatusBLL();
         IList <PoliticalStatus> objList = objBLL.GetAllPoliticalStatus();
         Grid2.DataSource = objList;
         Grid2.DataBind();
         Grid1.Visible = false;
         Grid2.Visible = true;
         Grid3.Visible = false;
         Grid4.Visible = false;
         Grid5.Visible = false;
         Grid6.Visible = false;
         Grid7.Visible = false;
         Grid8.Visible = false;
         Grid9.Visible = false;
     }
     if (n == 2)
     {
         WorkGroupLeaderLevelBLL      objBLL  = new WorkGroupLeaderLevelBLL();
         IList <WorkGroupLeaderLevel> objList = objBLL.GetAllWorkGroupLeaderLevel();
         Grid3.DataSource = objList;
         Grid3.DataBind();
         Grid1.Visible = false;
         Grid2.Visible = false;
         Grid3.Visible = true;
         Grid4.Visible = false;
         Grid5.Visible = false;
         Grid6.Visible = false;
         Grid7.Visible = false;
         Grid8.Visible = false;
         Grid9.Visible = false;
     }
     if (n == 3)
     {
         TechnicianTypeBLL      objBLL  = new TechnicianTypeBLL();
         IList <TechnicianType> objList = objBLL.GetAllTechnicianType();
         Grid4.DataSource = objList;
         Grid4.DataBind();
         Grid1.Visible = false;
         Grid2.Visible = false;
         Grid3.Visible = false;
         Grid4.Visible = true;
         Grid5.Visible = false;
         Grid6.Visible = false;
         Grid7.Visible = false;
         Grid8.Visible = false;
         Grid9.Visible = false;
     }
     if (n == 4)
     {
         TechnicianTitleTypeBLL      objBLL  = new TechnicianTitleTypeBLL();
         IList <TechnicianTitleType> objList = objBLL.GetAllTechnicianTitleType();
         Grid5.DataSource = objList;
         Grid5.DataBind();
         Grid1.Visible = false;
         Grid2.Visible = false;
         Grid3.Visible = false;
         Grid4.Visible = false;
         Grid5.Visible = true;
         Grid6.Visible = false;
         Grid7.Visible = false;
         Grid8.Visible = false;
         Grid9.Visible = false;
     }
     if (n == 5)
     {
         EducationEmployeeTypeBLL      objBLL  = new EducationEmployeeTypeBLL();
         IList <EducationEmployeeType> objList = objBLL.GetAllEducationEmployeeType();
         Grid6.DataSource = objList;
         Grid6.DataBind();
         Grid1.Visible = false;
         Grid2.Visible = false;
         Grid3.Visible = false;
         Grid4.Visible = false;
         Grid5.Visible = false;
         Grid6.Visible = true;
         Grid7.Visible = false;
         Grid8.Visible = false;
         Grid9.Visible = false;
     }
     if (n == 6)
     {
         CommitteeHeadShipBLL      objBLL  = new CommitteeHeadShipBLL();
         IList <CommitteeHeadShip> objList = objBLL.GetAllCommitteeHeadShip();
         Grid7.DataSource = objList;
         Grid7.DataBind();
         Grid1.Visible = false;
         Grid2.Visible = false;
         Grid3.Visible = false;
         Grid4.Visible = false;
         Grid5.Visible = false;
         Grid6.Visible = false;
         Grid7.Visible = true;
         Grid8.Visible = false;
         Grid9.Visible = false;
     }
     if (n == 7)
     {
         RandomExamModularTypeBLL      objBLL  = new RandomExamModularTypeBLL();
         IList <RandomExamModularType> objList = objBLL.GetAllRandomExamModularType();
         Grid8.DataSource = objList;
         Grid8.DataBind();
         Grid1.Visible = false;
         Grid2.Visible = false;
         Grid3.Visible = false;
         Grid4.Visible = false;
         Grid5.Visible = false;
         Grid6.Visible = false;
         Grid7.Visible = false;
         Grid8.Visible = true;
         Grid9.Visible = false;
     }
     if (n == 8)
     {
         OracleAccess oracle = new OracleAccess();
         DataTable    dt     = oracle.RunSqlDataSet("select * from zj_trainplan_type order by trainplan_type_id").Tables[0];
         Grid9.DataSource = dt;
         Grid9.DataBind();
         Grid1.Visible = false;
         Grid2.Visible = false;
         Grid3.Visible = false;
         Grid4.Visible = false;
         Grid5.Visible = false;
         Grid6.Visible = false;
         Grid7.Visible = false;
         Grid8.Visible = false;
         Grid9.Visible = true;
     }
     if (n == 9)
     {
         OracleAccess oracle = new OracleAccess();
         DataTable    dt     = oracle.RunSqlDataSet("select * from zj_safe_level order by order_index").Tables[0];
         Grid10.DataSource = dt;
         Grid10.DataBind();
         Grid1.Visible  = false;
         Grid2.Visible  = false;
         Grid3.Visible  = false;
         Grid4.Visible  = false;
         Grid5.Visible  = false;
         Grid6.Visible  = false;
         Grid7.Visible  = false;
         Grid8.Visible  = false;
         Grid9.Visible  = false;
         Grid10.Visible = true;
     }
     if (n == 10)
     {
         OracleAccess oracle = new OracleAccess();
         DataTable    dt     = oracle.RunSqlDataSet("select * from zj_certificate order by order_index").Tables[0];
         Grid11.DataSource = dt;
         Grid11.DataBind();
         Grid1.Visible  = false;
         Grid2.Visible  = false;
         Grid3.Visible  = false;
         Grid4.Visible  = false;
         Grid5.Visible  = false;
         Grid6.Visible  = false;
         Grid7.Visible  = false;
         Grid8.Visible  = false;
         Grid9.Visible  = false;
         Grid10.Visible = false;
         Grid11.Visible = true;
     }
     if (n == 11)
     {
         OracleAccess oracle = new OracleAccess();
         DataTable    dt     = oracle.RunSqlDataSet(@"select a.*,b.certificate_name from zj_certificate_level a 
                                               left join zj_certificate b on a.certificate_id=b.certificate_id order by a.order_index").Tables[0];
         Grid12.DataSource = dt;
         Grid12.DataBind();
         Grid1.Visible  = false;
         Grid2.Visible  = false;
         Grid3.Visible  = false;
         Grid4.Visible  = false;
         Grid5.Visible  = false;
         Grid6.Visible  = false;
         Grid7.Visible  = false;
         Grid8.Visible  = false;
         Grid9.Visible  = false;
         Grid10.Visible = false;
         Grid11.Visible = false;
         Grid12.Visible = true;
     }
     if (n == 12)
     {
         OracleAccess oracle = new OracleAccess();
         DataTable    dt     = oracle.RunSqlDataSet(" select * from zj_certificate_unit order by order_index").Tables[0];
         Grid13.DataSource = dt;
         Grid13.DataBind();
         Grid1.Visible  = false;
         Grid2.Visible  = false;
         Grid3.Visible  = false;
         Grid4.Visible  = false;
         Grid5.Visible  = false;
         Grid6.Visible  = false;
         Grid7.Visible  = false;
         Grid8.Visible  = false;
         Grid9.Visible  = false;
         Grid10.Visible = false;
         Grid11.Visible = false;
         Grid12.Visible = false;
         Grid13.Visible = true;
     }
     if (n == 13)
     {
         OracleAccess oracle = new OracleAccess();
         DataTable    dt     = oracle.RunSqlDataSet(" select * from zj_train_unit order by order_index").Tables[0];
         Grid14.DataSource = dt;
         Grid14.DataBind();
         Grid1.Visible  = false;
         Grid2.Visible  = false;
         Grid3.Visible  = false;
         Grid4.Visible  = false;
         Grid5.Visible  = false;
         Grid6.Visible  = false;
         Grid7.Visible  = false;
         Grid8.Visible  = false;
         Grid9.Visible  = false;
         Grid10.Visible = false;
         Grid11.Visible = false;
         Grid12.Visible = false;
         Grid13.Visible = false;
         Grid14.Visible = true;
     }
 }
        private void BindGrid(string strOrderBy)
        {
            //HasExamId();

            int nItemcount = 0;
            int startRow   = int.Parse(ViewState["StartRow"].ToString());
            int endRow     = int.Parse(ViewState["EndRow"].ToString());

            string strWhere = GetWhereClause();

            //从ViewState中读取页码值保存到CurrentPage变量中进行按钮失效运算
            CurrentPage = (int)ViewState["PageIndex"];
            //从ViewState中读取总页参数进行按钮失效运算
            PageCount = (int)ViewState["PageCounts"];
            //判断四个按钮(首页、上页、下页、尾页)状态
            if (CurrentPage + 1 > 1)
            {
                Fistpage.Enabled = true;
                Prevpage.Enabled = true;
            }
            else
            {
                Fistpage.Enabled = false;
                Prevpage.Enabled = false;
            }
            if (CurrentPage == PageCount)
            {
                Nextpage.Enabled = false;
                Lastpage.Enabled = false;
            }
            else
            {
                Nextpage.Enabled = true;
                Lastpage.Enabled = true;
            }

            string strSql =
                @" select  * from 
                    (select rownum rn ,t.* from 
                    (select a.*,b.Type_Name as TypeName
                     from Item a
                     inner join  Item_Type b on a.Type_Id=b.item_type_id
                     inner join Book_Chapter c on a.Chapter_ID=c.Chapter_ID 
                     where 1=1 " + strWhere + @"
                     order by " + strOrderBy + @" ) t
                     where rownum<(" + endRow + @"+1)) where rn>(" + startRow + ")";

            OracleAccess db = new OracleAccess();
            DataSet      ds = db.RunSqlDataSet(strSql);

            if (ds.Tables[0].Rows.Count > 0)
            {
                Grid1.VirtualItemCount = nItemcount;
                Grid1.DataSource       = ds.Tables[0];
                Grid1.DataBind();
                ViewState["EmptyFlag"] = 0;

                RecordCount = ds.Tables[0].Rows.Count;

                //显示文本框控件txtJumpPage状态
                txtJumpPage.Text = (CurrentPage + 1).ToString();
            }
            else
            {
                BindEmptyGrid1();
                txtJumpPage.Text = (CurrentPage + 1).ToString();
                RecordCount      = 0;
            }
        }
        private void BindGrid()
        {
            string strBegin = dateBeginTime.DateValue.ToString() + " " + ddlBeginHour.SelectedValue + ":00:00";
            string strEnd   = dateEndTime.DateValue.ToString() + " " + ddlEndHour.SelectedValue + ":00:00";

            string strSql = "select a.COMPUTER_ROOM_ID,c.COMPUTER_ROOM_Name,Apply_Start_Time,Apply_End_Time, "
                            + "'被'|| b.Short_Name || '占用'   UseStatus,COMPUTER_ROOM_APPLY_ID,d.Short_Name orgName,1 as UseStatusID "
                            + "from Computer_Room_Apply a "
                            + " inner join org b on a.org_id=b.org_id"
                            + " inner join Computer_Room c on a.Computer_Room_ID=c.Computer_Room_ID "
                            + " inner join org d on c.org_id=d.org_id"
                            + " where  a.REPLY_STATUS=1 and a.Computer_Room_ID=" + Request.QueryString.Get("roomId")
                            + " and  a.Apply_End_Time >= to_date('" + strBegin + "','YYYY-MM-DD HH24:MI:SS')"
                            + " and a.Apply_Start_Time <= to_date('" + strEnd + "','YYYY-MM-DD HH24:MI:SS') "
                            + " order by a.Apply_Start_Time ";

            OracleAccess oracle = new OracleAccess();
            DataTable    db     = oracle.RunSqlDataSet(strSql).Tables[0];

            if (db.Rows.Count == 0)
            {
                DataRow row = db.NewRow();
                row["COMPUTER_ROOM_APPLY_ID"] = -1;
                db.Rows.Add(row);
            }
            else
            {
                DateTime beginDate = Convert.ToDateTime(strBegin);
                DateTime endDate   = Convert.ToDateTime(strEnd);

                DataTable dt = db.Clone();

                int n = 0;
                for (int i = 0; i < db.Rows.Count; i++)
                {
                    DataRow drNew = dt.NewRow();
                    drNew["COMPUTER_ROOM_APPLY_ID"] = n;
                    drNew["orgName"]            = db.Rows[i]["orgName"].ToString();
                    drNew["Computer_Room_ID"]   = db.Rows[i]["Computer_Room_ID"].ToString();
                    drNew["Computer_Room_Name"] = db.Rows[i]["Computer_Room_Name"].ToString();

                    DateTime begin = Convert.ToDateTime(db.Rows[i]["Apply_Start_Time"].ToString());
                    DateTime end   = Convert.ToDateTime(db.Rows[i]["Apply_End_Time"].ToString());

                    if (i == 0)
                    {
                        if (begin <= beginDate)
                        {
                            drNew["Apply_Start_Time"] = beginDate;
                            drNew["Apply_End_Time"]   = end;
                            drNew["UseStatus"]        = db.Rows[i]["UseStatus"].ToString();
                            drNew["UseStatusID"]      = 1;
                            dt.Rows.Add(drNew);
                            n++;
                        }
                        else if (begin > beginDate)
                        {
                            drNew["Apply_Start_Time"] = beginDate;
                            drNew["Apply_End_Time"]   = end;
                            drNew["UseStatus"]        = "空闲";
                            drNew["UseStatusID"]      = 0;
                            dt.Rows.Add(drNew);
                            n++;
                        }
                    }
                    else
                    {
                        DateTime lastbegin = Convert.ToDateTime(db.Rows[i - 1]["Apply_Start_Time"].ToString());
                        DateTime lastend   = Convert.ToDateTime(db.Rows[i - 1]["Apply_End_Time"].ToString());

                        //当上一个的结束时间小于开始时间,那么上一个的结束时间到开始时间空闲
                        if (lastend < begin)
                        {
                            drNew["Apply_Start_Time"] = lastend;
                            drNew["Apply_End_Time"]   = begin;
                            drNew["UseStatus"]        = "空闲";
                            drNew["UseStatusID"]      = 0;
                            dt.Rows.Add(drNew);
                            n++;
                        }

                        //当结束时间小于查询截止时间,那么需添加一行占用信息
                        if (end < endDate)
                        {
                            drNew = dt.NewRow();
                            drNew["COMPUTER_ROOM_APPLY_ID"] = n;
                            drNew["orgName"]            = db.Rows[i]["orgName"].ToString();
                            drNew["Computer_Room_ID"]   = db.Rows[i]["Computer_Room_ID"].ToString();
                            drNew["Computer_Room_Name"] = db.Rows[i]["Computer_Room_Name"].ToString();
                            drNew["Apply_Start_Time"]   = begin;
                            drNew["Apply_End_Time"]     = end;
                            drNew["UseStatus"]          = db.Rows[i]["UseStatus"].ToString();
                            drNew["UseStatusID"]        = 1;
                            dt.Rows.Add(drNew);
                            n++;
                        }
                    }

                    if (i == db.Rows.Count - 1)
                    {
                        //当最后一个时间的结束时间大于等于查询截止时间,那么最后一个开始时间到查询截止时间不空闲
                        if (end >= endDate)
                        {
                            drNew = dt.NewRow();
                            drNew["COMPUTER_ROOM_APPLY_ID"] = n;
                            drNew["orgName"]            = db.Rows[i]["orgName"].ToString();
                            drNew["Computer_Room_ID"]   = db.Rows[i]["Computer_Room_ID"].ToString();
                            drNew["Computer_Room_Name"] = db.Rows[i]["Computer_Room_Name"].ToString();

                            drNew["Apply_Start_Time"] = begin;
                            drNew["Apply_End_Time"]   = endDate;
                            drNew["UseStatus"]        = db.Rows[i]["UseStatus"].ToString();
                            drNew["UseStatusID"]      = 1;
                            dt.Rows.Add(drNew);
                            n++;
                        }
                        //当最后一个时间的结束时间小于查询截止时间,那么最后一个结束时间到查询截止时间空闲
                        else if (end < endDate)
                        {
                            drNew = dt.NewRow();
                            drNew["COMPUTER_ROOM_APPLY_ID"] = n;
                            drNew["orgName"]            = db.Rows[i]["orgName"].ToString();
                            drNew["Computer_Room_ID"]   = db.Rows[i]["Computer_Room_ID"].ToString();
                            drNew["Computer_Room_Name"] = db.Rows[i]["Computer_Room_Name"].ToString();

                            drNew["Apply_Start_Time"] = end;
                            drNew["Apply_End_Time"]   = endDate;
                            drNew["UseStatus"]        = "空闲";
                            drNew["UseStatusID"]      = 0;
                            dt.Rows.Add(drNew);
                            n++;
                        }
                    }
                }
                grdEntity.DataSource = dt;
                grdEntity.DataBind();

                strSql = "select Org_ID from Computer_Room where Computer_Room_ID=" + Request.QueryString.Get("roomId");
                DataRow dr = oracle.RunSqlDataSet(strSql).Tables[0].Rows[0];
                ViewState["Org_ID"] = dr[0].ToString();
                if (PrjPub.CurrentLoginUser.StationOrgID.ToString() == dr[0].ToString())
                {
                    grdEntity.Columns[0].Visible = false;
                }
            }
        }
        protected void btnInput_Click(object sender, EventArgs e)
        {
            string strAllId = ViewState["ChooseId"].ToString();

            for (int i = 0; i < this.Grid1.Items.Count; i++)
            {
                CheckBox CheckBox1 = (CheckBox)this.Grid1.Items[i].FindControl("chkSelect");

                string strEmId = ((Label)this.Grid1.Items[i].FindControl("LabelItemID")).Text;
                if (CheckBox1.Checked)
                {
                    string strOldAllId = "," + strAllId + ",";
                    if (strOldAllId.IndexOf("," + strEmId + ",") == -1)
                    {
                        if (strAllId.Length == 0)
                        {
                            strAllId += strEmId;
                        }
                        else
                        {
                            strAllId += "," + strEmId;
                        }
                    }
                }
                else
                {
                    string strOldAllId = "," + strAllId + ",";
                    if (strOldAllId.IndexOf("," + strEmId + ",") >= 0)
                    {
                        strOldAllId = strOldAllId.Replace("," + strEmId + ",", ",");
                    }

                    strAllId = strOldAllId.TrimStart(',').TrimEnd(',');
                }
            }

            string strSql = "select * from Random_Exam_Item_Select ";

            if (ViewState["ID"].ToString() == string.Empty)
            {
                strSql += " where RANDOM_EXAM_STRATEGY_ID  is null  and Random_Exam_Subject_ID=" + ViewState["subjectId"];
            }
            else
            {
                strSql += " where RANDOM_EXAM_STRATEGY_ID=" + ViewState["ID"];
            }

            OracleAccess db = new OracleAccess();
            DataSet      ds = db.RunSqlDataSet(strSql);

            //遍历已选试题,发现已选试题ID不在当前所选中,删除。
            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                if (("," + strAllId + ",").IndexOf("," + dr["Item_ID"] + ",") < 0)
                {
                    strSql = "delete from Random_Exam_Item_Select where Random_Exam_Item_Select_ID=" + dr["Random_Exam_Item_Select_ID"];
                    db.ExecuteNonQuery(strSql);
                }
            }

            string[] str = strAllId.Split(',');
            for (int i = 0; i < str.Length; i++)
            {
                DataRow[] drs = ds.Tables[0].Select("Item_ID=" + str[i]);
                if (drs.Length == 0)
                {
                    strSql = @"insert into Random_Exam_Item_Select " +
                             " values(Random_Exam_Item_Select_Seq.nextval," + str[i] + "," + ViewState["ExamID"] + @"," + ViewState["ID"] + @"," + ViewState["subjectId"] + ")";
                    db.ExecuteNonQuery(strSql);
                }
            }
            Response.Write("<script>window.returnValue='true';window.close();</script>");
        }
示例#23
0
        protected void btnExam_Click(object sender, EventArgs e)
        {
            string        strId  = Request.QueryString.Get("eid");
            RandomExamBLL objBll = new RandomExamBLL();

            RailExam.Model.RandomExam obj = objBll.GetExam(Convert.ToInt32(strId));

            OracleAccess db = new OracleAccess();

            IList <RandomExamResult> examResults   = null;
            RandomExamResultBLL      bllExamResult = new RandomExamResultBLL();

            examResults = bllExamResult.GetRandomExamResults(int.Parse(strId), "", "", "", "", 0, 1000, Convert.ToInt32(Request.QueryString.Get("OrgID")));
            string strChooseID = string.Empty;

            foreach (RandomExamResult randomExamResult in examResults)
            {
                if (string.IsNullOrEmpty(strChooseID))
                {
                    strChooseID += randomExamResult.ExamineeId;
                }
                else
                {
                    strChooseID += "," + randomExamResult.ExamineeId;
                }
            }

            int    beginYear = obj.BeginTime.Year;
            string strSql    =
                @"select a.*,b.Employee_Name,b.Employee_ID from Random_Exam_Result a
                inner join Employee b on a.Examinee_ID=b.Employee_ID
                where Random_Exam_Result_ID not in (
                select distinct  a.Random_Exam_Result_ID from Random_Exam_Result_Answer a
                        inner join  Random_Exam_Result b on a.Random_Exam_Result_ID=b.Random_Exam_Result_ID
                        where Random_Exam_ID=" + strId + @"
                union all 
                select distinct  a.Random_Exam_Result_ID from Random_Exam_Result_Answer_" + beginYear + @" a
                         inner join  Random_Exam_Result b on a.Random_Exam_Result_ID=b.Random_Exam_Result_ID
                        where Random_Exam_ID=" + strId + @")
                and Random_Exam_ID=" + strId;
            DataSet dsAnswer = db.RunSqlDataSet(strSql);

            if (dsAnswer.Tables[0].Rows.Count > 0)
            {
                string strIDs = string.Empty;
                foreach (DataRow dr in dsAnswer.Tables[0].Rows)
                {
                    if (("," + strChooseID + ",").IndexOf("," + dr["Employee_ID"] + ",") >= 0)
                    {
                        if (string.IsNullOrEmpty(strIDs))
                        {
                            strIDs += dr["Employee_Name"].ToString();
                        }
                        else
                        {
                            strIDs += "," + dr["Employee_Name"];
                        }
                    }
                }

                if (string.IsNullOrEmpty(strIDs))
                {
                    SessionSet.PageMessage = "所有考生试卷完整!";
                }
                else
                {
                    SessionSet.PageMessage = "下列考生在路局服务器无考试试卷:" + strIDs;
                }
            }
            else
            {
                SessionSet.PageMessage = "所有考生试卷完整!";
            }
        }
示例#24
0
        private void ExportUpEmployee()
        {
            string       strSql = @"select  GetOrgName(GetStationOrgID(b.org_Id))   UnitName,
                            getworkshopname(b.org_id) WorkShopName,
                            case when c.level_num=4  then c.Short_Name else null end WorkGroupName,
                            Employee_Name, Identity_CardNo,
                            e.Train_Plan_Name,
                            d.Class_Name,f.Post_Name
                             from zj_train_plan_employee t 
                            inner join Employee b on t.Employee_ID=b.Employee_ID
                            inner join Org c on b.Org_ID=c.Org_ID
                            inner join ZJ_Train_Plan_Post_Class d on t.Train_Plan_Post_Class_ID=d.Train_Plan_Post_Class_ID
                            inner join ZJ_Train_Plan e on d.Train_Plan_ID=e.Train_Plan_ID
                            inner join Post f on b.Post_ID = f.Post_ID
                            where t.Train_Plan_Post_Class_Org_ID=" + Request.QueryString.Get("classOrgID");
            OracleAccess db     = new OracleAccess();
            DataSet      ds     = db.RunSqlDataSet(strSql);

            if (ds.Tables[0].Rows.Count == 0)
            {
                Response.Write("<script>alert('没有已上报的员工信息!');window.close();</script>");
                return;
            }

            string       templateFileName = Server.MapPath("/RailExamBao/RandomExam/ProgressBar.htm");
            StreamReader reader           = new StreamReader(@templateFileName, System.Text.Encoding.GetEncoding("gb2312"));
            string       html             = reader.ReadToEnd();

            reader.Close();
            Response.Write(html);
            Response.Flush();
            System.Threading.Thread.Sleep(200);

            string jsBlock;

            Excel.Application objApp      = new Excel.ApplicationClass();
            Excel.Workbooks   objbooks    = objApp.Workbooks;
            Excel.Workbook    objbook     = objbooks.Add(Excel.XlWBATemplate.xlWBATWorksheet);
            Excel.Worksheet   objSheet    = (Excel.Worksheet)objbook.Worksheets[1]; //取得sheet1
            string            filename    = "";
            string            strName     = "";
            string            strFileName = "";

            try
            {
                int count = ds.Tables[0].Rows.Count;
                strName     = "Excel";
                strFileName = ds.Tables[0].Rows[0]["UnitName"].ToString() + ds.Tables[0].Rows[0]["Class_Name"].ToString() + "上报人员";
                filename    = Server.MapPath("/RailExamBao/Excel/" + strName + ".xls");

                objSheet.Cells.Font.Size = 10;
                objSheet.Cells.Font.Name = "宋体";

                int colIndex = 1;
                objSheet.Cells[1, colIndex] = "序号";
                ((Excel.Range)objSheet.Cells[1, colIndex]).HorizontalAlignment = XlHAlign.xlHAlignCenter;

                colIndex++;
                objSheet.Cells[1, colIndex] = "站段";
                ((Excel.Range)objSheet.Cells[1, colIndex]).HorizontalAlignment = XlHAlign.xlHAlignCenter;

                colIndex++;
                objSheet.Cells[1, colIndex] = "车间";
                ((Excel.Range)objSheet.Cells[1, colIndex]).HorizontalAlignment = XlHAlign.xlHAlignCenter;

                colIndex++;
                objSheet.Cells[1, colIndex] = "班组";
                ((Excel.Range)objSheet.Cells[1, colIndex]).HorizontalAlignment = XlHAlign.xlHAlignCenter;

                colIndex++;
                objSheet.Cells[1, colIndex] = "姓名";
                ((Excel.Range)objSheet.Cells[1, colIndex]).HorizontalAlignment = XlHAlign.xlHAlignCenter;

                colIndex++;
                objSheet.Cells[1, colIndex] = "身份证号";
                ((Excel.Range)objSheet.Cells[1, colIndex]).HorizontalAlignment = XlHAlign.xlHAlignCenter;

                colIndex++;
                objSheet.Cells[1, colIndex] = "职名";
                ((Excel.Range)objSheet.Cells[1, colIndex]).HorizontalAlignment = XlHAlign.xlHAlignCenter;

                colIndex++;
                objSheet.Cells[1, colIndex] = "上报培训计划名";
                ((Excel.Range)objSheet.Cells[1, colIndex]).HorizontalAlignment = XlHAlign.xlHAlignCenter;

                colIndex++;
                objSheet.Cells[1, colIndex] = "上报计划培训班名";
                ((Excel.Range)objSheet.Cells[1, colIndex]).HorizontalAlignment = XlHAlign.xlHAlignCenter;

                System.Threading.Thread.Sleep(10);
                jsBlock = "<script>SetPorgressBar('导出培训计划上报人员','" + ((double)(1 * 100) / (double)count + 1).ToString("0.00") + "'); </script>";
                Response.Write(jsBlock);
                Response.Flush();

                int rowIndex = 2;
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    colIndex = 1;
                    objSheet.Cells[rowIndex, colIndex] = rowIndex - 1;
                    ((Excel.Range)objSheet.Cells[rowIndex, colIndex]).HorizontalAlignment = XlHAlign.xlHAlignCenter;

                    colIndex++;
                    objSheet.Cells[rowIndex, colIndex] = dr["UnitName"].ToString();
                    ((Excel.Range)objSheet.Cells[rowIndex, colIndex]).HorizontalAlignment = XlHAlign.xlHAlignCenter;

                    colIndex++;
                    objSheet.Cells[rowIndex, colIndex] = dr["WorkShopName"].ToString();
                    ((Excel.Range)objSheet.Cells[rowIndex, colIndex]).HorizontalAlignment = XlHAlign.xlHAlignCenter;

                    colIndex++;
                    objSheet.Cells[rowIndex, colIndex] = dr["WorkGroupName"].ToString();
                    ((Excel.Range)objSheet.Cells[rowIndex, colIndex]).HorizontalAlignment = XlHAlign.xlHAlignCenter;

                    colIndex++;
                    objSheet.Cells[rowIndex, colIndex] = dr["Employee_Name"].ToString();
                    ((Excel.Range)objSheet.Cells[rowIndex, colIndex]).HorizontalAlignment = XlHAlign.xlHAlignCenter;

                    colIndex++;
                    objSheet.Cells[rowIndex, colIndex] = "'" + dr["Identity_CardNo"];
                    ((Excel.Range)objSheet.Cells[rowIndex, colIndex]).HorizontalAlignment = XlHAlign.xlHAlignCenter;

                    colIndex++;
                    objSheet.Cells[rowIndex, colIndex] = dr["Post_Name"].ToString();
                    ((Excel.Range)objSheet.Cells[rowIndex, colIndex]).HorizontalAlignment = XlHAlign.xlHAlignCenter;

                    colIndex++;
                    objSheet.Cells[rowIndex, colIndex] = dr["Train_Plan_Name"].ToString();
                    ((Excel.Range)objSheet.Cells[rowIndex, colIndex]).HorizontalAlignment = XlHAlign.xlHAlignCenter;

                    colIndex++;
                    objSheet.Cells[rowIndex, colIndex] = dr["Class_Name"].ToString();
                    ((Excel.Range)objSheet.Cells[rowIndex, colIndex]).HorizontalAlignment = XlHAlign.xlHAlignCenter;

                    System.Threading.Thread.Sleep(10);
                    jsBlock = "<script>SetPorgressBar('导出培训计划上报人员','" + ((double)(rowIndex * 100) / (double)count + 1).ToString("0.00") + "'); </script>";
                    Response.Write(jsBlock);
                    Response.Flush();

                    rowIndex++;
                }

                objSheet.Cells.Columns.AutoFit();

                objApp.Visible = false;

                objbook.Saved = true;
                objbook.SaveCopyAs(filename);

                // 处理完成
                jsBlock = "<script>SetCompleted('处理完成。'); </script>";
                Response.Write(jsBlock);
                Response.Flush();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                objbook.Close(Type.Missing, filename, Type.Missing);
                objbooks.Close();
                objApp.Application.Workbooks.Close();
                objApp.Application.Quit();
                objApp.Quit();
                GC.Collect();
            }

            Response.Write("<script>top.returnValue='" + strName + "|" + strFileName + "';window.close();</script>");
        }
        private DataTable GetInfo()
        {
            try
            {
                string strwhere = "";
                if (hfOrgID.Value != "0")
                {
                    strwhere += " and getstationorgid(a.org_id)=" + hfOrgID.Value;
                }
                else
                {
                    int railSystemId = PrjPub.GetRailSystemId();
                    if (railSystemId != 0)
                    {
                        strwhere += " and (GetRailSystemId(a.org_id)=" + railSystemId + " or getstationorgid(a.org_id)=" + PrjPub.CurrentLoginUser.StationOrgID + ")";
                    }
                }

                OracleAccess  access = new OracleAccess();
                StringBuilder sql    = new StringBuilder();
                sql.Append("select v.* from (select to_char(b.short_name),b.Order_Index,");
                sql.Append(" count(*) as 合计");

                string strSql = "select a.* from ZJ_CERTIFICATE_LEVEL a "
                                + "inner join ZJ_CERTIFICATE c on a.CERTIFICATE_ID=c.CERTIFICATE_ID "
                                + " order by c.CERTIFICATE_ID,a.ORDER_INDEX";
                DataTable dtLevel = access.RunSqlDataSet(strSql).Tables[0];

                foreach (DataRow dr in dtLevel.Rows)
                {
                    sql.Append(",sum(case   when CERTIFICATE_LEVEL_ID=" + dr["CERTIFICATE_LEVEL_ID"] + " then 1 else 0 end) as \"" + dr["CERTIFICATE_LEVEL_NAME"] + "\"");
                }

                sql.AppendFormat(" from ZJ_EMPLOYEE_CERTIFICATE c "
                                 + " inner join Employee a on a.Employee_ID=c.Employee_ID"
                                 + " inner join org b on getstationorgid(a.org_id)=b.org_id where a.ISREGISTERED=1 {0}", strwhere);
                sql.Append(" group by b.Short_Name,b.Order_Index   ");

                sql.Append(" union select '合计',0, ");
                sql.Append(" count(*) as 合计");
                foreach (DataRow dr in dtLevel.Rows)
                {
                    sql.Append(",sum(case   when CERTIFICATE_LEVEL_ID=" + dr["CERTIFICATE_LEVEL_ID"] + " then 1 else 0 end) as \"" + dr["CERTIFICATE_LEVEL_NAME"] + "\"");
                }

                strwhere = "";
                if (hfOrgID.Value != "0")
                {
                    strwhere += " and getstationorgid(a.org_id)=" + hfOrgID.Value;
                }
                else
                {
                    int railSystemId = PrjPub.GetRailSystemId();
                    if (railSystemId != 0)
                    {
                        strwhere += " and (GetRailSystemId(a.org_id)=" + railSystemId + " or getstationorgid(a.org_id)=" + PrjPub.CurrentLoginUser.StationOrgID + ")";
                    }
                }
                sql.AppendFormat(" from ZJ_EMPLOYEE_CERTIFICATE c "
                                 + " inner join Employee a on a.Employee_ID=c.Employee_ID"
                                 + " inner join org b on getstationorgid(a.org_id)=b.org_id where a.ISREGISTERED=1 {0}", strwhere);
                sql.Append(" ) v order by v.order_index");
                DataTable dt = access.RunSqlDataSet(sql.ToString()).Tables[0];
                //dt.Columns.Remove("Order_Index");

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    dt.Rows[i]["Order_Index"] = i;
                }

                return(dt);
            }
            catch
            {
                return(null);
            }
        }
示例#26
0
        private void BindOrganizationTree(ArrayList orgidAL)
        {
            string strIds  = Request.QueryString.Get("selectOrgID");
            string classId = Request.QueryString.Get("classId");

            OracleAccess access = new OracleAccess();

            string  strSql = "select * from ZJ_Train_Plan_Post_Class_Org where Train_Plan_Post_Class_ID=" + classId;
            DataSet ds     = access.RunSqlDataSet(strSql);

            if (ds.Tables[0].Rows.Count > 0)
            {
                strSql = "select org_id,short_name,full_name from  org "
                         + " where level_num=2 and Is_Effect=1 "
                         + " and org_id not in (select org_id from ZJ_Train_Plan_Post_Class_Org "
                         + " where Train_Plan_Post_Class_ID=" + classId
                         + ") order by order_index";
            }
            else
            {
                strSql = "select org_id,short_name,full_name from  org "
                         + " where level_num=2 and Is_Effect=1  order by order_index";
            }

            DataTable dt =
                access.RunSqlDataSet(strSql).Tables[0];

            if (dt != null && dt.Rows.Count > 0)
            {
                TreeViewNode tvn = null;

                foreach (DataRow r in dt.Rows)
                {
                    tvn              = new TreeViewNode();
                    tvn.ID           = r["org_id"].ToString();
                    tvn.Value        = r["org_id"].ToString();
                    tvn.Text         = r["short_name"].ToString();
                    tvn.ToolTip      = r["full_name"].ToString();
                    tvn.ShowCheckBox = true;

                    if (("," + strIds + ",").IndexOf("," + r["org_id"] + ",") >= 0)
                    {
                        tvn.Checked = true;
                    }

                    if (orgidAL.Count > 0)
                    {
                        if (orgidAL.IndexOf(r["org_id"]) != -1)
                        {
                            tvn.Checked = true;
                        }
                    }
                    try
                    {
                        tvOrg.Nodes.Add(tvn);
                    }
                    catch
                    {
                        tvOrg.Nodes.Clear();
                        SessionSet.PageMessage = "数据错误!";
                        return;
                    }
                }
                tvOrg.DataBind();
                if (tvOrg.Nodes.Count > 0)
                {
                    tvOrg.Nodes[0].Expanded = true;
                }
            }
        }
        protected void btnOk_Click(object sender, EventArgs e)
        {
            string[] strID = hfEmployeeID.Value.Split(',');

            EmployeeTransferBLL      objBll  = new EmployeeTransferBLL();
            IList <EmployeeTransfer> objList = new List <EmployeeTransfer>();

            OracleAccess db = new OracleAccess();
            string       strSql;

            if (PrjPub.CurrentLoginUser.SuitRange == 1)
            {
                strSql = @"select getstationorgid(org_id) stationorgid,count(*) AdminCount, 
                            GetOrgName(getstationorgid(org_id)) stationName
                            from system_user s 
                            left join employee e on s.employee_id=e.employee_id
                            where  role_id=123 
                            group by getstationorgid(org_id)";
            }
            else
            {
                strSql = @"select getstationorgid(org_id) stationorgid,count(*) AdminCount, 
                            GetOrgName(getstationorgid(org_id)) stationName
                            from system_user s 
                            left join employee e on s.employee_id=e.employee_id
                            where  role_id=123  and getstationorgid(org_id)=" + PrjPub.CurrentLoginUser.StationOrgID
                         + @" group by getstationorgid(org_id)";
            }
            DataTable dtCount = db.RunSqlDataSet(strSql).Tables[0];

            strSql = @"select GetStationOrgID(org_id) stationorgid,s.* from Employee a 
                            inner join system_user s on s.employee_id=a.employee_id 
                            where a.Employee_ID in (" + hfEmployeeID.Value + ")";
            DataTable dtEmployee = db.RunSqlDataSet(strSql).Tables[0];

            strSql = @"select a.*,b.Employee_Name from EMPLOYEE_TRANSFER a 
                         inner join Employee b on a.Employee_ID=b.Employee_ID 
                        where getstationorgid(org_id)=" + PrjPub.CurrentLoginUser.StationOrgID;
            DataTable dtHasTrans = db.RunSqlDataSet(strSql).Tables[0];

            Hashtable htCount = new Hashtable();
            int       count   = 0;
            string    error   = string.Empty;

            for (int i = 0; i < strID.Length; i++)
            {
                EmployeeTransfer objTransfer = new EmployeeTransfer();
                objTransfer.EmployeeID      = Convert.ToInt32(strID[i]);
                objTransfer.TransferToOrgID = Convert.ToInt32(ddlOrg.SelectedValue);
                objList.Add(objTransfer);

                if (strID[i] == PrjPub.CurrentLoginUser.EmployeeID.ToString())
                {
                    count++;
                }

                DataRow[] drAdmin = dtEmployee.Select("Employee_ID=" + strID[i] + " and Role_ID=123");
                if (drAdmin.Length > 0)
                {
                    string stationid = drAdmin[0]["StationOrgID"].ToString();
                    if (htCount.ContainsKey(stationid))
                    {
                        int num = Convert.ToInt32(htCount[stationid]);
                        htCount[stationid] = num + 1;
                    }
                    else
                    {
                        htCount.Add(stationid, 1);
                    }
                }

                DataRow[] drHasTrans = dtHasTrans.Select("Employee_ID=" + strID[i]);
                if (drHasTrans.Length > 0)
                {
                    error = "学员【" + drHasTrans[0]["Employee_Name"] + "】已经处于调出状态,不能重复调出!";
                    break;
                }
            }

            if (error != "")
            {
                ClientScript.RegisterClientScriptBlock(GetType(), "", "alert('" + error + "')", true);
                return;
            }

            string strMessage = "";

            foreach (DataRow dr in dtCount.Rows)
            {
                string stationid = dr["stationorgid"].ToString();
                if (htCount.ContainsKey(stationid))
                {
                    int nownum = Convert.ToInt32(htCount[stationid]);

                    if (nownum == Convert.ToInt32(dr["AdminCount"].ToString()))
                    {
                        strMessage = "必须为" + dr["stationName"] + "至少保留一位站段管理员!";
                        break;
                    }
                }
            }


            if (count > 0)
            {
                ClientScript.RegisterClientScriptBlock(GetType(), "", "alert('" + PrjPub.CurrentLoginUser.EmployeeName + "是当前操作人员,不能被调出!')", true);
                return;
            }

            if (strMessage != "")
            {
                ClientScript.RegisterClientScriptBlock(GetType(), "", "alert('" + strMessage + "')", true);
                return;
            }

            objBll.AddEmployeeTransfer(objList);

            SystemLogBLL objLogBll = new SystemLogBLL();

            objLogBll.WriteLog("将部分员工调至" + ddlOrg.SelectedItem.Text);

            Response.Write("<script>window.returnValue='true';window.close();</script>");
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!this.IsPostBack)
            {
                ButtonOutPutAll.Attributes.Add("onclick", "return confirm('您确定要移除全部考生吗 ?');");

                ViewState["mode"]      = Request.QueryString.Get("mode");
                ViewState["startmode"] = Request.QueryString.Get("startmode");
                if (ViewState["mode"].ToString() == "ReadOnly")
                {
                    this.btnInput.Visible        = false;
                    this.ButtonOutPut.Visible    = false;
                    this.ButtonOutPutAll.Visible = false;
                    btnSelectComputeRoom.Visible = false;
                }

                string strId = Request.QueryString.Get("id");
                if (strId != null && strId != "")
                {
                    hfExamID.Value = strId;
                    RandomExamArrangeBLL eaBll = new RandomExamArrangeBLL();
                    IList <RailExam.Model.RandomExamArrange> ExamArranges = eaBll.GetRandomExamArranges(int.Parse(strId));

                    if (ExamArranges.Count > 0)
                    {
                        ViewState["ChooseId"]   = ExamArranges[0].UserIds;
                        ViewState["UpdateMode"] = 1;
                    }
                    else
                    {
                        ViewState["ChooseId"]   = "";
                        ViewState["UpdateMode"] = 0;
                    }

                    string       strSql = "select Org_ID,Short_Name from Org where level_num=2 order by Parent_ID,Order_Index";
                    OracleAccess db     = new OracleAccess();
                    DataSet      ds     = db.RunSqlDataSet(strSql);
                    ListItem     item   = new ListItem();
                    item.Text  = "--请选择--";
                    item.Value = "0";
                    ddlOrg.Items.Add(item);
                    bool hasOrg = false;
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        item       = new ListItem();
                        item.Text  = dr["Short_Name"].ToString();
                        item.Value = dr["org_ID"].ToString();
                        ddlOrg.Items.Add(item);

                        if (PrjPub.CurrentLoginUser.StationOrgID.ToString() == dr["org_ID"].ToString())
                        {
                            hasOrg = true;
                        }
                    }

                    //if (PrjPub.CurrentLoginUser.RoleID != 1)
                    //{
                    //    if (hasOrg)
                    //    {
                    //        ddlOrg.SelectedValue = PrjPub.CurrentLoginUser.StationOrgID.ToString();
                    //        //ddlOrg.Enabled = false;
                    //    }
                    //    else
                    //    {
                    //        ddlOrg.SelectedValue = "0";
                    //    }
                    //}
                    //else
                    //{
                    //    ddlOrg.SelectedValue = "0";
                    //}

                    ddlOrg.SelectedValue = "0";

                    //ddlOrg_SelectedIndexChanged(null, null);

                    RandomExamBLL objBll        = new RandomExamBLL();
                    bool          hasTrainClass = objBll.GetExam(Convert.ToInt32(strId)).HasTrainClass;
                    if (hasTrainClass)
                    {
                        ViewState["HasTrainClass"] = "1";
                        btnInput.Enabled           = false;
                        //ButtonOutPut.Enabled = false;
                        ButtonOutPutAll.Enabled = false;
                    }
                    else
                    {
                        ViewState["HasTrainClass"] = "0";
                    }
                }
                BindChoosedGrid(ViewState["ChooseId"].ToString());
            }

            //string strChooseID = Request.Form.Get("ChooseID");
            //if (strChooseID != "" && strChooseID != null)
            //{
            //    ViewState["ChooseId"] = strChooseID;
            //    BindChoosedGrid(ViewState["ChooseId"].ToString());
            //    SaveChoose();
            //}

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

            if (strRefresh != "" && strRefresh != null)
            {
                string strId = Request.QueryString.Get("id");
                if (strId != null && strId != "")
                {
                    RandomExamArrangeBLL eaBll = new RandomExamArrangeBLL();
                    IList <RailExam.Model.RandomExamArrange> ExamArranges =
                        eaBll.GetRandomExamArranges(int.Parse(strId));

                    if (ExamArranges.Count > 0)
                    {
                        ViewState["ChooseId"]   = ExamArranges[0].UserIds;
                        ViewState["UpdateMode"] = 1;
                    }
                    else
                    {
                        ViewState["ChooseId"]   = "";
                        ViewState["UpdateMode"] = 0;
                    }
                }
                BindChoosedGrid(ViewState["ChooseId"].ToString());
            }

            string strChooseExamID = Request.Form.Get("ChooseExamID");

            if (strChooseExamID != "" && strChooseExamID != null)
            {
                RandomExamArrangeBLL objBll = new RandomExamArrangeBLL();
                IList <RailExam.Model.RandomExamArrange> ExamArranges = objBll.GetRandomExamArranges(int.Parse(Request.QueryString.Get("id")));
                IList <RailExam.Model.RandomExamArrange> objList      = objBll.GetRandomExamArranges(int.Parse(strChooseExamID));
                if (ExamArranges.Count > 0)
                {
                    string[] str = ExamArranges[0].UserIds.Split(',');
                    if (objList.Count > 0)
                    {
                        for (int i = 0; i < str.Length; i++)
                        {
                            if (("," + objList[0].UserIds + ",").IndexOf("," + str[i] + ",") != -1)
                            {
                                objList[0].UserIds = ("," + objList[0].UserIds + ",").Replace("," + str[i] + ",", ",");
                            }
                        }

                        if (ExamArranges[0].UserIds == "")
                        {
                            ViewState["ChooseId"] = objList[0].UserIds.TrimEnd(',').TrimStart(',');
                        }
                        else
                        {
                            if (objList[0].UserIds.TrimEnd(',').TrimStart(',') == "")
                            {
                                ViewState["ChooseId"] = ExamArranges[0].UserIds;
                            }
                            else
                            {
                                ViewState["ChooseId"] = ExamArranges[0].UserIds + "," + objList[0].UserIds.TrimEnd(',').TrimStart(',');
                            }
                        }
                    }
                    else
                    {
                        ViewState["ChooseId"] = ExamArranges[0].UserIds;
                    }
                    ViewState["UpdateMode"] = 1;
                }
                else
                {
                    if (objList.Count > 0)
                    {
                        ViewState["ChooseId"] = objList[0].UserIds;
                    }
                    else
                    {
                        ViewState["ChooseId"] = "";
                    }
                    ViewState["UpdateMode"] = 0;
                }
                BindChoosedGrid(ViewState["ChooseId"].ToString());
                SaveChoose();
            }

            string strRefreshArrange = Request.Form.Get("RefreshArrange");

            if (strRefreshArrange != "" && strRefreshArrange != null)
            {
                BindChoosedGrid(ViewState["ChooseId"].ToString());

                if (CheckIsAllArrange())
                {
                    string strSql = " update Random_Exam set Is_All_Arrange=1 where Random_Exam_ID=" +
                                    Request.QueryString.Get("id");
                    OracleAccess db = new OracleAccess();
                    db.ExecuteNonQuery(strSql);
                }
            }

            if (Request.Form.Get("StudentInfo") != null && Request.Form.Get("StudentInfo") != "")
            {
                DownloadStudentInfoExcel();
            }
        }
        private void BindGrid()
        {
            string strSql = "";

            OracleAccess db = new OracleAccess();

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

            if (!string.IsNullOrEmpty(strKnowledgeIDPath))
            {
                strSql = "select Id_Path from Information_System where Information_System_ID=" + strKnowledgeIDPath;
                DataSet dsSystem = db.RunSqlDataSet(strSql);

                if (dsSystem.Tables[0].Rows.Count > 0)
                {
                    ViewState["SystemIdPath"] = dsSystem.Tables[0].Rows[0][0];
                }
                else
                {
                    ViewState["SystemIdPath"] = string.Empty;
                }

                strSql = "select a.*,c.Employee_Name as CreatePersonName from Information a "
                         + " inner join Information_System  b on a.Information_System_ID=b.Information_System_ID"
                         + " inner join Employee c on a.Create_Person=c.Employee_ID "
                         + " where b.Id_Path||'/' like '" + ViewState["SystemIdPath"] + "/%' order by a.System_Order_Index";
            }

            string strTrainTypeIDPath = Request.QueryString.Get("id1");

            if (!string.IsNullOrEmpty(strTrainTypeIDPath))
            {
                strSql = "select Id_Path from Information_Level where Information_Level_ID=" + strTrainTypeIDPath;
                DataSet dsLevel = db.RunSqlDataSet(strSql);

                if (dsLevel.Tables[0].Rows.Count > 0)
                {
                    ViewState["LevelIdPath"] = dsLevel.Tables[0].Rows[0][0];
                }
                else
                {
                    ViewState["LevelIdPath"] = string.Empty;
                }

                strSql = "select a.*,c.Employee_Name as CreatePersonName from Information a "
                         + " inner join Information_Level  b on a.Information_Level_ID=b.Information_Level_ID"
                         + " inner join Employee c on a.Create_Person=c.Employee_ID "
                         + " where b.Id_Path||'/' like '" + ViewState["LevelIdPath"] + "/%' order by a.Level_Order_Index";
            }

            if (!string.IsNullOrEmpty(txtBookName.Text.Trim()))
            {
                strSql += " and Information_Name like '%" + txtBookName.Text.Trim() + "%'";
            }

            if (!string.IsNullOrEmpty(txtOrg.Text.Trim()))
            {
                strSql += " and KEYWORDS like '%" + txtOrg.Text.Trim() + "%'";
            }

            if (!string.IsNullOrEmpty(txtBookName.Text.Trim()))
            {
                strSql += " and PUBLISH_ORG like '%" + txtBookName.Text.Trim() + "%'";
            }

            DataSet ds = db.RunSqlDataSet(strSql);

            if (ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    if (dr["Information_Name"].ToString().Length <= 30)
                    {
                        dr["Information_Name"] = "<a onclick=OpenIndex('" + dr["Information_ID"] + "') href=# title=" + dr["Information_Name"] + " > " + dr["Information_Name"] + " </a>";
                    }
                    else
                    {
                        dr["Information_Name"] = "<a onclick=OpenIndex('" + dr["Information_ID"] + "') href=# title=" + dr["Information_Name"] + " > " + dr["Information_Name"].ToString().Substring(0, 15) + "...</a>";
                    }
                }

                Grid1.DataSource = ds;
                Grid1.DataBind();
            }
        }
示例#30
0
        /// <summary>
        /// SON OF A BITCH!!!
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        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";
                }

                string selectStation            = "select org_id, short_name from org where level_num = 2 order by parent_id,order_index";
                string selectPolitical          = "select political_status_id, political_status_name from POLITICAL_STATUS order by order_index";
                string selectBZZ                = "select workgroupleader_level_id, level_name from WORKGROUPLEADER_LEVEL t order by order_index";
                string selectTechicianTitleType = "select technician_title_type_id, type_name from TECHNICIAN_TITLE_TYPE t where order_index < 23 order by order_index";
                string selectTechicianType      = "select technician_type_id, type_name from TECHNICIAN_TYPE t order by technician_type_id";
                string selectEduBg              = "select education_level_id, education_level_name from EDUCATION_LEVEL t order by order_index";
                DropBindSource(this.dropStation, selectStation);
                DropBindSource(this.dropPolitical, selectPolitical);
                ChkListBindSource(this.chkListBZZ, selectBZZ);
                ChkListBindSource(this.chkListJSZC, selectTechicianTitleType);
                ChkListBindSource(this.chkListJNDJ, selectTechicianType);
                ChkListBindSource(this.chkListEduBg, selectEduBg);

                this.dropStation.SelectedValue = PrjPub.CurrentLoginUser.StationOrgID.ToString();
                dropStation_SelectedIndexChanged(null, null);

                if (PrjPub.CurrentLoginUser.SuitRange == 0)
                {
                    dropStation.Enabled = false;
                }

                OracleAccess access = new OracleAccess();
                DataSet      ds     = access.RunSqlDataSet(" select * from zj_certificate order by order_index");
                ListItem     item   = new ListItem();
                item.Value = "0";
                item.Text  = "--请选择--";
                drop_certificate.Items.Add(item);
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    item       = new ListItem();
                    item.Value = dr["certificate_id"].ToString();
                    item.Text  = dr["certificate_name"].ToString();
                    drop_certificate.Items.Add(item);
                }

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

                gridBind();
            }

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

            if (!string.IsNullOrEmpty(strRefresh))
            {
                gridBind();
            }

            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 = "该员工登录帐户不存在,初始化密码失败!";
                }

                gridBind();
            }
        }