Exemple #1
0
        /// <summary>
        /// Query System Log by filters
        /// </summary>
        /// <param name="_logCode"></param>
        /// <param name="_logLevel"></param>
        /// <param name="_testTimeStart"></param>
        /// <param name="_testTimeEnd"></param>
        /// <returns></returns>
        public List <SysLog> GetSystemLogList(DateTime _testTimeStart)
        {
            if (SystemLogList.Count > 0)
            {
                SystemLogList.Clear();
            }

            try
            {
                foreach (var valLog in SystemLogBLL.SystemLogTable(_testTimeStart))
                {
                    SysLog systemlogtemp = new SysLog();

                    systemlogtemp.LogID          = valLog.LogId;
                    systemlogtemp.Operator       = valLog.Operator;
                    systemlogtemp.LogDescription = valLog.LogMessage;
                    systemlogtemp.LogTime        = valLog.OperateTime;

                    SystemLogList.Add(systemlogtemp);
                }
            }
            catch (Exception ex)
            {
                //LogHelper.ToLog("DBErr.txt", ex);
            }

            return(SystemLogList);
        }
Exemple #2
0
        protected void btnOk_Click(object sender, EventArgs e)
        {
            OracleAccess db     = new OracleAccess();
            string       strSql = "select * from Employee where Employee_ID=" + ViewState["EmployeeID"];
            DataRow      dr     = db.RunSqlDataSet(strSql).Tables[0].Rows[0];


            int orgID;

            if (ddlWorkgroup.SelectedValue != "0")
            {
                orgID = Convert.ToInt32(ddlWorkgroup.SelectedValue);
            }
            else
            {
                orgID = Convert.ToInt32(ddlWorkshop.SelectedValue);
            }

            OrganizationBLL organizationBLL         = new OrganizationBLL();
            EmployeeBLL     objEmployeeBll          = new EmployeeBLL();
            IList <RailExam.Model.Employee> objView =
                objEmployeeBll.GetEmployeeByWhereClause("GetStationOrgID(a.Org_ID)=" + organizationBLL.GetStationOrgID(orgID) +
                                                        " and Work_No='" + txtWorkNo.Text.Trim() + "'");

            if (objView.Count > 0)
            {
                SessionSet.PageMessage = "该员工编码在本单位已经存在!";
                return;
            }
            strSql = "update Employee "
                     + " set Employee_Name='" + txtName.Text + "',"
                     + "Org_ID=" + orgID + ","
                     + "Work_No='" + txtWorkNo.Text + "',"
                     + "identity_CardNo='" + txtPostNo.Text + "',"
                     + "PinYin_Code='" + Pub.GetChineseSpell(txtName.Text) + "' "
                     + " where Employee_ID=" + ViewState["EmployeeID"];
            db.ExecuteNonQuery(strSql);

            strSql = "insert into ZJ_Employee_Work "
                     + " values(Employee_Work_Seq.nextval,  "
                     + dr["EMPLOYEE_ID"]
                     + ", to_char(sysdate,'yyyy-mm-dd')," + dr["org_id"] + "," + orgID + ","
                     + dr["Post_ID"] + "," + dr["Post_ID"] + ","
                     + "'',sysdate,'" + PrjPub.CurrentLoginUser.EmployeeName + "',"
                     + "to_date('" + dr["Post_Date"] + "','YYYY-MM-DD HH24:MI:SS'))";
            db.ExecuteNonQuery(strSql);

            string transferID = Request.QueryString.Get("transferID");
            EmployeeTransferBLL objTransferBll = new EmployeeTransferBLL();

            objTransferBll.DeleteEmployeeTransfer(Convert.ToInt32(transferID));

            SystemLogBLL objLogBll = new SystemLogBLL();

            objLogBll.WriteLog("将" + dr["Employee_Name"] + "调至" + lblOrg.Text);

            Response.Write("<script>window.returnValue='true';window.close();</script>");
        }
        protected void DownloadItem()
        {
            string srcPath = @"\\" + ConfigurationManager.AppSettings["ServerIP"] + "\\Item\\";
            string aimPath = Server.MapPath("../Online/Item/");

            CopyItem(srcPath, aimPath);
            SystemLogBLL objLogBll = new SystemLogBLL();

            objLogBll.WriteLog("下载最新电子教材");
        }
Exemple #4
0
        /// <summary>
        /// 日志写入方法
        /// </summary>
        /// <param name="str"></param>
        public void SaveLogs(string username, string str)
        {
            SystemLogBLL bll   = new SystemLogBLL();
            SystemLog    model = new SystemLog();

            model.UserName  = username;
            model.IpAddress = Utils.GetTrueIPAddress();
            model.LogInfo   = str;
            bll.AddLog(model);
        }
Exemple #5
0
        public HttpResponseMessage AddWzjzs(WJ_WzjzsModel model)
        {
            int id = bll.AddWzjzs(model);

            model.parentid = id;
            int success = bll.AddWzjzs(model);

            string[]         fileClass = model.uploadpanelValue;
            List <FileClass> list      = new List <FileClass>();

            if (fileClass != null && fileClass.Length > 0)
            {
                foreach (var item in fileClass)
                {
                    FileClass file = new FileClass();
                    JObject   jo   = new JObject();
                    jo = (JObject)JsonConvert.DeserializeObject(item);
                    file.OriginalPath = jo["OriginalPath"] == null ? "" : jo["OriginalPath"].ToString();
                    file.OriginalName = jo["OriginalName"] == null ? "" : jo["OriginalName"].ToString();
                    file.OriginalType = jo["OriginalType"] == null ? "" : jo["OriginalType"].ToString();
                    file.size         = jo["size"] == null ? 0 : (double)jo["size"];
                    list.Add(file);
                }
            }
            WJ_FilesBLL filebll = new WJ_FilesBLL();

            foreach (var item in list)
            {
                WJ_FilesModel wjfilemodel = new WJ_FilesModel();
                wjfilemodel.filetype = item.OriginalType;
                wjfilemodel.filename = item.OriginalName;
                wjfilemodel.filepath = item.OriginalPath;
                wjfilemodel.source   = 1;
                wjfilemodel.sourceid = success;
                wjfilemodel.filesize = item.size;
                filebll.AddCqxm(wjfilemodel);
            }
            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK);

            if (success > 0)
            {
                #region 添加日志
                SystemLogBLL slbll = new SystemLogBLL();
                slbll.WriteSystemLog("违建管理", "", (int)model.createuserid);
                #endregion

                response.Content = new StringContent("{\"success\":true}", Encoding.GetEncoding("UTF-8"), "text/html");
            }
            else
            {
                response.Content = new StringContent("{\"success\":false}", Encoding.GetEncoding("UTF-8"), "text/html");
            }
            return(response);
        }
Exemple #6
0
        /// <summary>
        /// 日志写入方法
        /// </summary>
        /// <param name="str"></param>
        protected void SaveLogs(string str)
        {
            SystemLogBLL bll   = new SystemLogBLL();
            SystemLog    model = new SystemLog();

            if (Session["AdminName"] != null)
            {
                model.UserName = Session["AdminName"].ToString();
            }
            model.IpAddress = Utils.GetTrueIPAddress();
            model.LogInfo   = str;
            bll.AddLog(model);
        }
Exemple #7
0
        public static bool WriteSystemLog(string _operator, string _description, DateTime _testTime)
        {
            try
            {
                SystemLogBLL.InsertSystemLog(_operator, _description, _testTime);
            }
            catch (Exception ex)
            {
                //LogHelper.ToLog("DBErr.txt", ex);

                return(false);
            }

            return(true);
        }
        private void BindGrid()
        {
            DateTime start = new DateTime(2000, 1, 1);
            DateTime end   = new DateTime(2100, 12, 31);

            if (dateBeginTime.DateValue.ToString() != string.Empty)
            {
                start = DateTime.Parse(dateBeginTime.DateValue.ToString());
            }
            if (dateEndTime.DateValue.ToString() != string.Empty)
            {
                end = DateTime.Parse(dateEndTime.DateValue.ToString());
            }

            SystemLogBLL systemLogBLL = new SystemLogBLL();
            string       strFlag      = "";

            if (PrjPub.CurrentLoginUser.OrgID == 1 ||
                PrjPub.CurrentLoginUser.StationOrgID == 200)      // StationOrgID: 200 表示包神铁路人力资源部职工培训中心
            {
                strFlag = "";
            }
            else
            {
                strFlag = PrjPub.CurrentLoginUser.OrgName;
            }

            systemLogs = systemLogBLL.GetLogs(
                txtOrgName.Text,
                txtUserID.Text,
                txtEmployeeName.Text,
                start,
                end,
                txtActionContent.Text,
                txtMemo.Text,
                strFlag
                );

            if (systemLogs != null)
            {
                Grid1.DataSource = systemLogs;
                Grid1.DataBind();
            }
        }
