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

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

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