Пример #1
0
        private void CreateData()
        {
            DateTime           beginTime  = DateTime.Now;
            SynchronizeLog     obj        = new SynchronizeLog();
            SynchronizeLogBLL  objlogdal  = new SynchronizeLogBLL();
            RefreshSnapShotBLL refreshbll = new RefreshSnapShotBLL();

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

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

            try
            {
                int orgID = PrjPub.CurrentLoginUser.StationOrgID;
                refreshbll.DropSnapShot();
                jsBlock = "<script>SetPorgressBar('正在初始化数据库','" + ((double)(100) / (double)7).ToString("0.00") + "'); </script>";
                Response.Write(jsBlock);
                Response.Flush();

                for (int i = 2; i <= 7; i++)
                {
                    refreshbll.CreateSnapShot(orgID, i);
                    System.Threading.Thread.Sleep(10);
                    jsBlock = "<script>SetPorgressBar('正在初始化数据库','" + ((double)(i * 100) / (double)7).ToString("0.00") + "'); </script>";
                    Response.Write(jsBlock);
                    Response.Flush();
                }

                obj.OrgID               = PrjPub.CurrentLoginUser.StationOrgID;
                obj.SynchronizeTypeID   = PrjPub.ResetDataBase;
                obj.SynchronizeStatusID = PrjPub.DownloadSuccess;
                obj.BeginTime           = beginTime;
                obj.EndTime             = DateTime.Now;
                objlogdal.AddSynchronizeLog(obj);
                Response.Write("<script>alert('初始化数据库成功!');top.close();</script>");
            }
            catch (Exception ex)
            {
                obj.OrgID               = PrjPub.CurrentLoginUser.StationOrgID;
                obj.SynchronizeTypeID   = PrjPub.ResetDataBase;
                obj.SynchronizeStatusID = PrjPub.DownloadFailed;
                obj.BeginTime           = beginTime;
                obj.EndTime             = DateTime.Now;
                objlogdal.AddSynchronizeLog(obj);
                Response.Write("<script>alert('初始化数据库失败!请检查站段服务器网络连接是否正常!');top.close();</script>");
            }
        }
Пример #2
0
        public static bool CheckServerCenter()
        {
            RefreshSnapShotBLL objBll = new RefreshSnapShotBLL();

            if (ConfigurationManager.AppSettings["ServerType"] == "0" && !objBll.IsExistsRefreshSnapShot("USP_REFRESH_SNAPSHOT", "PROCEDURE"))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!PrjPub.IsServerCenter)
            {
                RefreshSnapShotBLL objBll = new RefreshSnapShotBLL();
                if (!objBll.IsExistsRefreshSnapShot("BOOK", "MATERIALIZED VIEW"))
                {
                    Response.Redirect("RefreshDataDefault.aspx");
                }
            }

            BBSUrl = System.Configuration.ConfigurationManager.AppSettings["BBCUrl"].ToString();
            if (!IsPostBack)
            {
                BindGrid();
            }
        }
Пример #4
0
        private static void RefreshData(object source, ElapsedEventArgs e)
        {
            RefreshSnapShotBLL objBll = new RefreshSnapShotBLL();

            objBll.RefreshSnapshot();
        }