Exemple #9
0
        public HttpResponseMessage AddApproveInf(LicenseModel model)
        {
            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK);

            HttpRequestBase request = ((HttpContextWrapper)this.Request.Properties["MS_HttpContext"]).Request;

            string[]         fileClass = model.uploadpanelValue;
            List <FileClass> list      = new List <FileClass>();

            if (fileClass != null && fileClass.Length > 0)
            {
                foreach (var item in fileClass)
                {
                    FileClass file = new FileClass();
                    JObject   jo   = new JObject();
                    jo = (JObject)JsonConvert.DeserializeObject(item);
                    file.OriginalPath = jo["OriginalPath"] == null ? "" : jo["OriginalPath"].ToString();
                    file.OriginalName = jo["OriginalName"] == null ? "" : jo["OriginalName"].ToString();
                    file.OriginalType = jo["OriginalType"] == null ? "" : jo["OriginalType"].ToString();
                    file.size         = jo["size"] == null ? 0 : (double)jo["size"];
                    list.Add(file);
                }
            }

            if (!string.IsNullOrEmpty(request.Form["userid"]))
            {
                model.createuserid = Convert.ToInt32(request.Form["userid"]);
            }

            int success = bll.AddApproveInf(model, list);

            if (success > 0)
            {
                #region 添加日志
                SystemLogBLL slbll = new SystemLogBLL();
                slbll.WriteSystemLog("行政许可", "", Convert.ToInt32(request.Form["userid"]));
                #endregion

                response.Content = new StringContent("{\"success\":true}", Encoding.GetEncoding("UTF-8"), "text/html");
            }
            return(response);
        }
        protected void btnDeleteQuery_Click(object sender, EventArgs e)
        {
            DateTime start = new DateTime(2000, 1, 1);
            DateTime end   = new DateTime(2100, 12, 31);

            if (dateBeginTime.DateValue.ToString() != string.Empty)
            {
                start = DateTime.Parse(dateBeginTime.DateValue.ToString());
            }
            if (dateEndTime.DateValue.ToString() != string.Empty)
            {
                end = DateTime.Parse(dateEndTime.DateValue.ToString());
            }

            SystemLogBLL systemLogBLL = new SystemLogBLL();
            string       strFlag      = "";

            if (PrjPub.CurrentLoginUser.OrgID == 1)
            {
                strFlag = "";
            }
            else
            {
                strFlag = PrjPub.CurrentLoginUser.OrgName;
            }

            systemLogs = systemLogBLL.GetLogs(txtOrgName.Text, txtUserID.Text, txtEmployeeName.Text,
                                              start, end, txtActionContent.Text, txtMemo.Text, strFlag);

            systemLogBLL.DeleteLogs(systemLogs);

            systemLogs = null;

            Grid1.DataSource = systemLogs;
            Grid1.DataBind();

            btnDeleteQuery.Visible = false;
        }
        private void GetPaper()
        {
            // 根据 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 jsBlock;

            ViewState["BeginTime"] = DateTime.Now.ToString();
            string strId = Request.QueryString.Get("RandomExamID");

            //获取当前考试的生成试卷的状态和次数
            RandomExamBLL objBll = new RandomExamBLL();

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

            int year      = obj.BeginTime.Year;
            int ExamCount = obj.MaxExamTimes;

            RandomExamArrangeBLL eaBll = new RandomExamArrangeBLL();
            IList <RailExam.Model.RandomExamArrange> ExamArranges = eaBll.GetRandomExamArranges(int.Parse(strId));
            string       strChooseID = "";
            OracleAccess db          = new OracleAccess();
            OracleAccess dbCenter    = new OracleAccess(System.Configuration.ConfigurationManager.ConnectionStrings["OracleCenter"].ConnectionString);

            string strSql;

            if (ExamArranges.Count > 0)
            {
                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 c.Computer_server_ID=b.Computer_Server_ID"
                         + " where c.Computer_Server_No='" + PrjPub.ServerNo + "' "
                         + " and Random_Exam_ID=" + strId;

                DataSet ds = db.RunSqlDataSet(strSql);

                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    if (string.IsNullOrEmpty(strChooseID))
                    {
                        strChooseID += dr["User_Ids"].ToString();
                    }
                    else
                    {
                        strChooseID += "," + dr["User_Ids"];
                    }
                }
            }
            else
            {
                strChooseID = "";
            }

            if (strChooseID == "")
            {
                Response.Write("<script>top.returnValue='本场考试未在本单位安排考生!';window.close();</script>");
                return;
            }

            if (db.GetCount("RANDOM_EXAM_ITEM_TEMP_" + year, "TABLE") == 0)
            {
                strSql = "create table RANDOM_EXAM_ITEM_TEMP_" + year + "  as select * from RANDOM_EXAM_ITEM_" + year + " where 1=2 ";
                db.ExecuteNonQuery(strSql);
            }
            strSql = "insert into RANDOM_EXAM_ITEM_TEMP_" + year + " select * from RANDOM_EXAM_ITEM_" + year + " where Random_Exam_ID=" + strId;
            db.ExecuteNonQuery(strSql);

            if (!PrjPub.IsServerCenter)
            {
                if (dbCenter.GetCount("RANDOM_EXAM_ITEM_TEMP_" + year, "TABLE") == 0)
                {
                    strSql = "create table RANDOM_EXAM_ITEM_TEMP_" + year + "  as select * from RANDOM_EXAM_ITEM_" + year + " where 1=2 ";
                    dbCenter.ExecuteNonQuery(strSql);
                }
                strSql = "insert into RANDOM_EXAM_ITEM_TEMP_" + year + " select * from RANDOM_EXAM_ITEM_" + year + " where Random_Exam_ID=" + strId;
                dbCenter.ExecuteNonQuery(strSql);
            }

            System.Threading.Thread.Sleep(10);
            jsBlock = "<script>SetPorgressBar('正在计算生成试卷数量,请等待......','" + ((1 * 100) / ((double)2) + "'); </script>");
            Response.Write(jsBlock);
            Response.Flush();


            //每次生成试卷之前删除已生成的考试试卷
            RandomExamResultCurrentBLL randomExamResultBLL = new RandomExamResultCurrentBLL();

            randomExamResultBLL.DelRandomExamResultCurrent(Convert.ToInt32(strId));
            System.Threading.Thread.Sleep(10);
            jsBlock = "<script>SetPorgressBar('正在计算生成试卷数量,请等待......','" + ((2 * 100) / ((double)2) + "'); </script>");
            Response.Write(jsBlock);
            Response.Flush();

            System.Threading.Thread.Sleep(200);
            jsBlock = string.Empty;

            string[] str = strChooseID.Split(',');

            RandomExamResultAnswerCurrentBLL randomExamResultAnswerBLL = new RandomExamResultAnswerCurrentBLL();
            //定义全局答卷对象List
            IList <RandomExamResultAnswerCurrent> randomExamResultAnswersCurrentAll = new List <RandomExamResultAnswerCurrent>();
            //定义一个考生一次答卷对象List
            IList <RandomExamResultAnswerCurrent> randomExamResultAnswers = null;

            int progressNum = 1;

            for (int n = 1; n <= ExamCount; n++)
            {
                for (int m = 0; m < str.Length; m++)
                {
                    RandomExamResultCurrent randomExamResult = new RandomExamResultCurrent();

                    randomExamResult.RandomExamId    = int.Parse(strId);
                    randomExamResult.AutoScore       = 0;
                    randomExamResult.BeginDateTime   = DateTime.Parse(ViewState["BeginTime"].ToString());
                    randomExamResult.CurrentDateTime = DateTime.Parse(ViewState["BeginTime"].ToString());
                    randomExamResult.ExamTime        = 0;
                    randomExamResult.EndDateTime     = DateTime.Parse(ViewState["BeginTime"].ToString());
                    randomExamResult.Score           = 0;
                    randomExamResult.OrganizationId  = int.Parse(ConfigurationManager.AppSettings["StationID"]);
                    randomExamResult.Memo            = "";
                    randomExamResult.StatusId        = 0;
                    randomExamResult.AutoScore       = 0;
                    randomExamResult.CorrectRate     = 0;
                    randomExamResult.ExamineeId      = int.Parse(str[m]);
                    randomExamResult.ExamSeqNo       = n;

                    int nRandomExamResultPK = randomExamResultBLL.AddRandomExamResultCurrent(randomExamResult);
                    ViewState["RandomExamResultPK"] = nRandomExamResultPK;

                    strSql = "select a.* from Random_Exam_Arrange_Detail a "
                             + " where ','||User_Ids||',' like '%," + str[m] + ",%' "
                             + " and Random_Exam_ID=" + strId;
                    DataRow dr = db.RunSqlDataSet(strSql).Tables[0].Rows[0];

                    //strSql = "insert into Random_Exam_Result_Detail(Random_Exam_Result_Detail_ID,"
                    //         + "Random_Exam_Result_ID,Random_Exam_ID,Employee_ID,Computer_Room_SEAT,Computer_Room_ID) "
                    //         + "values(Random_Exam_Result_Detail_SEQ.NextVal,"
                    //         + nRandomExamResultPK + ","
                    //         + randomExamResult.RandomExamId + ","
                    //         + randomExamResult.ExamineeId + ","
                    //         + "0," + dr["Computer_Room_ID"] + ") ";
                    //db.ExecuteNonQuery(strSql);

                    strSql = "insert into Random_Exam_Result_Detail_Temp(Random_Exam_Result_Detail_ID,"
                             + "Random_Exam_Result_ID,Random_Exam_ID,Employee_ID,Computer_Room_SEAT,Computer_Room_ID,Is_Remove) "
                             + "values(Random_Exam_Result_Detail_SEQ.NextVal,"
                             + nRandomExamResultPK + ","
                             + randomExamResult.RandomExamId + ","
                             + randomExamResult.ExamineeId + ","
                             + "0," + dr["Computer_Room_ID"] + ",0) ";
                    db.ExecuteNonQuery(strSql);

                    RandomExamItemBLL     randomItemBLL = new RandomExamItemBLL();
                    RandomExamSubjectBLL  subjectBLL    = new RandomExamSubjectBLL();
                    RandomExamStrategyBLL strategyBLL   = new RandomExamStrategyBLL();

                    IList <RandomExamSubject> randomExamSubjects =
                        subjectBLL.GetRandomExamSubjectByRandomExamId(int.Parse(strId));

                    if (randomExamSubjects != null)
                    {
                        Hashtable hashTableItemIds = new Hashtable();
                        Hashtable htSubjectItemIds = new Hashtable();
                        for (int i = 0; i < randomExamSubjects.Count; i++)
                        {
                            RandomExamSubject paperSubject = randomExamSubjects[i];
                            int nSubjectId = paperSubject.RandomExamSubjectId;
                            //  int nItemCount = paperSubject.ItemCount;

                            IList <RandomExamStrategy> strategys = strategyBLL.GetRandomExamStrategys(nSubjectId);
                            for (int j = 0; j < strategys.Count; j++)
                            {
                                int nStrategyId = strategys[j].RandomExamStrategyId;
                                int nItemCount  = strategys[j].ItemCount;
                                IList <RandomExamItem> itemList = randomItemBLL.GetItemsByStrategyId(nStrategyId, year);

                                // IList<RandomExamItem> itemList = randomItemBLL.GetItemsBySubjectId(nSubjectId);

                                Random    ObjRandom      = new Random();
                                Hashtable hashTable      = new Hashtable();
                                Hashtable hashTableCount = new Hashtable();
                                int       index          = 0;
                                while (hashTable.Count < nItemCount)
                                {
                                    int k = ObjRandom.Next(itemList.Count);
                                    hashTableCount[index] = k;
                                    index = index + 1;
                                    int itemID     = itemList[k].ItemId;
                                    int examItemID = itemList[k].RandomExamItemId;
                                    if (!hashTableItemIds.ContainsKey(itemID))
                                    {
                                        hashTable[examItemID]        = examItemID;
                                        hashTableItemIds[itemID]     = itemID;
                                        htSubjectItemIds[examItemID] = examItemID;
                                    }
                                    //if (hashTableCount.Count == itemList.Count && hashTable.Count < nItemCount)
                                    //{
                                    //    SessionSet.PageMessage = "随机考试在设定的取题范围内的试题量不够,请重新设置取题范围!";
                                    //    return;
                                    //}
                                }
                            }
                        }


                        foreach (int key in htSubjectItemIds.Keys)
                        {
                            string         strItemId = htSubjectItemIds[key].ToString();
                            RandomExamItem item      = randomItemBLL.GetRandomExamItem(Convert.ToInt32(strItemId), year);

                            string nowSelectAnswer   = string.Empty;
                            string nowStandardAnswer = string.Empty;
                            if (item.TypeId != PrjPub.ITEMTYPE_FILLBLANK)
                            {
                                Pub.GetNowAnswer(item, out nowSelectAnswer, out nowStandardAnswer);
                            }

                            RandomExamResultAnswerCurrent randomExamResultAnswer = new RandomExamResultAnswerCurrent();
                            randomExamResultAnswer.RandomExamResultId = nRandomExamResultPK;
                            randomExamResultAnswer.RandomExamItemId   = int.Parse(strItemId);
                            randomExamResultAnswer.JudgeStatusId      = 0;
                            randomExamResultAnswer.JudgeRemark        = string.Empty;
                            randomExamResultAnswer.ExamTime           = 0;
                            randomExamResultAnswer.Answer             = string.Empty;
                            randomExamResultAnswer.SelectAnswer       = nowSelectAnswer;
                            randomExamResultAnswer.StandardAnswer     = nowStandardAnswer;
                            randomExamResultAnswerBLL.AddExamResultAnswerCurrent(randomExamResultAnswer);

                            //完型填空子题
                            IList <RandomExamItem> randomExamItems = randomItemBLL.GetItemsByParentItemID(item.ItemId, obj.RandomExamId, year);
                            foreach (RandomExamItem randomExamItem in randomExamItems)
                            {
                                Pub.GetNowAnswer(randomExamItem, out nowSelectAnswer, out nowStandardAnswer);

                                randomExamResultAnswer = new RandomExamResultAnswerCurrent();
                                randomExamResultAnswer.RandomExamResultId = nRandomExamResultPK;
                                randomExamResultAnswer.RandomExamItemId   = randomExamItem.RandomExamItemId;
                                randomExamResultAnswer.JudgeStatusId      = 0;
                                randomExamResultAnswer.JudgeRemark        = string.Empty;
                                randomExamResultAnswer.ExamTime           = 0;
                                randomExamResultAnswer.Answer             = string.Empty;
                                randomExamResultAnswer.SelectAnswer       = nowSelectAnswer;
                                randomExamResultAnswer.StandardAnswer     = nowStandardAnswer;
                                randomExamResultAnswerBLL.AddExamResultAnswerCurrent(randomExamResultAnswer);
                            }

                            System.Threading.Thread.Sleep(10);
                            jsBlock = "<script>SetPorgressBar('正在生成试卷,请等待......','" + ((progressNum * 100) / ((double)ExamCount * str.Length * htSubjectItemIds.Count)).ToString("0.00") + "'); </script>";
                            Response.Write(jsBlock);
                            Response.Flush();

                            progressNum++;
                        }
                    }
                    else
                    {
                        SessionSet.PageMessage = "未找到记录!";
                    }
                }
            }

            bool isRefresh = true;

            try
            {
                objBll.UpdateHasPaper(Convert.ToInt32(strId), PrjPub.ServerNo, true);
            }
            catch
            {
                strSql =
                    @"  update Random_Exam_Computer_Server set  has_paper=1
                      where random_exam_id=" + strId + @" and Computer_server_no='" + PrjPub.ServerNo + @"'";
                dbCenter.ExecuteNonQuery(strSql);
                strSql = @"select count(*)  from Random_Exam_Computer_Server where has_paper=1 and  random_exam_id=" + strId;
                int count = Convert.ToInt32(dbCenter.RunSqlDataSet(strSql).Tables[0].Rows[0][0]);
                if (count > 0)
                {
                    strSql = @"update Random_Exam set has_paper=1 where random_exam_id=" + strId;
                    dbCenter.ExecuteNonQuery(strSql);
                }
                else
                {
                    strSql = @"update Random_Exam set has_paper=0 where random_exam_id=" + strId;
                    dbCenter.ExecuteNonQuery(strSql);
                }
            }


            //如果考试是随到随考,考试状态自动变为正在进行
            if (obj.StartMode == 1)
            {
                try
                {
                    objBll.UpdateIsStart(Convert.ToInt32(strId), PrjPub.ServerNo, 1);
                    isRefresh = false;
                }
                catch
                {
                    strSql =
                        @"  update Random_Exam_Computer_Server set  Is_Start=1
                      where random_exam_id=" + strId + @" and Computer_server_no='" + PrjPub.ServerNo + @"'";
                    dbCenter.ExecuteNonQuery(strSql);
                    strSql = @"select count(*)  from Random_Exam_Computer_Server where random_exam_id=" + strId;
                    int totalcount = Convert.ToInt32(dbCenter.RunSqlDataSet(strSql).Tables[0].Rows[0][0]);
                    strSql = @"select count(*)  from Random_Exam_Computer_Server where Is_Start=0 and  random_exam_id=" + strId;
                    int count = Convert.ToInt32(dbCenter.RunSqlDataSet(strSql).Tables[0].Rows[0][0]);
                    if (totalcount == count)
                    {
                        strSql = @"update Random_Exam set Is_Start=0 where random_exam_id=" + strId;
                        dbCenter.ExecuteNonQuery(strSql);
                    }
                    else
                    {
                        strSql = @"select count(*)  from Random_Exam_Computer_Server where Is_Start=1 and  random_exam_id=" + strId;
                        count  = Convert.ToInt32(dbCenter.RunSqlDataSet(strSql).Tables[0].Rows[0][0]);
                        if (count > 0)
                        {
                            strSql = @"update Random_Exam set Is_Start=1 where random_exam_id=" + strId;
                            dbCenter.ExecuteNonQuery(strSql);
                        }
                        else
                        {
                            strSql = @"select count(*)  from Random_Exam_Computer_Server where Is_Start=2 and  random_exam_id=" + strId;
                            count  = Convert.ToInt32(dbCenter.RunSqlDataSet(strSql).Tables[0].Rows[0][0]);
                            if (count == totalcount)
                            {
                                strSql = @"update Random_Exam set Is_Start=2 where random_exam_id=" + strId;
                                dbCenter.ExecuteNonQuery(strSql);
                            }
                        }
                    }
                }
            }
            else
            {
                isRefresh = false;
            }

            if (isRefresh)
            {
                objBll.RandomExamRefresh();
            }

            SystemLogBLL objLogBll = new SystemLogBLL();

            objLogBll.WriteLog("“" + obj.ExamName + "”生成所有考试试卷");

            Response.Write("<script>top.returnValue='true';top.close();</script>");
        }
