Пример #1
0
        private void NoticeData(string updatetime)
        {
            I_Sql = SqlFactory.MakeSelect(TableType.Table_Type.Notice);
            DataTable     SqlTable    = new DataTable();
            DataTable     SqliteTable = new DataTable();
            List <int>    listsql     = new List <int>();
            List <int>    listsqlite  = new List <int>();
            List <int>    difference  = new List <int>();
            List <string> SelectList  = new List <string>();

            SqlTable    = Db_Sql.ReSelectdtb(((SqlInterface)I_Sql).GetDatafromSql(updatetime));
            SqliteTable = Db_Sqlite.ReSelectdtb(I_Sql.GetSqliteSelect());
            Dictionary <int, NoticeModel> sqltablelist = GetSqlcNotice(SqlTable);
            IList <DbParameter[]>         parlist      = new List <DbParameter[]>();

            for (int j = 0; j < SqliteTable.Rows.Count; j++)
            {
                int id = Int32.Parse(SqliteTable.Rows[j]["ID"].ToString());
                for (int i = 0; i < sqltablelist.Count; i++)
                {
                    if (id == sqltablelist.Keys.ToList()[i])
                    {
                        DbParameter[] DbUpdate = ExecutionSelectNotice(sqltablelist[id]);
                        parlist.Add(DbUpdate);
                        SelectList.Add(I_Sql.GetSqliteUpdate());
                        sqltablelist.Remove(id);
                        i--;
                    }
                }
            }

            foreach (int Select in sqltablelist.Keys)                                               //根据差集进行插入操作
            {
                DbParameter[] DbInsert = ExecutionSelectNotice(sqltablelist[Select]);
                parlist.Add(DbInsert);
                SelectList.Add(I_Sql.GetSqliteInsert());
            }

            SqlTable    = Db_Sql.ReSelectdtb(I_Sql.GetSqlSelect());
            SqliteTable = Db_Sqlite.ReSelectdtb(I_Sql.GetSqliteSelect());
            foreach (DataRow dr in SqlTable.Rows)
            {
                int id = Int32.Parse(dr["ID"].ToString());
                listsql.Add(id);
            }
            foreach (DataRow dr in SqliteTable.Rows)
            {
                int id = Int32.Parse(dr["ID"].ToString());
                listsqlite.Add(id);
            }
            difference = listsqlite.Except(listsql).ToList();
            foreach (int Select in difference)
            {
                Db_Sqlite.ExSQL(((SqlInterface)I_Sql).GetSqliteDelect(Select));                         //删除Service端没有的数据
            }

            int m = Db_Sqlite.ReExNum(SelectList, parlist);

            WriteLog("通知表需要更新" + SelectList.Count().ToString() + "条记录" + "  实际更新" + m.ToString() + "条记录");
        }
Пример #2
0
        private void SynchDataService()
        {
            string        updatetime  = string.Empty;
            DataTable     SqlTable    = new DataTable();
            DataTable     SqliteTable = new DataTable();
            List <string> SelectList  = new List <string>();

            I_Sql       = SqlFactory.MakeSelect(TableType.Table_Type.Service);
            SqlTable    = Db_Sql.ReSelectdtb(I_Sql.GetSqlSelect());
            SqliteTable = Db_Sqlite.ReSelectdtb(I_Sql.GetSqliteSelect());
            IList <DbParameter[]> parlist      = new List <DbParameter[]>();
            ServiceModel          servicemodel = GetServiceModel(SqlTable);

            if ((SqliteTable.Rows.Count > 0) && (SqlTable.Rows.Count > 0) && SqliteTable != null && SqlTable != null)
            {
                if (DateTime.Parse(SqlTable.Rows[0]["Update_Time"].ToString()) > DateTime.Parse(SqliteTable.Rows[0]["UpdateTime"].ToString()))
                {
                    if (servicemodel == null)
                    {
                        return;
                    }
                    DbParameter[] DbInsert = ExecutionSelectSet(servicemodel);
                    parlist.Add(DbInsert);
                    SelectList.Add(I_Sql.GetSqliteUpdate());
                }
            }
            else
            {
                if (servicemodel != null)
                {
                    DbParameter[] DbInsert = ExecutionSelectSet(servicemodel);
                    parlist.Add(DbInsert);
                    SelectList.Add(I_Sql.GetSqliteInsert());
                }
            }

            int m = Db_Sqlite.ReExNum(SelectList, parlist);

            WriteLog("服务表需要更新" + SelectList.Count().ToString() + "条记录" + "  实际更新" + m.ToString() + "条记录");
        }