Пример #5
0
        private void DownLoadData()
        {
            string       templateFileName = Server.MapPath("/RailExamBao/RandomExam/ProgressBar.htm");
            StreamReader reader           = new StreamReader(@templateFileName, System.Text.Encoding.GetEncoding("gb2312"));
            string       html             = reader.ReadToEnd();

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

            DateTime           beginTime  = DateTime.Now;
            SynchronizeLog     obj        = new SynchronizeLog();
            SynchronizeLogBLL  objlogdal  = new SynchronizeLogBLL();
            RefreshSnapShotBLL refreshbll = new RefreshSnapShotBLL();

            try
            {
                string strInfo    = string.Empty;
                string proName    = string.Empty;
                int    num        = 5;
                int    selectType = Convert.ToInt32(Request.QueryString.Get("selectType"));
                if (selectType == 0)
                {
                    strInfo = "下载考试试卷";
                    proName = "USP_Refresh_SnapShot_Exam";
                    num     = 6;
                }
                else if (selectType == 1)
                {
                    strInfo = "下载教材与试题";
                    proName = "USP_Refresh_SnapShot_Book";
                    num     = 5;
                }
                else if (selectType == 2)
                {
                    strInfo = "下载职员基本信息和档案信息";
                    proName = "USP_Refresh_SnapShot_Employee";
                    num     = 4;
                }
                else if (selectType == 3)
                {
                    strInfo = "下载基础数据";
                    proName = "USP_Refresh_SnapShot_All";
                    num     = 9;
                }

                if (selectType == 0 || selectType == 3)
                {
                    for (int i = 1; i <= num - 1; i++)
                    {
                        refreshbll.RefreshSnapShot(proName, i);

                        System.Threading.Thread.Sleep(10);
                        jsBlock = "<script>SetPorgressBar('正在" + strInfo + "','" + ((double)(i * 100) / (double)num).ToString("0.00") + "'); </script>";
                        Response.Write(jsBlock);
                        Response.Flush();
                    }

                    string strSql =
                        @"select a.User_Ids from Random_Exam_Arrange_Detail  a
                       where a.Random_Exam_ID in (select Random_Exam_ID from Random_Exam_Computer_Server a 
                       where Computer_Server_No='" + PrjPub.ServerNo + "' and (Has_Paper=0 or Is_Start<2))";
                    OracleAccess dbCenter = new OracleAccess(System.Configuration.ConfigurationManager.ConnectionStrings["OracleCenter"].ConnectionString);
                    string       strwhere = string.Empty;
                    DataSet      ds       = dbCenter.RunSqlDataSet(strSql);
                    foreach (DataRow dr in ds.Tables[0].Rows)
                    {
                        string[] struserIds = dr["User_Ids"].ToString().Split(',');

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

                            if ((" or " + strwhere + " or ").IndexOf(" or Employee_ID=" + struserIds[i] + " or ") <= 0)
                            {
                                strwhere += strwhere == string.Empty
                                                ? "Employee_ID=" + struserIds[i]
                                                : " or Employee_ID=" + struserIds[i];
                            }
                        }
                    }

                    OracleAccess db = new OracleAccess();
                    if (db.GetCount("EMPLOYEE_FINGERPRINT", "MATERIALIZED VIEW") > 0)
                    {
                        strSql = "drop materialized view  Employee_FingerPrint";
                        db.ExecuteNonQuery(strSql);
                    }
                    if (strwhere == string.Empty)
                    {
                        strSql =
                            "create materialized view   Employee_FingerPrint   refresh force on demand as   select   *   from   Employee_FingerPrint@link_sf where 1=2";
                        db.ExecuteNonQuery(strSql);
                    }
                    else
                    {
                        strSql =
                            "create materialized view   Employee_FingerPrint   refresh force on demand as   select   *   from   Employee_FingerPrint@link_sf where  " +
                            strwhere;
                        db.ExecuteNonQuery(strSql);
                    }

                    System.Threading.Thread.Sleep(10);
                    jsBlock = "<script>SetPorgressBar('正在" + strInfo + "','" + ((double)(num * 100) / (double)num).ToString("0.00") + "'); </script>";
                    Response.Write(jsBlock);
                    Response.Flush();
                }
                else
                {
                    for (int i = 1; i <= num; i++)
                    {
                        refreshbll.RefreshSnapShot(proName, i);

                        System.Threading.Thread.Sleep(10);
                        jsBlock = "<script>SetPorgressBar('正在" + strInfo + "','" + ((double)(i * 100) / (double)num).ToString("0.00") + "'); </script>";
                        Response.Write(jsBlock);
                        Response.Flush();
                    }
                }


                obj.OrgID               = PrjPub.CurrentLoginUser.StationOrgID;
                obj.SynchronizeTypeID   = PrjPub.DownloadData;
                obj.SynchronizeStatusID = PrjPub.DownloadSuccess;
                obj.BeginTime           = beginTime;
                obj.EndTime             = DateTime.Now;
                objlogdal.AddSynchronizeLog(obj);
                Response.Write("<script>alert('下载成功!');top.close();</script>");
            }
            catch
            {
                obj.OrgID               = PrjPub.CurrentLoginUser.StationOrgID;
                obj.SynchronizeTypeID   = PrjPub.DownloadData;
                obj.SynchronizeStatusID = PrjPub.DownloadFailed;
                obj.BeginTime           = beginTime;
                obj.EndTime             = DateTime.Now;
                objlogdal.AddSynchronizeLog(obj);
                Response.Write("<script>alert('同步数据失败!请检查站段服务器网络连接是否正常!');top.close();</script>");
            }
        }
Пример #6
0
        public static bool IsCreateSnapShot()
        {
            RefreshSnapShotBLL objBll = new RefreshSnapShotBLL();

            return(objBll.IsExistsRefreshSnapShot("BOOK", "MATERIALIZED VIEW"));
        }