Exemple #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (PrjPub.CurrentLoginUser == null)
            {
                Response.Redirect("../Common/Error.aspx?error=Session过期请重新登录本系统!");
                return;
            }

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


                string strQuery = Request.QueryString.Get("strQuery");
                if (!string.IsNullOrEmpty(strQuery))
                {
                    string[] str = strQuery.Split('|');
                    txtName.Text            = str[0];
                    ddlSex.SelectedValue    = str[1];
                    ddlStatus.SelectedValue = str[2];
                    txtPinYin.Text          = str[3];
                    txtTechnicalCode.Text   = str[4];
                    hfPostID.Value          = str[5];
                }

                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();
            }

            string strDelete = Request.Form.Get("Delete");

            if (!string.IsNullOrEmpty(strDelete))
            {
                try
                {
                    OracleAccess db = new OracleAccess();
                    if (PrjPub.CurrentLoginUser.EmployeeID != 0)
                    {
                        //判断该员工是否参加过考试
                        string strIsArrange =
                            string.Format(
                                "select count(1) from random_exam_arrange where  ','||user_ids||','  like '%,{0},%'",
                                strDelete);
                        if (Convert.ToInt32(db.RunSqlDataSet(strIsArrange).Tables[0].Rows[0][0]) > 0)
                        {
                            ClientScript.RegisterStartupScript(GetType(), "NO", "alert('该员工已参加考试,不能删除!');", true);
                            return;
                        }

                        string strSql = "delete from Employee where Employee_ID=" + strDelete;
                        db.ExecuteNonQuery(strSql);
                    }
                    else
                    {
                        string  strSql = "select * from Employee where Employee_ID=" + strDelete;
                        DataRow dr     = db.RunSqlDataSet(strSql).Tables[0].Rows[0];

                        EmployeeBLL employeebll = new EmployeeBLL();
                        employeebll.DeleteEmployee(Convert.ToInt32(strDelete));

                        SystemLogBLL systemLogBLL = new SystemLogBLL();
                        systemLogBLL.WriteLog("删除员工:" + dr["Employee_Name"] + "(" + dr["Work_No"] + ")基本信息");
                    }
                    gridBind();
                }
                catch
                {
                    SessionSet.PageMessage = "该员工已被引用,不能删除!";
                }
            }

            if (!string.IsNullOrEmpty(hfPostID.Value))
            {
                PostBLL post = new PostBLL();
                txtPost.Text = post.GetPost(Convert.ToInt32(hfPostID.Value)).PostName;
            }
        }
        private void GetPaperAfter()
        {
            // 根据 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);

            ViewState["BeginTime"] = DateTime.Now.ToString();
            string strId = Request.QueryString.Get("RandomExamID");

            //获取当前考试的生成试卷的状态和次数
            RandomExamBLL objBll = new RandomExamBLL();

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

            int year      = obj.BeginTime.Year;
            int ExamCount = obj.MaxExamTimes;

            System.Threading.Thread.Sleep(10);
            string jsBlock = "<script>SetPorgressBar('正在计算生成试卷数量,请等待......','" + ((1 * 100) / ((double)1) + "'); </script>");

            Response.Write(jsBlock);
            Response.Flush();

            if (!PrjPub.IsServerCenter)
            {
                RandomExamArrangeBLL objArrangeBll = new RandomExamArrangeBLL();
                objArrangeBll.RefreshRandomExamArrange();
            }

            //RandomExamArrangeBLL eaBll = new RandomExamArrangeBLL();
            //IList<RailExam.Model.RandomExamArrange> ExamArranges = eaBll.GetRandomExamArranges(int.Parse(strId));
            //string strChooseID = "";
            //if (ExamArranges.Count > 0)
            //{
            //    strChooseID = ExamArranges[0].UserIds;
            //}
            //else
            //{
            //    strChooseID = "";
            //}

            //RandomExamResultCurrentBLL objResultCurrentBll = new RandomExamResultCurrentBLL();
            //IList<RandomExamResultCurrent> examResults = objResultCurrentBll.GetRandomExamResultInfo(Convert.ToInt32(strId));
            //for (int i = 0; i < examResults.Count; i++)
            //{
            //    strChooseID = ("," + strChooseID + ",").Replace("," + examResults[i].ExamineeId + ",", ",");
            //}

            //strChooseID = strChooseID.TrimStart(',').TrimEnd(',');

            string strChooseID = Request.QueryString.Get("addIds");

            if (strChooseID == string.Empty)
            {
                return;
            }

            string[] str = strChooseID.Split('|');

            System.Threading.Thread.Sleep(10);
            jsBlock = "<script>SetPorgressBar('正在计算生成试卷数量,请等待......','" + ((2 * 100) / ((double)2) + "'); </script>");
            Response.Write(jsBlock);
            Response.Flush();

            OracleAccess db = new OracleAccess();
            string       strSql;

            RandomExamResultAnswerCurrentBLL randomExamResultAnswerBLL = new RandomExamResultAnswerCurrentBLL();
            //定义全局答卷对象List
            IList <RandomExamResultAnswerCurrent> randomExamResultAnswersCurrentAll = new List <RandomExamResultAnswerCurrent>();
            //定义一个考生一次答卷对象List
            IList <RandomExamResultAnswerCurrent> randomExamResultAnswers = null;

            System.Threading.Thread.Sleep(200);
            jsBlock = string.Empty;
            int progressNum = 1;

            for (int n = 1; n <= ExamCount; n++)
            {
                for (int m = 0; m < str.Length; m++)
                {
                    RandomExamResultCurrentBLL randomExamResultBLL = new RandomExamResultCurrentBLL();
                    RandomExamResultCurrent    randomExamResult    = new RandomExamResultCurrent();

                    randomExamResult.RandomExamId    = int.Parse(strId);
                    randomExamResult.AutoScore       = 0;
                    randomExamResult.BeginDateTime   = DateTime.Parse(ViewState["BeginTime"].ToString());
                    randomExamResult.CurrentDateTime = DateTime.Parse(ViewState["BeginTime"].ToString());
                    randomExamResult.ExamTime        = 0;
                    randomExamResult.EndDateTime     = DateTime.Parse(ViewState["BeginTime"].ToString());
                    randomExamResult.Score           = 0;
                    randomExamResult.OrganizationId  = int.Parse(ConfigurationManager.AppSettings["StationID"]);
                    randomExamResult.Memo            = "";
                    randomExamResult.StatusId        = 0;
                    randomExamResult.AutoScore       = 0;
                    randomExamResult.CorrectRate     = 0;
                    randomExamResult.ExamineeId      = int.Parse(str[m]);
                    randomExamResult.ExamSeqNo       = n;

                    int nRandomExamResultPK = randomExamResultBLL.AddRandomExamResultCurrent(randomExamResult);
                    ViewState["RandomExamResultPK"] = nRandomExamResultPK;

                    strSql = "select a.* from Random_Exam_Arrange_Detail a "
                             + " where ','||User_Ids||',' like '%," + str[m] + ",%' "
                             + " and Random_Exam_ID=" + strId;
                    DataRow dr = db.RunSqlDataSet(strSql).Tables[0].Rows[0];


                    //strSql = "insert into Random_Exam_Result_Detail(Random_Exam_Result_Detail_ID,"
                    //         + "Random_Exam_Result_ID,Random_Exam_ID,Employee_ID,Computer_Room_SEAT,Computer_Room_ID) "
                    //         + "values(Random_Exam_Result_Detail_SEQ.NextVal,"
                    //         + nRandomExamResultPK + ","
                    //         + randomExamResult.RandomExamId + ","
                    //         + randomExamResult.ExamineeId + ","
                    //         + "0," + dr["Computer_Room_ID"] + ") ";
                    //db.ExecuteNonQuery(strSql);


                    strSql = "insert into Random_Exam_Result_Detail_Temp(Random_Exam_Result_Detail_ID,"
                             + "Random_Exam_Result_ID,Random_Exam_ID,Employee_ID,Computer_Room_SEAT,Computer_Room_ID,Is_Remove) "
                             + "values(Random_Exam_Result_Detail_SEQ.NextVal,"
                             + nRandomExamResultPK + ","
                             + randomExamResult.RandomExamId + ","
                             + randomExamResult.ExamineeId + ","
                             + "0," + dr["Computer_Room_ID"] + ",0) ";
                    db.ExecuteNonQuery(strSql);

                    RandomExamItemBLL     randomItemBLL = new RandomExamItemBLL();
                    RandomExamSubjectBLL  subjectBLL    = new RandomExamSubjectBLL();
                    RandomExamStrategyBLL strategyBLL   = new RandomExamStrategyBLL();

                    IList <RandomExamSubject> randomExamSubjects =
                        subjectBLL.GetRandomExamSubjectByRandomExamId(int.Parse(strId));

                    if (randomExamSubjects != null)
                    {
                        Hashtable hashTableItemIds = new Hashtable();
                        Hashtable htSubjectItemIds = new Hashtable();
                        for (int i = 0; i < randomExamSubjects.Count; i++)
                        {
                            RandomExamSubject paperSubject = randomExamSubjects[i];
                            int nSubjectId = paperSubject.RandomExamSubjectId;
                            //  int nItemCount = paperSubject.ItemCount;

                            IList <RandomExamStrategy> strategys = strategyBLL.GetRandomExamStrategys(nSubjectId);
                            for (int j = 0; j < strategys.Count; j++)
                            {
                                int nStrategyId = strategys[j].RandomExamStrategyId;
                                int nItemCount  = strategys[j].ItemCount;
                                IList <RandomExamItem> itemList = randomItemBLL.GetItemsByStrategyId(nStrategyId, year);

                                // IList<RandomExamItem> itemList = randomItemBLL.GetItemsBySubjectId(nSubjectId);

                                Random    ObjRandom      = new Random();
                                Hashtable hashTable      = new Hashtable();
                                Hashtable hashTableCount = new Hashtable();
                                int       index          = 0;
                                while (hashTable.Count < nItemCount)
                                {
                                    int k = ObjRandom.Next(itemList.Count);
                                    hashTableCount[index] = k;
                                    index = index + 1;
                                    int itemID     = itemList[k].ItemId;
                                    int examItemID = itemList[k].RandomExamItemId;
                                    if (!hashTableItemIds.ContainsKey(itemID))
                                    {
                                        hashTable[examItemID]        = examItemID;
                                        hashTableItemIds[itemID]     = itemID;
                                        htSubjectItemIds[examItemID] = examItemID;
                                    }
                                    //if (hashTableCount.Count == itemList.Count && hashTable.Count < nItemCount)
                                    //{
                                    //    SessionSet.PageMessage = "随机考试在设定的取题范围内的试题量不够,请重新设置取题范围!";
                                    //    return;
                                    //}
                                }
                            }
                        }
                        randomExamResultAnswers = new List <RandomExamResultAnswerCurrent>();
                        foreach (int key in htSubjectItemIds.Keys)
                        {
                            string strItemId = htSubjectItemIds[key].ToString();

                            RandomExamItem item = randomItemBLL.GetRandomExamItem(Convert.ToInt32(strItemId), year);

                            string nowSelectAnswer   = string.Empty;
                            string nowStandardAnswer = string.Empty;
                            if (item.TypeId != PrjPub.ITEMTYPE_FILLBLANK)
                            {
                                Pub.GetNowAnswer(item, out nowSelectAnswer, out nowStandardAnswer);
                            }

                            RandomExamResultAnswerCurrent randomExamResultAnswer = new RandomExamResultAnswerCurrent();
                            randomExamResultAnswer.RandomExamResultId = nRandomExamResultPK;
                            randomExamResultAnswer.RandomExamItemId   = int.Parse(strItemId);
                            randomExamResultAnswer.JudgeStatusId      = 0;
                            randomExamResultAnswer.JudgeRemark        = string.Empty;
                            randomExamResultAnswer.ExamTime           = 0;
                            randomExamResultAnswer.Answer             = string.Empty;
                            randomExamResultAnswer.SelectAnswer       = nowSelectAnswer;
                            randomExamResultAnswer.StandardAnswer     = nowStandardAnswer;
                            randomExamResultAnswerBLL.AddExamResultAnswerCurrent(randomExamResultAnswer);

                            //完型填空子题
                            IList <RandomExamItem> randomExamItems = randomItemBLL.GetItemsByParentItemID(item.ItemId, obj.RandomExamId, year);
                            foreach (RandomExamItem randomExamItem in randomExamItems)
                            {
                                Pub.GetNowAnswer(randomExamItem, out nowSelectAnswer, out nowStandardAnswer);

                                randomExamResultAnswer = new RandomExamResultAnswerCurrent();
                                randomExamResultAnswer.RandomExamResultId = nRandomExamResultPK;
                                randomExamResultAnswer.RandomExamItemId   = randomExamItem.RandomExamItemId;
                                randomExamResultAnswer.JudgeStatusId      = 0;
                                randomExamResultAnswer.JudgeRemark        = string.Empty;
                                randomExamResultAnswer.ExamTime           = 0;
                                randomExamResultAnswer.Answer             = string.Empty;
                                randomExamResultAnswer.SelectAnswer       = nowSelectAnswer;
                                randomExamResultAnswer.StandardAnswer     = nowStandardAnswer;
                                randomExamResultAnswerBLL.AddExamResultAnswerCurrent(randomExamResultAnswer);
                            }

                            System.Threading.Thread.Sleep(10);
                            jsBlock = "<script>SetPorgressBar('正在生成试卷,请等待......','" + ((progressNum * 100) / ((double)ExamCount * str.Length * htSubjectItemIds.Count)).ToString("0.00") + "'); </script>";
                            Response.Write(jsBlock);
                            Response.Flush();

                            progressNum++;
                        }
                    }
                    else
                    {
                        SessionSet.PageMessage = "未找到记录!";
                    }
                }
            }

            //临时添加考生无需更改考试状态,因为考试状态肯定是正在进行和生成试卷
            //objBll.UpdateHasPaper(Convert.ToInt32(strId), PrjPub.ServerNo, true);
            ////如果考试是随到随考,考试状态自动变为正在进行
            //if (obj.StartMode == 1)
            //{
            //    objBll.UpdateIsStart(Convert.ToInt32(strId), PrjPub.ServerNo, 1);
            //}

            SystemLogBLL objLogBll = new SystemLogBLL();

            objLogBll.WriteLog("“" + obj.ExamName + "”生成新增考生试卷");

            Response.Write("<script>top.returnValue='true';top.close();</script>");
        }