Пример #3
0
        private void CompanyData(string updatetime)
        {
            I_Sql = SqlFactory.MakeSelect(TableType.Table_Type.Compnay);
            DataTable SqlTable = new DataTable();
            DataTable SqliteTable = new DataTable();
            List<int> listsql = new List<int>();
            List<int> listsqlite = new List<int>();
            List<int> difference = new List<int>();
            List<string> SelectList = new List<string>();
            SqlTable = Db_Sql.ReSelectdtb(((SqlInterface)I_Sql).GetDatafromSql(updatetime));
            SqliteTable = Db_Sqlite.ReSelectdtb(I_Sql.GetSqliteSelect());
            Dictionary<int, CompanyModel> sqltablelist = GetSqlcCompany(SqlTable);
            IList<DbParameter[]> parlist = new List<DbParameter[]>();

            for (int j = 0; j < SqliteTable.Rows.Count; j++)
            {
                int id = Int32.Parse(SqliteTable.Rows[j]["ID"].ToString());
                for (int i = 0; i < sqltablelist.Count; i++)
                {
                    if (id == sqltablelist.Keys.ToList()[i])
                    {
                        DbParameter[] DbUpdate = ExecutionSelectCompany(sqltablelist[id]);
                        parlist.Add(DbUpdate);
                        SelectList.Add(I_Sql.GetSqliteUpdate());
                        sqltablelist.Remove(id);
                        i--;
                    }
                }
            }

            foreach (int Select in sqltablelist.Keys)                                               //根据差集进行插入操作
            {
                DbParameter[] DbInsert = ExecutionSelectCompany(sqltablelist[Select]);
                parlist.Add(DbInsert);
                SelectList.Add(I_Sql.GetSqliteInsert());
            }

            SqlTable = Db_Sql.ReSelectdtb(I_Sql.GetSqlSelect());
            SqliteTable = Db_Sqlite.ReSelectdtb(I_Sql.GetSqliteSelect());
            foreach (DataRow dr in SqlTable.Rows)
            {
                int id = Int32.Parse(dr["ID"].ToString());
                listsql.Add(id);
            }
            foreach (DataRow dr in SqliteTable.Rows)
            {
                int id = Int32.Parse(dr["ID"].ToString());
                listsqlite.Add(id);
            }
            difference = listsqlite.Except(listsql).ToList();
            foreach (int Select in difference)
            {
                Db_Sqlite.ExSQL(((SqlInterface)I_Sql).GetSqliteDelect(Select));                         //删除Service端没有的数据
            }

            int m = Db_Sqlite.ReExNum(SelectList, parlist);
            WriteLog("公司表需要更新" + SelectList.Count().ToString() + "条记录" + "  实际更新" + m.ToString() + "条记录");
        }
Пример #4
0
        private void SynchDataSeting()
        {
            string updatetime = string.Empty;
            DataTable SqlTable = new DataTable();
            DataTable SqliteTable = new DataTable();
            List<string> SelectList = new List<string>();
            I_Sql = SqlFactory.MakeSelect(TableType.Table_Type.Seting);
            SqlTable = Db_Sql.ReSelectdtb(I_Sql.GetSqlSelect());
            SqliteTable = Db_Sqlite.ReSelectdtb(I_Sql.GetSqliteSelect());
            IList<DbParameter[]> parlist = new List<DbParameter[]>();
            SetModel setmodel = GetSetModel(SqlTable);
            if ((SqliteTable.Rows.Count > 0) && (SqlTable.Rows.Count > 0) && SqliteTable != null && SqlTable != null)
            {
                if (DateTime.Parse(SqlTable.Rows[0]["UpdateTime"].ToString()) > DateTime.Parse(SqliteTable.Rows[0]["UpdateTime"].ToString()))
                {
                    if (setmodel == null) return;
                    DbParameter[] DbInsert = ExecutionSelectSet(setmodel);
                    parlist.Add(DbInsert);
                    SelectList.Add(I_Sql.GetSqliteUpdate());
                }
            }
            else
            {
                if (setmodel != null)
                {
                    DbParameter[] DbInsert = ExecutionSelectSet(setmodel);
                    parlist.Add(DbInsert);
                    SelectList.Add(I_Sql.GetSqliteInsert());
                }
            }

            int m = Db_Sqlite.ReExNum(SelectList, parlist);
            WriteLog("参数配置表需要更新" + SelectList.Count().ToString() + "条记录" + "  实际更新" + m.ToString() + "条记录");
        }