Ejemplo n.º 1
0
        public static void downloadGroup()
        {
            String            StationID = ManageLOG.getValueFromRegistry(Configurations.AppRegName, "StationID");
            int               total     = 0;
            int               success   = 0;
            GroupDao          dao       = new GroupDao();
            List <ModelGroup> lists     = dao.Select("");

            if (lists != null)
            {
                total = lists.Count;
                logger.Debug("# Start download [GROUP] from server.");

                foreach (ModelGroup model in lists)
                {
                    List <ModelGroup> tmp = dao.SelectOffine(" Where group_code='" + model.group_code + "'");
                    if (tmp != null)
                    {
                        if (tmp.Count > 0)
                        {
                        }
                        else
                        {
                            //logger.Debug(">>"+model.id+","+model.group_code);
                            if (model.id > 0)
                            {
                                if (dao.InsertOffline(model))
                                {
                                    success++;
                                }
                            }
                        }
                    }
                }
                logger.Debug("# Summary=> Total Download total: " + total + " success: " + success + " fail: " + (total - success));
                logger.Debug("# End Download data from server.");
            }
        }