Exemple #14
0
        protected void btnDelPaper_Click(object sender, EventArgs e)
        {
            string strId = Request.QueryString.Get("RandomExamID");

            if (string.IsNullOrEmpty(strId))
            {
                SessionSet.PageMessage = "缺少参数!";
                return;
            }

            //获取当前考试的生成试卷的状态和次数
            RandomExamBLL objBll = new RandomExamBLL();

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

            RandomExamResultCurrentBLL      objResultCurrentBll = new RandomExamResultCurrentBLL();
            IList <RandomExamResultCurrent> objList             = objResultCurrentBll.GetRandomExamResultInfo(Convert.ToInt32(strId));
            int n = 0;

            foreach (RandomExamResultCurrent current in objList)
            {
                if (current.StatusId > 0)
                {
                    n = 1;
                    break;
                }
            }
            if (n > 0)
            {
                SessionSet.PageMessage = "当前考试有考生参加考试,不能再删除试卷!";
                return;
            }

            RandomExamComputerServerBLL serverBll = new RandomExamComputerServerBLL();
            RandomExamComputerServer    server    = serverBll.GetRandomExamComputerServer(objExam.RandomExamId,
                                                                                          PrjPub.ServerNo);

            //if (!server.HasPaper)
            //{
            //    SessionSet.PageMessage = "当前考试还未生成试卷,不能删除试卷!";
            //    return;
            //}

            if (server.IsStart == 2)
            {
                SessionSet.PageMessage = "当前考试已经结束,不能再删除试卷!";
                return;
            }

            try
            {
                objResultCurrentBll.DelRandomExamResultCurrent(Convert.ToInt32(strId));
                objBll.UpdateHasPaper(Convert.ToInt32(strId), PrjPub.ServerNo, false);
                objBll.UpdateIsStart(Convert.ToInt32(strId), PrjPub.ServerNo, 0);
                if (objExam.StartMode == 2)
                {
                    objBll.UpdateStartCode(Convert.ToInt32(strId), PrjPub.ServerNo, string.Empty);
                    lblTitle.Visible = false;
                    lblCode.Visible  = false;
                    btnApply.Visible = false;
                }
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("“" + objExam.ExamName + "”删除所有考试试卷");
                SessionSet.PageMessage = "删除试卷成功!";

                ClientScript.RegisterStartupScript(GetType(),
                                                   "jsSelectFirstNode",
                                                   @"refreshGrid();",
                                                   true);
            }
            catch (Exception ex)
            {
                SessionSet.PageMessage = "删除试卷失败!";
                Pub.ShowErrorPage(ex.Message);
            }
        }
Exemple #15
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack && !searchExamCallBack.IsCallback)
            {
                //如果是系统管理员访问站段服务器则没有权限监控站段考试
                if (!PrjPub.IsServerCenter && PrjPub.CurrentLoginUser.IsAdmin && PrjPub.CurrentLoginUser.RoleID == 1)
                {
                    btnGetPaper.Enabled    = false;
                    btnDelPaper.Enabled    = false;
                    btnStart.Enabled       = false;
                    btnStop.Enabled        = false;
                    btnEnd.Enabled         = false;
                    btnUpload.Enabled      = false;
                    btnUploadScore.Enabled = false;
                    HfUpdateRight.Value    = "False";
                }

                //if (PrjPub.IsWuhan())
                //{
                //    examsGrid.Levels[0].Columns[3].HeadingText = "员工编码";
                //}
                //else
                //{
                //    examsGrid.Levels[0].Columns[3].HeadingText = "工资编号";
                //}

                if (PrjPub.IsServerCenter)
                {
                    btnUpload.Enabled      = false;
                    btnUploadScore.Enabled = false;
                }

                //当前站段有两台服务器并且当前服务器为次服务器时屏蔽“删除所有考生试卷”和“上传考试成绩”按钮
                //if(!PrjPub.IsServerCenter && PrjPub.HasTwoServer() && !PrjPub.IsMainServer())
                //{
                //    btnGetPaper.Visible = false;
                //    btnDelPaper.Visible = false;
                //    btnUpload.Visible = false;
                //}

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

                string strId = Request.QueryString.Get("RandomExamID");

                RandomExamArrangeBLL      objArrangeBll  = new RandomExamArrangeBLL();
                IList <RandomExamArrange> objArrangeList = objArrangeBll.GetRandomExamArranges(Convert.ToInt32(strId));
                string[] str = { "0" };
                hfNowCount.Value = "0";
                if (objArrangeList.Count == 1)
                {
                    string strSql = "select * 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 b.Org_ID='" + ConfigurationManager.AppSettings["StationID"] + "'"
                                    + " and c.Computer_Server_No='" + PrjPub.ServerNo + "'"
                                    + " and Random_Exam_ID=" + strId;
                    OracleAccess db = new OracleAccess();
                    DataSet      ds = db.RunSqlDataSet(strSql);

                    string strUserId = "";
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        if (string.IsNullOrEmpty(strUserId))
                        {
                            strUserId += dr["User_Ids"].ToString();
                        }
                        else
                        {
                            strUserId += "," + dr["User_Ids"];
                        }
                    }

                    strUserId = ("," + strUserId + ",").Replace(",0,", ",");
                    str       = ((strUserId.TrimStart(',')).TrimEnd(',')).Split(',');

                    ExamBLL objexambll = new ExamBLL();
                    IList <RailExam.Model.Exam> objExamList = objexambll.GetExamsInfoByOrgID(null, -1, Convert.ToDateTime("0001-01-01"), Convert.ToDateTime("0001-01-01"),
                                                                                             Convert.ToInt32(hfOrgID.Value), PrjPub.IsServerCenter.ToString());
                    foreach (RailExam.Model.Exam objExam in objExamList)
                    {
                        if (objExam.ExamId == Convert.ToInt32(strId))
                        {
                            hfNowCount.Value = (str.Length - objExam.ExamineeCount).ToString();
                            break;
                        }
                    }
                }

                //获取当前考试的生成试卷的状态和次数
                RandomExamBLL             objBll        = new RandomExamBLL();
                RailExam.Model.RandomExam objRandomExam = objBll.GetExam(Convert.ToInt32(strId));

                RandomExamComputerServerBLL serverBll = new RandomExamComputerServerBLL();
                RandomExamComputerServer    server    = serverBll.GetRandomExamComputerServer(objRandomExam.RandomExamId,
                                                                                              PrjPub.ServerNo);

                if (server.HasPaper && objRandomExam.StartMode == 2 && server.IsStart != 0)
                {
                    lblTitle.Text    = "考试验证码:";
                    lblCode.Text     = server.RandomExamCode;
                    btnApply.Visible = true;
                }

                if (server.HasPaper && server.IsStart != 2)// && !objRandomExam.HasTrainClass
                {
                    btnAddEmployee.Visible = true;
                }


                if (PrjPub.CurrentLoginUser.EmployeeID != 0)
                {
                    examsGrid.Levels[0].Columns[12].Visible = false;
                }
            }

            if (!searchExamCallBack.IsCallback)
            {
                hfSql.Value = GetSql();
                examsGrid.DataBind();
            }

            if (Request.Form.Get("OutPutRandom") != null && Request.Form.Get("OutPutRandom") != "")
            {
                OutputWord(Request.Form.Get("OutPutRandom"));
            }

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

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

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

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

            if (Request.Form.Get("IsGet") != null && Request.Form.Get("IsGet") != "")
            {
                hfSql.Value = GetSql();
                examsGrid.DataBind();
                string                    strId  = Request.QueryString.Get("RandomExamID");
                RandomExamBLL             objBll = new RandomExamBLL();
                RailExam.Model.RandomExam obj    = objBll.GetExam(Convert.ToInt32(strId));
                //if(!obj.HasTrainClass)
                //{
                btnAddEmployee.Visible = true;
                //}
                SessionSet.PageMessage = "生成成功!";
            }

            if (Request.Form.Get("IsEnd") != null && Request.Form.Get("IsEnd") != "")
            {
                hfSql.Value = GetSql();
                examsGrid.DataBind();
                SessionSet.PageMessage = "结束考试成功!";
            }

            if (Request.Form.Get("IsUpload") != null && Request.Form.Get("IsUpload") != "")
            {
                hfSql.Value = GetSql();
                examsGrid.DataBind();
                string                    strId     = Request.QueryString.Get("RandomExamID");
                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("IsStart") != null && Request.Form.Get("IsStart") != "")
            {
                hfSql.Value = GetSql();
                examsGrid.DataBind();
                SessionSet.PageMessage = "开始考试成功!";
                string strId = Request.QueryString.Get("RandomExamID");
                //获取当前考试的生成试卷的状态和次数
                RandomExamBLL             objBll  = new RandomExamBLL();
                RailExam.Model.RandomExam objExam = objBll.GetExam(Convert.ToInt32(strId));

                RandomExamComputerServerBLL serverBll = new RandomExamComputerServerBLL();
                RandomExamComputerServer    server    = serverBll.GetRandomExamComputerServer(objExam.RandomExamId,
                                                                                              PrjPub.ServerNo);


                if (server.HasPaper && objExam.StartMode == 2)
                {
                    lblCode.Text     = "考试验证码:" + server.RandomExamCode;
                    btnApply.Visible = true;
                }
                ClientScript.RegisterStartupScript(GetType(),
                                                   "jsSelectFirstNode",
                                                   @"ApplyExam();",
                                                   true);
            }

            if (Request.Form.Get("StudentInfo") != null && Request.Form.Get("StudentInfo") != "" && !searchExamCallBack.IsCallback)
            {
                DownloadStudentInfoExcel();
            }

            refreshGridCallback.RefreshInterval = Convert.ToInt32(ConfigurationManager.AppSettings["RefreshInterval"]);

            btnUpload.Visible = btnUploadScore.Visible = false; // 包神这里用不著上传 2014-03-18
        }
        /// <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 = "数据新增失败!";
                }
            }
        }
Exemple #17
0
        private void StopExam(string strResultID)
        {
            ViewState["EndTime"] = DateTime.Now.ToString();
            //记录当前考试所在地的OrgID
            ViewState["OrgID"] = ConfigurationManager.AppSettings["StationID"];

            RandomExamResultCurrentBLL objResultCurrentBll = new RandomExamResultCurrentBLL();
            RandomExamResultCurrent    objResultCurrent    = objResultCurrentBll.GetRandomExamResult(Convert.ToInt32(strResultID));

            objResultCurrent.CurrentDateTime = DateTime.Parse(ViewState["EndTime"].ToString());
            objResultCurrent.ExamTime        = GetSecondBetweenTwoDate(DateTime.Parse(ViewState["EndTime"].ToString()),
                                                                       objResultCurrent.BeginDateTime);

            objResultCurrent.EndDateTime    = DateTime.Parse(ViewState["EndTime"].ToString());
            objResultCurrent.Score          = 0;
            objResultCurrent.OrganizationId = int.Parse(ViewState["OrgID"].ToString());
            objResultCurrent.Memo           = "";
            //参加考试将当前考试的标志置为2-已经结束
            objResultCurrent.StatusId    = 2;
            objResultCurrent.AutoScore   = 0;
            objResultCurrent.CorrectRate = 0;

            RandomExamResultBLL objResultBll = new RandomExamResultBLL();

            try
            {
                objResultCurrentBll.UpdateRandomExamResultCurrent(objResultCurrent);
                int randomExamResultID = objResultBll.RemoveResultAnswer(Convert.ToInt32(strResultID));

                //将实时考试记录(临时表)转存到中间考试成绩表和答卷表
                //int randomExamResultID = objResultBll.RemoveResultAnswerCurrent(Convert.ToInt32(strResultID));

                try
                {
                    OracleAccess dbPhoto = new OracleAccess();
                    string       strSql  = "select * from Random_Exam_Result_Detail where Random_Exam_Result_ID=" +
                                           randomExamResultID + " and Random_Exam_ID=" + objResultCurrent.RandomExamId;
                    DataSet dsPhoto = dbPhoto.RunSqlDataSet(strSql);

                    if (dsPhoto.Tables[0].Rows.Count > 0)
                    {
                        DataRow drPhoto    = dsPhoto.Tables[0].Rows[0];
                        int     employeeId = Convert.ToInt32(drPhoto["Employee_ID"]);
                        if (drPhoto["FingerPrint"] != DBNull.Value)
                        {
                            Pub.SavePhotoToLocal(objResultCurrent.RandomExamId, employeeId, (byte[])drPhoto["FingerPrint"], 0, randomExamResultID);
                        }
                        if (drPhoto["Photo1"] != DBNull.Value)
                        {
                            Pub.SavePhotoToLocal(objResultCurrent.RandomExamId, employeeId, (byte[])drPhoto["Photo1"], 1, randomExamResultID);
                        }
                        if (drPhoto["Photo2"] != DBNull.Value)
                        {
                            Pub.SavePhotoToLocal(objResultCurrent.RandomExamId, employeeId, (byte[])drPhoto["Photo2"], 2, randomExamResultID);
                        }
                        if (drPhoto["Photo3"] != DBNull.Value)
                        {
                            Pub.SavePhotoToLocal(objResultCurrent.RandomExamId, employeeId, (byte[])drPhoto["Photo3"], 3, randomExamResultID);
                        }
                    }
                }
                catch
                {
                    hfSql.Value = GetSql();
                }

                #region   路局
                //try
                //{
                //    if (!PrjPub.IsServerCenter)
                //    {
                //        RandomExamResult randomExamResult =
                //            objResultBll.GetRandomExamResult(randomExamResultID);
                //        objResultBll.AddRandomExamResultToServer(randomExamResult);
                //    }
                //}
                //catch
                //{
                //    Pub.ShowErrorPage("无法连接路局服务器,请检查站段服务器网络连接是否正常!");
                //}
                #endregion

                hfSql.Value = GetSql();
                examsGrid.DataBind();
                RandomExamBLL objBll    = new RandomExamBLL();
                SystemLogBLL  objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("“" + objBll.GetExam(objResultCurrent.RandomExamId).ExamName + "”中的“" + objResultCurrent.ExamineeName + "”终止考试");
                SessionSet.PageMessage = "终止考试成功!";
            }
            catch
            {
                SessionSet.PageMessage = "终止考试失败!";
            }
        }
