예제 #1
0
        public int deleteMainEventDelete(DateTime end)
        {
            int numDelete = 0;

            string[] tablesName = getListOfTableInPeriod("event", end);
            foreach (string table in tablesName)
            {
                try
                {
                    numDelete += VsDbConnection.deleteMainData(table, end);

                    //¶éÒäÁèÁÕ¢éÍÁÙÅàËÅ×Íã¹µÒÃÒ§¡çãËéźµÒÃÒ§·Ôé§
                    if (VsDbConnection.getNumDataInTable(table) == 0 && !table.Equals(VsDbConnection.DateTimeToTableName("event", DateTime.Now)))
                    {
                        VsDbConnection.deleteTable(table);
                    }
                }
                catch (Exception ex)
                {
                    if (VsDbDelete.setmsg != null)
                    {
                        VsDbDelete.setmsg("ex", "in deleteMainEventDelete  before:" + end + "table" + table + ex.Message + " " + ex.StackTrace);
                    }
                }
            }//ǹ·Ó·Ø¡ table ·ÕèÍÂÙè㹪èǧ firstTable ¶Ö§ endTable

            return(numDelete);
        }
예제 #2
0
        private int deleteMainDataAndFileEachTable(string table, DateTime end)
        {
            //´Ö§ª×èÍfile ÁÒ¨Ò¡ main DB
            string[] filesName = VsDbConnection.getFiles(table, end);

            //àÍÒ¤èÒ¨Ò¡ä¿Åì config
            AppConfigData config = new AppConfigData();

            config.LoadSettings("app.config");
            string rootDir = config.localHost.Storage;//new FileInfo(filesName[0]).Directory.Parent.Parent.FullName;

            //ź¢éÍÁÙÅã¹ main DB
            int numMainDbDelte = VsDbConnection.deleteMainData(table, end);


            //źfile
            int numFileDelete = fileManage.deleteFile(filesName);

            //¶éÒäÁèÁÕ¢éÍÁÙÅàËÅ×Íã¹µÒÃÒ§¡çãËéźµÒÃÒ§·Ôé§
            if (VsDbConnection.getNumDataInTable(table) == 0)
            {
                if (!table.Equals(VsDbConnection.DateTimeToTableName("data", DateTime.Now)))
                {
                    VsDbConnection.deleteTable(table);
                }
                deleteDirFileOfTable(table, rootDir);
            }

            //à»ÅÕºà·ÕèºÇèÒźä»à·èҡѹÁÑéÂ
            if ((numMainDbDelte != numFileDelete))
            {
                if (VsDbDelete.setmsg != null)
                {
                    VsDbDelete.setmsg("msg", "number dedeted don't match "
                                      + " numMainDbDelte:" + numMainDbDelte + " numFileDelete:" + numFileDelete);
                }
            }

            return(numMainDbDelte);
        }
예제 #3
0
 public int getNumDataInTable(string tableName)
 {
     return(VsDbConnection.getNumDataInTable(tableName));
 }