Exemple #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            hfChapterID.Value = Request.QueryString["id"];

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

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

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

                AssistBookChapterBLL objBill = new AssistBookChapterBLL();
                objBill.UpdateAssistBookChapterUrl(Convert.ToInt32(Request.QueryString["id"].ToString()), strPath);
                RailExam.Model.AssistBookChapter objBookChapter = objBill.GetAssistBookChapter(Convert.ToInt32(Request.QueryString["id"].ToString()));
                string strChapterName = objBookChapter.ChapterName;

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

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

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


                AssistBookBLL objBookBill = new AssistBookBLL();
                string        strBookName = objBookBill.GetAssistBook(Convert.ToInt32(Request.QueryString["BookID"].ToString())).BookName;

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

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

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

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

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

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

            if (!string.IsNullOrEmpty(strDeleteBookChapterUpdateID))
            {
                DeleteData(int.Parse(strDeleteBookChapterUpdateID));
                Grid1.DataBind();
            }
        }
Exemple #19
0
        public HttpResponseMessage AddYhTask(YH_YhtaskModel model)
        {
            string[]         fileClass = model.uploadpanelValue;
            List <FileClass> list      = new List <FileClass>();

            if (fileClass != null && fileClass.Length > 0)
            {
                foreach (var item in fileClass)
                {
                    FileClass file = new FileClass();
                    JObject   jo   = new JObject();
                    jo = (JObject)JsonConvert.DeserializeObject(item);
                    file.OriginalPath = jo["OriginalPath"] == null ? "" : jo["OriginalPath"].ToString();
                    file.OriginalName = jo["OriginalName"] == null ? "" : jo["OriginalName"].ToString();
                    file.OriginalType = jo["OriginalType"] == null ? "" : jo["OriginalType"].ToString();
                    file.size         = jo["size"] == null ? 0 : (double)jo["size"];
                    list.Add(file);
                }
            }


            yh_yhtasks yhmodel = new yh_yhtasks();

            yhmodel.yhcompany    = model.yhcompany;
            yhmodel.foundtime    = model.foundtime;
            yhmodel.fileename    = model.fileename;
            yhmodel.wtsource     = model.wtsource;
            yhmodel.yhtype       = model.yhtype;
            yhmodel.wtbigclass   = model.wtbigclass;
            yhmodel.wtsmallclass = model.wtsmallclass;
            yhmodel.yhobject     = model.yhobject;
            yhmodel.weather      = model.weather;
            yhmodel.duetime      = model.duetime;
            yhmodel.outlay       = model.outlay;
            yhmodel.workload     = model.workload;
            yhmodel.yhcontract   = model.yhcontract;
            yhmodel.wtaddress    = model.wtaddress;
            yhmodel.wtdescribe   = model.wtdescribe;
            yhmodel.geography84  = model.geography84;
            //if (!string.IsNullOrEmpty(model.geography84))
            //{
            //    yhmodel.geography2000=new MapXYConvent().WGS84ToCGCS2000(model.geography84);
            //}
            yhmodel.wtnature     = model.wtnature;
            yhmodel.points       = model.points;
            yhmodel.debit        = model.debit;
            yhmodel.sendusername = model.sendusername;
            yhmodel.sendopinion  = model.sendopinion;
            yhmodel.createuserid = model.createuserid;
            WorkFlowClass wf = new WorkFlowClass();

            wf.FunctionName   = "yh_yhtasks";                  //市民事件表名
            wf.WFID           = "2017040610490001";            //工作流程编号 2017021409560001 事件流程
            wf.WFDID          = "2017040610570001";            //工作流详细编号 2017021410240001 上报事件
            wf.NextWFDID      = "2017040610570002";            //下一步流程编号 2017021410240002 事件派遣
            wf.NextWFUSERIDS  = model.createuserid.ToString(); //下一步流程ID
            wf.IsSendMsg      = "false";                       //是否发送短信
            wf.WFCreateUserID = model.createuserid;            //当前流程创建人
            wf.files          = list;
            WorkFlowManagerBLL wfbll = new WorkFlowManagerBLL();
            string             wf_id = wfbll.WF_Submit(wf, yhmodel);

            #region 添加日志
            SystemLogBLL slbll = new SystemLogBLL();
            slbll.WriteSystemLog("养护问题", "", (int)model.createuserid);
            #endregion

            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK);
            response.Content = new StringContent("{\"success\":true}", Encoding.GetEncoding("UTF-8"), "text/html");
            return(response);
        }
Exemple #20
0
        public HttpResponseMessage AddSpecialTask(Zxzz_TaskModel model)
        {
            HttpRequestBase    request = ((HttpContextWrapper)this.Request.Properties["MS_HttpContext"]).Request;
            WorkFlowManagerBLL bll     = new WorkFlowManagerBLL();
            WorkFlowClass      wf      = new WorkFlowClass();
            List <FileClass>   list    = new List <FileClass>();
            zxzz_tasks         ztmodel = new zxzz_tasks();

            ztmodel.title        = model.title;
            ztmodel.tasktype     = model.tasktype;
            ztmodel.level        = model.level;
            ztmodel.term         = model.term;
            ztmodel.starttime    = model.starttime;
            ztmodel.endtime      = model.endtime;
            ztmodel.region       = model.region;
            ztmodel.taskexplain  = model.taskexplain;
            ztmodel.grometry     = model.grometry;
            ztmodel.fqr          = model.fqr;
            ztmodel.fqtime       = model.fqtime;
            ztmodel.leader       = model.leader;
            ztmodel.createuserid = model.fqr;
            ztmodel.createtime   = DateTime.Now;

            string[] fileClass     = model.uploadpanelValue;
            string[] fileClassXDZD = model.xdzdValue;

            foreach (var item in fileClassXDZD)
            {
                model.xdzd += item + ",";
            }
            ztmodel.xdzd = model.xdzd.Substring(0, model.xdzd.Length - 1);

            if (fileClass != null && fileClass.Length > 0)
            {
                foreach (var item in fileClass)
                {
                    FileClass infileClass = new FileClass();
                    JObject   jo          = new JObject();
                    jo = (JObject)JsonConvert.DeserializeObject(item);
                    infileClass.OriginalPath = jo["OriginalPath"] == null ? "" : jo["OriginalPath"].ToString();
                    infileClass.OriginalName = jo["OriginalName"] == null ? "" : jo["OriginalName"].ToString();
                    infileClass.OriginalType = jo["OriginalType"] == null ? "" : jo["OriginalType"].ToString();
                    infileClass.size         = jo["size"] == null ? 0 : (double)jo["size"];
                    list.Add(infileClass);
                }
            }

            #region 专项整治流程
            wf.FunctionName   = "zxzz_tasks";
            wf.WFID           = "2017041214100001";
            wf.WFDID          = "2017041214200001";
            wf.NextWFDID      = "2017041214200002";
            wf.NextWFUSERIDS  = model.leader.ToString();
            wf.IsSendMsg      = "false";
            wf.WFCreateUserID = model.fqr;
            wf.files          = list;
            #endregion

            bll.WF_Submit(wf, ztmodel);

            #region 添加日志
            SystemLogBLL slbll = new SystemLogBLL();
            slbll.WriteSystemLog("专项整治", "", (int)model.fqr);
            #endregion

            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK);
            response.Content = new StringContent("{\"success\":true}", Encoding.GetEncoding("UTF-8"), "text/html");
            return(response);
        }
        protected void btnOK_Click(object sender, EventArgs e)
        {
            string        strId  = Request.QueryString.Get("RandomExamID");
            RandomExamBLL objBll = new RandomExamBLL();

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

            #region 验证试卷完整性

            /*OracleAccess db = new OracleAccess();
             *
             * //查询本场考试现有生成试卷的总题数(完型填空子题除外)
             *      int beginYear = obj.BeginTime.Year;
             * string strSql =
             * @"select * from Random_Exam_Result_Answer_Cur a
             *          inner join Random_Exam_Item_"+beginYear+@" b on a.Random_Exam_Item_ID=b.Random_Exam_Item_ID
             *          where b.Type_ID<>5 and Random_Exam_Result_ID in (
             *          select Random_Exam_Result_ID from Random_Exam_Result_Current
             *          where Random_Exam_ID=" + strId + ")";
             * DataSet dsAnswer = db.RunSqlDataSet(strSql);
             *
             * //查询本场考试题目个数
             *      strSql = "select Sum(Item_Count) from Random_Exam_Subject where Random_Exam_ID=" + strId;
             * DataSet dsSubject = db.RunSqlDataSet(strSql);
             *      int itemCount = Convert.ToInt32(dsSubject.Tables[0].Rows[0][0]);
             *
             * //查询本服务器所有考生信息
             * 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 c.Computer_server_ID=b.Computer_Server_ID"
             + " where c.Computer_Server_No='" + PrjPub.ServerNo + "' "
             + " and Random_Exam_ID=" + strId;
             + DataSet ds = db.RunSqlDataSet(strSql);
             +      string strChooseID = string.Empty;
             + foreach (DataRow dr in ds.Tables[0].Rows)
             + {
             +  if (string.IsNullOrEmpty(strChooseID))
             +  {
             +      strChooseID += dr["User_Ids"].ToString();
             +  }
             +  else
             +  {
             +      strChooseID += "," + dr["User_Ids"];
             +  }
             + }
             +      int employeeCount = strChooseID.Split(',').Length;
             +
             + if (dsAnswer.Tables[0].Rows.Count != itemCount*employeeCount)
             + {
             +  Response.Write("<script>alert('本场考试试卷生成有误,请联系监考老师删除考试试卷后重新下载后生成!'); top.close();</script>");
             +  return;
             + }*/
            #endregion

            objBll.UpdateStartCode(Convert.ToInt32(strId), PrjPub.ServerNo, txtCode.Text);
            objBll.UpdateIsStart(Convert.ToInt32(strId), PrjPub.ServerNo, 1);

            SystemLogBLL objLogBll = new SystemLogBLL();
            objLogBll.WriteLog("“" + obj.ExamName + "”开始考试");
            Response.Write("<script>top.returnValue='true';top.close();</script>");
        }
Exemple #22
0
        public object AddSimpleCaseApi(Case_SimpleCasesModel csmodel)
        {
            Case_SimpleCasesBLL   bll           = new Case_SimpleCasesBLL();
            Case_CaseSourcesBLL   casesourcebll = new Case_CaseSourcesBLL();
            Case_SimpleCasesModel model         = new Case_SimpleCasesModel();

            #region 图片处理
            List <FileClass> List_FC    = new List <FileClass>();
            string           OriginPath = ConfigManageClass.LegalCasePath;
            string           smallPath  = ConfigManageClass.LegalCasePath;
            if (csmodel.uploadpanelValue != null)
            {
                for (int i = 0; i < csmodel.uploadpanelValue.Length; i++)
                {
                    string   imgArray = csmodel.uploadpanelValue[i];
                    string[] spilt    = imgArray.Split(',');
                    if (spilt.Length > 0)
                    {
                        byte[]    imgByte = Convert.FromBase64String(spilt[1]);
                        FileClass imgFile = FileFactory.FileUpload(imgByte, ".jpg", OriginPath, smallPath, 100, 100);
                        List_FC.Add(imgFile);
                    }
                }
            }

            #endregion

            try
            {
                model.cfjdsbh        = csmodel.cfjdsbh;
                model.casetypeid     = csmodel.casetypeid;
                model.casename       = csmodel.casename;
                model.qlsxid         = csmodel.qlsxid;
                model.qlsx           = csmodel.qlsx;
                model.casereason     = csmodel.casereason;
                model.caseaddress    = csmodel.caseaddress;
                model.sitedatetime   = csmodel.sitedatetime;
                model.geographical84 = csmodel.geographical84;
                model.persontype     = csmodel.persontype;
                if (csmodel.persontype == "type_zrr")
                {
                    model.p_name = csmodel.p_name;
                    model.f_card = csmodel.p_cardnum;
                }
                else
                {
                    model.f_card    = csmodel.f_cardnum;
                    model.f_name    = csmodel.f_name;
                    model.f_dbr     = csmodel.f_dbr;
                    model.f_cardnum = csmodel.f_card;
                }

                model.p_sex            = csmodel.p_sex;
                model.p_cardtype       = csmodel.p_cardtype;
                model.f_cardtype       = csmodel.p_cardtype;
                model.p_cardnum        = csmodel.p_cardnum;
                model.f_wtr            = csmodel.f_wtr;
                model.contactphone     = csmodel.contactphone;
                model.contactaddress   = csmodel.contactaddress;
                model.flfg             = csmodel.flfg;
                model.clyj             = csmodel.clyj;
                model.wfqx             = csmodel.wfqx;
                model.cf               = csmodel.cf;
                model.casecontent      = csmodel.casecontent;
                model.jktype           = csmodel.jktype;
                model.fk_money         = csmodel.fk_money;
                model.bank_name        = csmodel.bank_name;
                model.bank_account     = csmodel.bank_account;
                model.bank_accountname = csmodel.bank_accountname;
                model.zfr_name         = csmodel.zfr_name;
                model.zf_card          = csmodel.zf_card;
                model.zf_time          = csmodel.zf_time;
                model.zf_address       = csmodel.zf_address;
                model.createuserid     = csmodel.createuserid;

                model.isphone = 1;



                int simpleid = bll.AddSimpleCases(model);

                Case_WorkFlowManagerBLL wfbll = new Case_WorkFlowManagerBLL();
                Case_WorkFlowClass      wf    = new Case_WorkFlowClass();

                #region 案件流程
                wf.FunctionName   = "case_sources";
                wf.WFID           = "2017022219210001";
                wf.WFDID          = "2017022219200001";
                wf.NextWFDID      = "2017022219200002";
                wf.NextWFUSERIDS  = "";                   //下一步流程ID
                wf.IsSendMsg      = "false";              //是否发送短信
                wf.casereason     = csmodel.casereason;
                wf.WFCreateUserID = csmodel.createuserid; //当前流程创建人
                wf.casetype       = 3;
                wf.caseid         = simpleid;
                #endregion

                string wf_data = wfbll.WF_Submit(wf);

                #region 简易案件文书
                List <Doc_WfsasModel> WfsasList = new List <Doc_WfsasModel>();
                Doc_WfsasModel        dwmodel   = new Doc_WfsasModel();

                dwmodel.wfsaid       = wf_data.Split(new string[] { "wfsaid\":\"" }, StringSplitOptions.RemoveEmptyEntries)[1].Substring(0, 22);
                dwmodel.filetyoe     = 3;
                dwmodel.ddid         = 12;
                dwmodel.createuserid = csmodel.createuserid;
                dwmodel.ddtablename  = "case_simplecases";
                dwmodel.caseid       = simpleid;
                dwmodel.ddtableid    = simpleid;
                dwmodel.filename     = "立案审批表";
                dwmodel.status       = 0;

                //生成WORD、PDF文件
                DocumentReplaceHandleBLL    drhbll = new DocumentReplaceHandleBLL();
                Dictionary <string, string> dic    = casesourcebll.ToWordPDF(dwmodel.filename, System.Web.Hosting.HostingEnvironment.MapPath("~/DocumentTemplate/" + dwmodel.filename + (model.persontype == "type_zrr" ? "(个人)" : "(单位)") + ".docx"), ConfigManageClass.LegalCasePath, drhbll.GetDocumentDictory(model));

                dwmodel.lastwordpath = dic["WordPath"];
                dwmodel.lastpdfpath  = dic["PDFPath"];

                WfsasList.Add(dwmodel);
                casesourcebll.function_AddWfsas(WfsasList);
                #endregion


                #region 手机端上报图片文书
                int i = 0;
                Dictionary <string, string> imgdic = new Dictionary <string, string>();
                string abspath = System.Web.Hosting.HostingEnvironment.MapPath("~/DocumentTemplate/图片模板.docx");
                foreach (var item in List_FC)
                {
                    imgdic.Add(i.ToString(), OriginPath + item.OriginalPath);
                    i++;
                }
                casesourcebll.ImagesToWordPDF(dwmodel.filename, abspath, ConfigManageClass.LegalCasePath, imgdic);

                #endregion

                #region 添加日志
                SystemLogBLL slbll = new SystemLogBLL();
                slbll.WriteSystemLog("简易案件", "", csmodel.createuserid);
                #endregion

                return(new
                {
                    msg = "上报成功",
                    resCode = 1
                });
            }
            catch (Exception)
            {
                return(new
                {
                    msg = "json数据不正确",
                    resCode = 0
                });
            }
        }
Exemple #23
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);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            hfChapterID.Value = Request.QueryString["id"];
            hfIsWuhan.Value   = PrjPub.IsWuhan().ToString();

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


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

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

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

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

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

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


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

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

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

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

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

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

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

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

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

            if (!string.IsNullOrEmpty(strDeleteBookChapterUpdateID))
            {
                DeleteData(int.Parse(strDeleteBookChapterUpdateID));
                Grid1.DataBind();
            }
        }
        //保存数据
        private void saveData()
        {
            string type = Request.QueryString["Type"];//1为修改 2为新增
            string id   = Request.QueryString["ID"];

            OracleAccess db     = new OracleAccess();
            string       strSql = "";

            if (!string.IsNullOrEmpty(txtIDENTITY_CARDNO.Text.Trim()))
            {
                if (type == "1")
                {
                    strSql = "select a.*,GetOrgName(GetStationOrgID(a.Org_ID)) OrgName from Employee a where Identity_CardNo='" + txtIDENTITY_CARDNO.Text.Trim() +
                             "' and Employee_ID<>" + id;
                }
                else
                {
                    strSql = "select a.*,GetOrgName(GetStationOrgID(a.Org_ID)) OrgName from Employee a where Identity_CardNo='" + txtIDENTITY_CARDNO.Text.Trim() + "'";
                }

                DataSet ds = db.RunSqlDataSet(strSql);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    string strName = ds.Tables[0].Rows[0]["Employee_Name"].ToString();
                    string orgName = ds.Tables[0].Rows[0]["OrgName"].ToString();
                    SessionSet.PageMessage = "该身份证号码在系统中已存在,与【" + orgName + "】的【" + strName + "】身份证号相同!";
                    return;
                }
            }

            if (!string.IsNullOrEmpty(txtWORK_NO.Text.Trim()))
            {
                if (type == "1")
                {
                    strSql = "select a.*,GetOrgName(GetStationOrgID(a.Org_ID)) OrgName from Employee a where Work_No='" + txtWORK_NO.Text.Trim() +
                             "' and Employee_ID<>" + id;
                }
                else
                {
                    strSql = "select a.*,GetOrgName(GetStationOrgID(a.Org_ID)) OrgName from Employee a where Work_No='" + txtWORK_NO.Text.Trim() + "'";
                }

                DataSet ds = db.RunSqlDataSet(strSql);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    string strName = ds.Tables[0].Rows[0]["Employee_Name"].ToString();
                    string orgName = ds.Tables[0].Rows[0]["OrgName"].ToString();
                    SessionSet.PageMessage = "该岗位培训合格证书编号在系统中已存在,与【" + orgName + "】的【" + strName + "】岗位培训合格证书编号相同!";
                    //ClientScript.RegisterStartupScript(GetType(), "OK", "alert('该岗位培训合格证书编号在系统中已存在,\r\n与【" + orgName + "】的【" + strName + "】岗位培训合格证书编号相同!');", true);
                    return;
                }
            }

            string   sqlStr     = string.Empty;
            DateTime isnulldate = new DateTime(0001, 01, 01);
            DateTime birthday,
                     begin_date,
                     join_rail_date,
                     workgroupleader_order_date,
                     award_date;
            DateTime postDate,           //任现职名时间
                     technicalTitleDate, //技术职称聘任时间
                     technicalDate,      //技能等级取得时间
                     graduateDate;       //毕业时间
            string graduateUniversity,   //毕业院校
                   studyMajor,           //所学专业
                   universityType;       //学校类别

            if (!DateTime.TryParse(this.dateBIRTHDAY.DateValue.ToString(), out birthday))
            {
                birthday = isnulldate;
            }
            if (!DateTime.TryParse(this.dateBEGIN_DATE.DateValue.ToString(), out begin_date))
            {
                begin_date = isnulldate;
            }
            if (!DateTime.TryParse(this.dateJOIN_RAIL_DATE.DateValue.ToString(), out join_rail_date))
            {
                join_rail_date = isnulldate;
            }

            if (ddlWORKGROUPLEADER_TYPE_ID.SelectedValue != "-1")
            {
                if (!DateTime.TryParse(this.dateWORKGROUPLEADER_ORDER_DATE.DateValue.ToString(), out workgroupleader_order_date))
                {
                    workgroupleader_order_date = isnulldate;
                }
            }
            else
            {
                workgroupleader_order_date = isnulldate;
            }

            if (!DateTime.TryParse(this.dateAWARD_DATE.DateValue.ToString(), out award_date))
            {
                award_date = isnulldate;
            }
            if (!DateTime.TryParse(this.datePost.DateValue.ToString(), out postDate))
            {
                postDate = isnulldate;
            }
            if (!DateTime.TryParse(this.dateTechnicalDate.DateValue.ToString(), out technicalDate))
            {
                technicalDate = isnulldate;
            }
            if (!DateTime.TryParse(this.dateTechnicalTitle.DateValue.ToString(), out technicalTitleDate))
            {
                technicalTitleDate = isnulldate;
            }
            if (!DateTime.TryParse(this.dateGraduate.DateValue.ToString(), out graduateDate))
            {
                graduateDate = isnulldate;
            }
            if (this.txtMEMO.Text.ToString().Length > 50)
            {
                ClientScript.RegisterStartupScript(GetType(), "OK", "alert('备注不能超过50个字符!');", true);
                return;
            }

            OracleAccess ora = new OracleAccess();

            int ISONPOST = this.cbISONPOST.Checked == true ? 1 : 0;

            if (!string.IsNullOrEmpty(type))
            {
                int typeBool = int.Parse(type);
                if (typeBool == 1)
                {
                    sqlStr  = "update employee set org_id= '" + Convert.ToInt32(hfOrgID.Value) + "',";
                    sqlStr += "post_no= '" + this.txtPOST_NO.Text.Trim() + "',";
                    sqlStr += "employee_name= '" + this.txtEMPLOYEE_NAME.Text.Trim() + "',";
                    sqlStr += "pinyin_code= '" + this.txtPinYin.Text.Trim() + "',";
                    sqlStr += "post_id= '" + Convert.ToInt32(this.hfPostID.Value) + "',";
                    sqlStr += "now_post_id= " + (hfNowPostID.Value == "" ? "null" : "'" + hfNowPostID.Value + "'") + ",";
                    sqlStr += "sex= '" + this.ddlSex.SelectedValue + "',";
                    sqlStr += "birthday=to_date('" + birthday + "','yyyy-mm-dd hh24:mi:ss'),";
                    sqlStr += "native_place= '" + this.txtNATIVE_PLACE.Text.Trim() + "',";
                    sqlStr += "folk= '" + this.txtFOLK.Text.Trim() + "',";
                    sqlStr += "wedding= '" + Convert.ToInt32(this.rblWEDDING.SelectedValue) + "',";
                    sqlStr += "begin_date= to_date('" + begin_date + "','yyyy-mm-dd hh24:mi:ss'),";
                    sqlStr += "IsOnPost= '" + ISONPOST + "',";
                    sqlStr += "memo= '" + this.txtMEMO.Text.Trim() + "',";
                    sqlStr += "is_group_leader= '" + Convert.ToInt32(this.ddlIsGroup.SelectedValue) + "',";
                    sqlStr += "technician_type_id = '" + int.Parse(this.ddlTECHNICIAN_TYPE_ID.SelectedValue) + "',";
                    sqlStr += "technical_title_id='" + int.Parse(this.ddlTECHNICAL_TITLE_ID.SelectedValue) + "',";
                    sqlStr += "work_no='" + this.txtWORK_NO.Text.Trim() + "',";
                    sqlStr += "identity_cardno='" + this.txtIDENTITY_CARDNO.Text.Trim() + "',";
                    sqlStr += "political_status_id='" + int.Parse(this.ddlPOLITICAL_STATUS.SelectedValue) + "',";
                    sqlStr += "join_rail_date=to_date('" + join_rail_date + "','yyyy-mm-dd hh24:mi:ss'),";
                    sqlStr += "education_level_id='" + int.Parse(this.DDLeducation_level_id.SelectedValue) + "',";
                    sqlStr += "employee_type_id='" + int.Parse(this.ddlEMPLOYEE_TYPE_ID.SelectedValue) + "',";
                    sqlStr += "second_post_id=" + (this.hfSECOND_POST_ID.Value == "" ? "NULL" : hfSECOND_POST_ID.Value) +
                              ",";
                    sqlStr += "third_post_id=" + (this.hfTHIRD_POST_ID.Value == "" ? "NULL" : hfTHIRD_POST_ID.Value) +
                              ",";

                    sqlStr += "workgroupleader_type_id='" + int.Parse(this.ddlWORKGROUPLEADER_TYPE_ID.SelectedValue) +
                              "'," +
                              "workgroupleader_order_date=to_date('" + workgroupleader_order_date +
                              "','yyyy-mm-dd hh24:mi:ss')," +
                              "education_employee_type_id='" +
                              int.Parse(this.ddlEDUCATION_EMPLOYEE_TYPE_ID.SelectedValue) + "'," +
                              "committee_head_ship_id='" + int.Parse(this.ddlCOMMITTEE_HEAD_SHIP_ID.SelectedValue) +
                              "'," +
                              "isregistered='" + int.Parse(this.ddlISREGISTERED.SelectedValue) + "'," +
                              "employee_transport_type_id='" +
                              int.Parse(this.ddlEMPLOYEE_TRANSPORT_TYPE_ID.SelectedValue) + "'," +
                              "award_date=to_date('" + award_date + "','yyyy-mm-dd hh24:mi:ss')," +
                              "could_post_id='" + this.hfCOULD_POST_ID.Value.Trim().ToString() + "'," +
                              "TECHNICAL_DATE = to_date('" + technicalDate + "','yyyy-mm-dd hh24:mi:ss')," +
                              "TECHNICAL_TITLE_DATE = to_date('" + technicalTitleDate + "','yyyy-mm-dd hh24:mi:ss')," +
                              "POST_DATE = to_date('" + postDate + "','yyyy-mm-dd hh24:mi:ss')," +
                              "GRADUATE_DATE = to_date('" + graduateDate + "','yyyy-mm-dd hh24:mi:ss')," +
                              "GRADUATE_UNIVERSITY = '" + this.txtFinishSchool.Text + "'," +
                              "STUDY_MAJOR = '" + this.txtMajor.Text + "'," +
                              "UNIVERSITY_TYPE = '" + this.dropSchoolCategory.SelectedValue + "'," +
                              "TECHNICAL_CODE = '" + this.txtTechnicalCode.Text + "'," +
                              "Safe_Level_ID=" + (ddlSafe.SelectedValue == "" ? "NULL" : ddlSafe.SelectedValue) +
                              " where employee_id = " + id;
                }
                else if (typeBool == 2)
                {
                    sqlStr = "select EMPLOYEE_SEQ.NEXTVAL from dual";
                    id     = ora.RunSqlDataSet(sqlStr).Tables[0].Rows[0][0].ToString();

                    sqlStr = "insert into employee (employee_id," +
                             "org_id," +
                             "post_no," +
                             "employee_name," +
                             "pinyin_code," +
                             "post_id," +
                             "sex," +
                             "birthday," +
                             "native_place," +
                             "folk," +
                             "wedding," +
                             "begin_date," +
                             "IsOnPost," +
                             "memo," +
                             "is_group_leader," +
                             "technician_type_id," +
                             "technical_title_id," +
                             "work_no," +
                             //"photo," +
                             "identity_cardno," +
                             "political_status_id," +
                             "join_rail_date," +
                             "education_level_id," +
                             "employee_type_id," +
                             "second_post_id," +
                             "third_post_id," +
                             "workgroupleader_type_id," +
                             "workgroupleader_order_date," +
                             "education_employee_type_id," +
                             "committee_head_ship_id," +
                             "isregistered," +
                             "employee_transport_type_id," +
                             "award_date," +
                             "could_post_id," +
                             "TECHNICAL_DATE," +
                             "TECHNICAL_TITLE_DATE," +
                             "POST_DATE," +
                             "GRADUATE_UNIVERSITY," +
                             "GRADUATE_DATE," +
                             "STUDY_MAJOR," +
                             "UNIVERSITY_TYPE," +
                             "TECHNICAL_CODE,Safe_Level_ID,Now_Post_ID)" +
                             " values(" + id + "," +
                             Convert.ToInt32(this.hfOrgID.Value) + ",'" +
                             this.txtPOST_NO.Text.Trim().ToString() + "','" +
                             this.txtEMPLOYEE_NAME.Text.Trim().ToString() + "','" +
                             Pub.GetChineseSpell(this.txtEMPLOYEE_NAME.Text.Trim().ToString()) + "'," +
                             Convert.ToInt32(this.hfPostID.Value) + ",'" +
                             this.ddlSex.SelectedValue + "'," +
                             "to_date('" + birthday + "','yyyy-mm-dd hh24:mi:ss'),'" +
                             this.txtNATIVE_PLACE.Text.Trim().ToString() + "','" +
                             this.txtFOLK.Text.Trim().ToString() + "'," +
                             Convert.ToInt32(this.rblWEDDING.SelectedValue) + "," +
                             "to_date('" + begin_date + "','yyyy-mm-dd hh24:mi:ss')," +
                             ISONPOST + ",'" +
                             this.txtMEMO.Text.Trim().ToString() + "'," +
                             Convert.ToInt32(this.ddlIsGroup.SelectedValue) + "," +
                             int.Parse(this.ddlTECHNICIAN_TYPE_ID.SelectedValue) + "," +
                             int.Parse(this.ddlTECHNICAL_TITLE_ID.SelectedValue) + ",'" +
                             this.txtWORK_NO.Text.Trim().ToString() + "','" +
                             this.txtIDENTITY_CARDNO.Text.Trim().ToString() + "'," +
                             int.Parse(this.ddlPOLITICAL_STATUS.SelectedValue) + "," +
                             "to_date('" + join_rail_date + "','yyyy-mm-dd hh24:mi:ss')," +
                             int.Parse(this.DDLeducation_level_id.SelectedValue) + "," +
                             int.Parse(this.ddlEMPLOYEE_TYPE_ID.SelectedValue) + "," +
                             (this.hfSECOND_POST_ID.Value == "" ? "NULL" : hfSECOND_POST_ID.Value) + "," +
                             (this.hfTHIRD_POST_ID.Value == "" ? "NULL" : hfSECOND_POST_ID.Value) + "," +
                             int.Parse(this.ddlWORKGROUPLEADER_TYPE_ID.SelectedValue) + "," +
                             "to_date('" + workgroupleader_order_date + "','yyyy-mm-dd hh24:mi:ss')," +
                             int.Parse(this.ddlEDUCATION_EMPLOYEE_TYPE_ID.SelectedValue) + "," +
                             int.Parse(this.ddlCOMMITTEE_HEAD_SHIP_ID.SelectedValue) + "," +
                             int.Parse(this.ddlISREGISTERED.SelectedValue) + "," +
                             int.Parse(this.ddlEMPLOYEE_TRANSPORT_TYPE_ID.SelectedValue) + "," +
                             "to_date('" + award_date + "','yyyy-mm-dd hh24:mi:ss'),'" +
                             this.hfCOULD_POST_ID.Value.Trim().ToString() + "'," +
                             "to_date('" + technicalDate + "','yyyy-mm-dd hh24:mi:ss')," +
                             "to_date('" + technicalTitleDate + "','yyyy-mm-dd hh24:mi:ss')," +
                             "to_date('" + postDate + "','yyyy-mm-dd hh24:mi:ss')," +
                             "'" + this.txtFinishSchool.Text + "'," +
                             "to_date('" + graduateDate + "','yyyy-mm-dd hh24:mi:ss')," +
                             "'" + this.txtMajor.Text + "'," +
                             "'" + this.dropSchoolCategory.SelectedValue + "'," +
                             "'" + this.txtTechnicalCode.Text + "'," +
                             (ddlSafe.SelectedValue == "" ? "NULL" : ddlSafe.SelectedValue) + "," +
                             (hfNowPostID.Value == "" ? "null" : "'" + hfNowPostID.Value + "'") + ")";
                }

                try
                {
                    ora.ExecuteNonQuery(sqlStr);

                    if (typeBool == 2)
                    {
                        sqlStr = "insert into Employee_Photo values(" + id + ",null)";
                        ora.ExecuteNonQuery(sqlStr);
                    }

                    SystemUserBLL objSystemBll = new SystemUserBLL();
                    if (type == "1")
                    {
                        RailExam.Model.SystemUser objSystem = objSystemBll.GetUserByEmployeeID(Convert.ToInt32(id));
                        if (objSystem != null)
                        {
                            objSystem.UserID = txtWORK_NO.Text.Trim() == string.Empty
                                                   ? txtIDENTITY_CARDNO.Text.Trim()
                                                   : txtWORK_NO.Text.Trim();
                            objSystemBll.UpdateUser(objSystem);
                        }
                        else
                        {
                            objSystem            = new SystemUser();
                            objSystem.EmployeeID = Convert.ToInt32(id);
                            objSystem.Memo       = "";
                            objSystem.Password   = "******";
                            objSystem.RoleID     = 0;
                            objSystem.UserID     = txtWORK_NO.Text.Trim() == string.Empty
                                                   ? txtIDENTITY_CARDNO.Text.Trim()
                                                   : txtWORK_NO.Text.Trim();
                            objSystemBll.AddUser(objSystem);
                        }
                    }
                    else
                    {
                        RailExam.Model.SystemUser objSystem = new SystemUser();
                        objSystem.EmployeeID = Convert.ToInt32(id);
                        objSystem.Memo       = "";
                        objSystem.Password   = "******";
                        objSystem.RoleID     = 0;
                        objSystem.UserID     = txtWORK_NO.Text.Trim() == string.Empty
                                               ? txtIDENTITY_CARDNO.Text.Trim()
                                               : txtWORK_NO.Text.Trim();
                        objSystemBll.AddUser(objSystem);
                    }

                    if (!string.IsNullOrEmpty(fileUpload1.PostedFile.FileName))
                    {
                        string str = Server.MapPath("/RailExamBao/Excel/image");
                        if (!Directory.Exists(str))
                        {
                            Directory.CreateDirectory(str);
                        }

                        string strFileName = Path.GetFileName(fileUpload1.PostedFile.FileName);
                        string strPath     = Server.MapPath("/RailExamBao/Excel/image/" + strFileName);

                        if (File.Exists(strPath))
                        {
                            File.Delete(strPath);
                        }

                        FileInfo fi         = new FileInfo(fileUpload1.PostedFile.FileName);
                        string   extensions = ".jpg,.jpeg,.gif";
                        if (!extensions.Contains(fi.Extension.ToLower()))
                        {
                            this.ClientScript.RegisterStartupScript(this.GetType(), "OK",
                                                                    "alert('只能上传GIF, JPEG(JPG)格式的图片!');", true);
                            return;
                        }

                        ((HttpPostedFile)fileUpload1.PostedFile).SaveAs(strPath);

                        this.myImagePhoto.ImageUrl = strPath;
                        AddImage(Int32.Parse(id), strPath);
                    }
                    SystemLogBLL objLogBll = new SystemLogBLL();
                    objLogBll.WriteLog("保存职工:" + txtEMPLOYEE_NAME.Text + "的档案信息!");
                }
                catch (Exception ex)
                {
                    this.ClientScript.RegisterStartupScript(this.GetType(), "OK", "alert('" + ex.Message + "');", true);
                    return;
                }
                string          OrgID  = this.hfOrgID.Value;
                OrganizationBLL objBll = new OrganizationBLL();
                string          idpath = Request.QueryString.Get("idpath");

                if (string.IsNullOrEmpty(Request.QueryString.Get("style")))
                {
                    string strQuery = Request.QueryString.Get("strQuery");
                    this.ClientScript.RegisterStartupScript(this.GetType(), "OK",
                                                            "this.location.href='EmployeeInfo.aspx?ID=" +
                                                            OrgID + "&idpath=" + idpath + "&type=Org&strQuery=" + strQuery + "';", true);
                }
                else
                {
                    this.ClientScript.RegisterStartupScript(this.GetType(), "OK", "top.returnValue='true';top.close();",
                                                            true);
                }
            }
        }
Exemple #26
0
        protected void btnStop_Click(object sender, EventArgs e)
        {
            ViewState["EndTime"] = DateTime.Now.ToString();
            //记录当前考试所在地的OrgID
            ViewState["OrgID"] = ConfigurationManager.AppSettings["StationID"];

            string strId = Request.QueryString.Get("RandomExamID");

            if (string.IsNullOrEmpty(strId))
            {
                SessionSet.PageMessage = "缺少参数!";
                return;
            }

            //获取当前考试的生成试卷的状态和次数
            RandomExamBLL objBll = new RandomExamBLL();

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

            RandomExamComputerServerBLL serverBll = new RandomExamComputerServerBLL();
            RandomExamComputerServer    server    = serverBll.GetRandomExamComputerServer(objExam.RandomExamId,
                                                                                          PrjPub.ServerNo);


            if (server.IsStart == 0)
            {
                if (objExam.EndTime >= DateTime.Today)
                {
                    SessionSet.PageMessage = "当前考试还未开始考试!";
                    return;
                }
            }
            else if (server.IsStart == 2)
            {
                SessionSet.PageMessage = "当前考试已经结束!";
                return;
            }

            RandomExamResultCurrentBLL      objResultCurrentBll = new RandomExamResultCurrentBLL();
            IList <RandomExamResultCurrent> objResultCurrent    =
                objResultCurrentBll.GetStartRandomExamResultInfo(Convert.ToInt32(strId));

            IList <RandomExamResultCurrent> objResultCurrentNew = new List <RandomExamResultCurrent>();

            try
            {
                RandomExamResultBLL objResultBll = new RandomExamResultBLL();

                foreach (RandomExamResultCurrent current in objResultCurrent)
                {
                    current.CurrentDateTime = DateTime.Parse(ViewState["EndTime"].ToString());
                    current.ExamTime        = GetSecondBetweenTwoDate(DateTime.Parse(ViewState["EndTime"].ToString()),
                                                                      current.BeginDateTime);

                    current.EndDateTime    = DateTime.Parse(ViewState["EndTime"].ToString());
                    current.Score          = 0;
                    current.OrganizationId = int.Parse(ViewState["OrgID"].ToString());
                    current.Memo           = "";
                    //参加考试将当前考试的标志置为2-已经结束
                    current.StatusId    = 2;
                    current.AutoScore   = 0;
                    current.CorrectRate = 0;
                    //objResultCurrentNew.Add(current);
                    objResultCurrentBll.UpdateRandomExamResultCurrent(current);

                    int randomExamResultID = objResultBll.RemoveResultAnswer(Convert.ToInt32(current.RandomExamResultId));
                    //int randomExamResultID = objResultBll.RemoveResultAnswerCurrent(Convert.ToInt32(current.RandomExamResultId));

                    try
                    {
                        OracleAccess dbPhoto = new OracleAccess();
                        string       strSql  = "select * from Random_Exam_Result_Detail where Random_Exam_Result_ID=" +
                                               randomExamResultID + " and Random_Exam_ID=" + current.RandomExamId;
                        DataSet dsPhoto = dbPhoto.RunSqlDataSet(strSql);

                        if (dsPhoto.Tables[0].Rows.Count > 0)
                        {
                            DataRow drPhoto    = dsPhoto.Tables[0].Rows[0];
                            int     employeeId = Convert.ToInt32(drPhoto["Employee_ID"]);
                            if (drPhoto["FingerPrint"] != DBNull.Value)
                            {
                                Pub.SavePhotoToLocal(current.RandomExamId, employeeId, (byte[])drPhoto["FingerPrint"], 0, randomExamResultID);
                            }
                            if (drPhoto["Photo1"] != DBNull.Value)
                            {
                                Pub.SavePhotoToLocal(current.RandomExamId, employeeId, (byte[])drPhoto["Photo1"], 1, randomExamResultID);
                            }
                            if (drPhoto["Photo2"] != DBNull.Value)
                            {
                                Pub.SavePhotoToLocal(current.RandomExamId, employeeId, (byte[])drPhoto["Photo2"], 2, randomExamResultID);
                            }
                            if (drPhoto["Photo3"] != DBNull.Value)
                            {
                                Pub.SavePhotoToLocal(current.RandomExamId, employeeId, (byte[])drPhoto["Photo3"], 3, randomExamResultID);
                            }
                        }
                    }
                    catch
                    {
                        hfSql.Value = GetSql();
                    }
                }

                hfSql.Value = GetSql();
                examsGrid.DataBind();
                SystemLogBLL objLogBll = new SystemLogBLL();
                objLogBll.WriteLog("“" + objExam.ExamName + "”终止正在进行的所有考试");
                SessionSet.PageMessage = "终止当前考试成功!";
            }
            catch
            {
                SessionSet.PageMessage = "终止当前考试失败!";
            }
        }
Exemple #27
0
        public HttpResponseMessage AddCizitenEvent(RSM_CitizenModel cmmodel)
        {
            UserBLL         userbll = new UserBLL();
            HttpRequestBase request = ((HttpContextWrapper)this.Request.Properties["MS_HttpContext"]).Request;
            //文件上传
            HttpFileCollectionBase files = request.Files;
            sm_citizenservices     model = new sm_citizenservices();
            List <FileClass>       list  = new List <FileClass>();

            string[] fileClass = cmmodel.uploadpanelValue;

            if (fileClass != null && fileClass.Length > 0)
            {
                foreach (var item in fileClass)
                {
                    FileClass infileClass = new FileClass();
                    JObject   jo          = new JObject();
                    jo = (JObject)JsonConvert.DeserializeObject(item);
                    infileClass.OriginalPath = jo["OriginalPath"] == null ? "" : jo["OriginalPath"].ToString();
                    infileClass.OriginalName = jo["OriginalName"] == null ? "" : jo["OriginalName"].ToString();
                    infileClass.OriginalType = jo["OriginalType"] == null ? "" : jo["OriginalType"].ToString();
                    infileClass.size         = jo["size"] == null ? 0 : (double)jo["size"];
                    list.Add(infileClass);
                }
            }

            if (!string.IsNullOrEmpty(request.Form["dutytime"]))
            {
                model.dutytime = Convert.ToDateTime(request.Form["dutytime"]);
            }
            model.eventid     = request.Form["eventid"];
            model.sourceid    = Convert.ToInt32(request.Form["sourceid"]);
            model.complainant = request.Form["complainant"];
            if (!string.IsNullOrEmpty(request.Form["cnumber"]))
            {
                model.cnumber = Convert.ToInt32(request.Form["cnumber"]);
            }
            if (!string.IsNullOrEmpty(request.Form["foundtime"]))
            {
                model.foundtime = Convert.ToDateTime(request.Form["foundtime"]);
            }
            model.contactphone   = request.Form["contactphone"];
            model.contactaddress = request.Form["contactaddress"];
            model.eventaddress   = request.Form["eventaddress"];
            model.eventtitle     = request.Form["eventtitle"];
            model.eventcontent   = request.Form["eventcontent"];
            model.bigtypeid      = Convert.ToInt32(request.Form["bigtypeid"]);
            model.smalltypeid    = Convert.ToInt32(request.Form["smalltypeid"]);
            if (!string.IsNullOrEmpty(request.Form["limittime"]))
            {
                model.limittime = Convert.ToDateTime(request.Form["limittime"]);
            }
            model.recorduser = request.Form["recorduser"];
            model.grometry   = request.Form["grometry"];
            model.sfzxzz     = Convert.ToInt32(request.Form["sfzxzz"]);
            if (!string.IsNullOrEmpty(request.Form["srid"]))
            {
                model.srid = Convert.ToInt32(request.Form["srid"]);
            }
            model.createtime   = DateTime.Now;
            model.createuserid = Convert.ToInt32(request.Form["userid"]);
            model.workflowtype = request.Form["zptype"];
            model.suggest      = request.Form["suggest"];
            model.officeuserid = Convert.ToInt32(request.Form["userid"]);
            if (!string.IsNullOrEmpty(request.Form["xzid"]))
            {
                model.xzid   = Convert.ToInt32(request.Form["xzid"]);
                model.pqxzid = request.Form["xzid"];
            }
            WorkFlowClass wf      = new WorkFlowClass();
            WorkFlowClass wfs     = new WorkFlowClass();
            string        userids = request.Form["userid"];

            if (!string.IsNullOrEmpty(userids))
            {
                string useridsstr = "";
                foreach (UserModel item in userbll.GetUsersStaffList(2))
                {
                    useridsstr += item.ID + ",";
                }
                userids = "," + useridsstr;
            }


            #region 事件流程
            wf.FunctionName   = "sm_citizenservices";                                                                //市民事件表名
            wf.WFID           = "2017021409560001";                                                                  //工作流程编号 2017021409560001 事件流程
            wf.WFDID          = "2017021410240010";                                                                  //工作流详细编号 2017021410240001 上报事件
            wf.NextWFDID      = request.Form["zptype"];                                                              //下一步流程编号 2017021410240002 事件派遣
            wf.NextWFUSERIDS  = request.Form["zptype"] == "2017021410240001" ? userids : request.Form["nextperson"]; //下一步流程ID
            wf.DEALCONTENT    = request.Form["suggest"];
            wf.IsSendMsg      = "false";                                                                             //是否发送短信
            wf.WFCreateUserID = Convert.ToInt32(request.Form["userid"]);                                             //当前流程创建人
            wf.files          = list;
            #endregion

            WorkFlowManagerBLL bll       = new WorkFlowManagerBLL();
            string             wf_id     = bll.WF_Submit(wf, model);
            string[]           wf_ids    = null;
            string             wfsid     = "";
            string             wfasid    = "";
            string             citizenid = "";
            if (!string.IsNullOrEmpty(wf_id))
            {
                wf_ids    = wf_id.Split(',');
                wfsid     = wf_ids[0];
                wfasid    = wf_ids[1];
                citizenid = wf_ids[2];
            }

            #region 违章建筑同步信息
            if (request.Form["sfwj"] == "1")
            {
                WJ_WzjzsBLL   wjbll   = new WJ_WzjzsBLL();
                WJ_WzjzsModel wjmodel = new WJ_WzjzsModel();
                WJ_FilesBLL   filebll = new WJ_FilesBLL();
                wjmodel.wjholder     = model.eventtitle;
                wjmodel.citizenid    = citizenid;
                wjmodel.foundtime    = model.foundtime;
                wjmodel.address      = model.eventaddress;
                wjmodel.contactphone = model.contactphone;

                int wjid = wjbll.AddWzjzs(wjmodel);
                wjmodel.parentid = wjid;
                int success = wjbll.AddWzjzs(wjmodel);

                foreach (var item in list)
                {
                    WJ_FilesModel wjfilemodel = new WJ_FilesModel();
                    wjfilemodel.filetype = item.OriginalType;
                    wjfilemodel.filename = item.OriginalName;
                    wjfilemodel.filepath = item.OriginalPath;
                    wjfilemodel.source   = 1;
                    wjfilemodel.sourceid = success;
                    wjfilemodel.filesize = item.size;
                    filebll.AddCqxm(wjfilemodel);

                    //复制文件
                    DateTime dt = DateTime.Now;
                    if (!Directory.Exists(ConfigManageClass.IllegallyBuiltOriginalPath))
                    {
                        Directory.CreateDirectory(ConfigManageClass.IllegallyBuiltOriginalPath);
                    }
                    string OriginalPathYear = ConfigManageClass.IllegallyBuiltOriginalPath + "\\" + dt.Year;
                    if (!Directory.Exists(OriginalPathYear))
                    {
                        Directory.CreateDirectory(OriginalPathYear);
                    }
                    string OriginalPathdate = OriginalPathYear + "\\" + dt.ToString("yyyyMMdd");
                    if (!Directory.Exists(OriginalPathdate))
                    {
                        Directory.CreateDirectory(OriginalPathdate);
                    }
                    File.Copy(ConfigManageClass.CitizenServiceOriginalPath + wjfilemodel.filepath, ConfigManageClass.IllegallyBuiltOriginalPath + wjfilemodel.filepath, true);
                }
            }
            #endregion

            #region 添加日志
            SystemLogBLL slbll = new SystemLogBLL();
            slbll.WriteSystemLog("市民事件", "", Convert.ToInt32(request.Form["userid"]));
            #endregion

            //#region 发送短信
            //string phone = "";//15888309757,18768196242
            //SMS_Messages sm = new SMS_Messages();
            //string[] phones = phone.Split(',');
            //string content = "您有一条新的市民事件需要处理,限办期限:" + model.limittime + ",请及时处理";
            //sm.SendMessage(phones, content);
            //#endregion

            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK);
            response.Content = new StringContent("{\"success\":true}", Encoding.GetEncoding("UTF-8"), "text/html");
            return(response);
        }
Exemple #28
0
        public HttpResponseMessage AddSimpleCase()
        {
            HttpRequestBase       request       = ((HttpContextWrapper)this.Request.Properties["MS_HttpContext"]).Request;
            Case_SimpleCasesBLL   bll           = new Case_SimpleCasesBLL();
            Case_CaseSourcesBLL   casesourcebll = new Case_CaseSourcesBLL();
            Case_SimpleCasesModel model         = new Case_SimpleCasesModel();

            model.cfjdsbh        = request["cfjdsbh"];
            model.casetypeid     = request["casetypeid"];
            model.casename       = request["casename"];
            model.qlsxid         = request["qlsxid"];
            model.qlsx           = request["qlsx"];
            model.casereason     = request["casereason"];
            model.fromcasesource = request["fromcasesource"];
            model.caseaddress    = request["caseaddress"];
            model.sitedatetime   = Convert.ToDateTime(request["sitedatetime"]);
            model.geographical84 = request["grometry"];
            model.persontype     = request["persontype"];
            model.f_card         = request["f_card"];
            if (request["persontype"] == "type_zrr")
            {
                model.p_name           = request["p_name"];
                model.p_contactphone   = request["contactphone"];
                model.p_contactaddress = request["contactaddress"];
                model.p_cardtypename   = request["f_cardtype"] == "1" ? "身份证" : request["f_cardtype"] == "2" ? "军官证" : "护照";
            }
            else
            {
                model.f_name           = request["f_name"];
                model.f_dbr            = request["f_dbr"];
                model.f_cardnum        = request["f_cardnum"];
                model.f_contactphone   = request["contactphone"];
                model.f_contactaddress = request["contactaddress"];
                model.f_cardtypename   = request["f_cardtype"] == "1" ? "组织机构代码证" : request["f_cardtype"] == "2" ? "营业执照" : request["f_cardtype"] == "3" ? "税务登记证" : "社会信用代码";
            }

            model.p_sex          = request["p_sex"];
            model.p_cardtype     = request["p_cardtype"];
            model.p_cardnum      = request["p_cardnum"];
            model.f_cardtype     = request["f_cardtype"];
            model.f_wtr          = request["f_wtr"];
            model.contactphone   = request["contactphone"];
            model.contactaddress = request["contactaddress"];
            model.flfg           = request["flfg"];
            model.clyj           = request["clyj"];
            model.wfqx           = request["wfqx"];
            model.cf             = request["cf"];
            model.zdmj           = !string.IsNullOrEmpty(request["zdmj"]) ? Convert.ToDouble(request["zdmj"]) : 0;
            model.gdmj           = !string.IsNullOrEmpty(request["gdmj"]) ? Convert.ToDouble(request["gdmj"]) : 0;
            model.gtjzmj         = !string.IsNullOrEmpty(request["gtjzmj"]) ? Convert.ToDouble(request["gtjzmj"]) : 0;
            model.ghjzmj         = !string.IsNullOrEmpty(request["ghjzmj"]) ? Convert.ToDouble(request["ghjzmj"]) : 0;
            model.casecontent    = request["casecontent"];
            model.jktype         = request["jktype"];
            if (!string.IsNullOrEmpty(request["fk_money"]))
            {
                model.fk_money = Convert.ToDecimal(request["fk_money"]);
            }
            model.bank_name        = request["bank_name"];
            model.bank_account     = request["bank_account"];
            model.bank_accountname = request["bank_accountname"];
            model.zfr_name         = request["zfr_name"];
            model.zf_card          = request["zf_card"];
            model.zf_time          = Convert.ToDateTime(request["zf_time"]);
            model.zf_address       = request["zf_address"];
            model.createuserid     = Convert.ToInt32(request["userid"]);
            model.cswfsid          = request["cswfsid"];
            if (!string.IsNullOrEmpty(request["tzcsid"]))
            {
                model.tzcsid = Convert.ToInt32(request["tzcsid"]);
            }

            model.isphone = 0;

            int caseid = bll.AddSimpleCases(model);

            Case_WorkFlowManagerBLL wfbll = new Case_WorkFlowManagerBLL();
            Case_WorkFlowClass      wf    = new Case_WorkFlowClass();

            if (!string.IsNullOrEmpty(request["tzcsid"]))
            {
                casesourcebll.RegisterCaseSources(Convert.ToInt32(request["tzcsid"]));
            }

            #region 案件流程
            wf.FunctionName   = "case_simplecases";
            wf.WFID           = "2017022316200001";
            wf.WFDID          = "2017022316250001";
            wf.NextWFDID      = "2017022316250002";
            wf.NextWFUSERIDS  = "";                                      //下一步流程ID
            wf.IsSendMsg      = "false";                                 //是否发送短信
            wf.WFCreateUserID = Convert.ToInt32(request.Form["userid"]); //当前流程创建人
            wf.caseid         = caseid;
            wf.casetype       = 3;
            wf.casereason     = model.casereason;
            #endregion

            string wf_data = wfbll.WF_Submit(wf);

            #region 简易案件文书
            List <Doc_WfsasModel> WfsasList = new List <Doc_WfsasModel>();
            Doc_WfsasModel        dwmodel   = new Doc_WfsasModel();

            dwmodel.wfsaid       = wf_data.Split(new string[] { "wfsaid\":\"" }, StringSplitOptions.RemoveEmptyEntries)[1].Substring(0, 22);
            dwmodel.filetyoe     = 3;
            dwmodel.ddid         = 12;
            dwmodel.createuserid = Convert.ToInt32(request["userid"]);
            dwmodel.ddtablename  = "case_simplecases";
            dwmodel.caseid       = caseid;
            dwmodel.ddtableid    = caseid;
            dwmodel.filename     = "立案审批表";
            dwmodel.status       = 0;

            //生成WORD、PDF文件
            DocumentReplaceHandleBLL    drhbll = new DocumentReplaceHandleBLL();
            Dictionary <string, string> dic    = casesourcebll.ToWordPDF(dwmodel.filename, System.Web.Hosting.HostingEnvironment.MapPath("~/DocumentTemplate/" + dwmodel.filename + (model.persontype == "type_zrr" ? "(个人)" : "(单位)") + ".docx"), ConfigManageClass.LegalCasePath, drhbll.GetDocumentDictory(model));

            dwmodel.lastwordpath = dic["WordPath"];
            dwmodel.lastpdfpath  = dic["PDFPath"];

            WfsasList.Add(dwmodel);
            casesourcebll.function_AddWfsas(WfsasList);
            #endregion
            #region 添加日志
            SystemLogBLL slbll = new SystemLogBLL();
            slbll.WriteSystemLog("简易案件", "", Convert.ToInt32(request["userid"]));
            #endregion

            HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK);
            response.Content = new StringContent("{\"success\":true," + wf_data + "}", Encoding.GetEncoding("UTF-8"), "text/html");

            return(response);
        }
        private void DeleteData(int nLogID)
        {
            SystemLogBLL systemLogBLL = new SystemLogBLL();

            systemLogBLL.DeleteLog(nLogID);
        }
        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>");
        }